stillmade-sdk 0.1.20 → 0.1.22

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.
@@ -1166,7 +1166,7 @@ bitsperframe: %d
1166
1166
  </g>
1167
1167
  </g>
1168
1168
  </g>
1169
- </g>`,OO=`http://www.w3.org/2000/svg`,kO=e=>e===`left`||e===`right`,AO=(e,t)=>e.querySelector(`[data-role="${t}"]`)}));function MO(e,t,n){e===`talk`&&(e=`talkGesture`);let r=BO[e];return r?r(t,n):{}}function NO(e){let t=(q(e*8.7)+1)/2;return{mOpen:2+t*12,mWidth:12+t*15,mCurve:2+q(e*4.6)*6}}function PO(e,t=0){return{armR:6*q(e*4.6),armL:4*q(e*4.6+1),headTilt:1.2*q(e*2.2)+t*3}}function FO(e,...t){let n={...e};for(let e of t)for(let t in e)n[t]=(n[t]||0)+e[t];return n}var q,IO,LO,RO,zO,BO,VO,HO,UO=o((()=>{q=Math.sin,IO=Math.cos,LO=Math.max,RO=Math.PI,zO=(e,t,n)=>e<t?t:e>n?n:e,BO={idle(e){return{headTilt:1.2*q(e*1.2),bob:1.5*q(e*1.5),armR:-8+2*q(e),armL:8-2*q(e)}},stand(e){return{headTilt:.5*q(e*1.1),bob:.6*q(e*1.3)}},turn(e){return BO.idle(e)},wave(e){return{armR:-150,elbowR:-30+18*q(e*9),headTilt:3,bob:1.2*q(e*1.5)}},point(e,t={}){return{armR:-132-zO((t.aimDY||0)*18,-10,22),elbowR:-6,headTilt:zO(-4+(t.aimDX||0)*6,-11,7),card:1,bob:q(e*1.3)}},look(e,t={}){return{headTilt:zO((t.aimDX||0)*9,-11,11),bob:1.1*q(e*1.3)}},lookAround(e,t={}){return{headTilt:((t.aimDX||0)*8||0)+10*q(e*.9),bob:1.1*q(e*1.2),armR:-8+2*q(e)}},walk(e,t={}){let n=e*(t.speed||1.2)%1*2*RO;return{legR:-28*q(n),legL:-28*q(n+RO),kneeR:34*LO(0,q(n+2)),kneeL:34*LO(0,q(n+RO+2)),armR:-8+22*q(n+RO),armL:8+22*q(n),elbowR:-12,elbowL:12,bob:-2-4*(.5-.5*IO(2*n))}},run(e,t={}){let n=e*(t.speed||1.2)*1.6%1*2*RO;return{legR:-42*q(n),legL:-42*q(n+RO),kneeR:46*LO(0,q(n+2)),kneeL:46*LO(0,q(n+RO+2)),armR:-22+34*q(n+RO),armL:22+34*q(n),elbowR:-42,elbowL:42,bob:-3-7*(.5-.5*IO(2*n)),headTilt:-4}},sit(e){return{legR:-58,legL:-56,kneeR:76,kneeL:74,bob:40,armR:-14,armL:14,headTilt:1*q(e*1.1)}},fall(e){return{headTilt:34,armR:-58,armL:58,elbowR:20,elbowL:-20,legR:-42,legL:18,kneeR:20,bob:22}},handshake(e){return{armR:-72+5*q(e*7),elbowR:34,headTilt:4,bob:1}},handOverItem(e){return{armR:-84,elbowR:22,armL:12,headTilt:3,bob:q(e*1.4)}},argue(e){return{armR:-66+22*q(e*6),elbowR:-22,armL:12,headTilt:5*q(e*3.2),bob:1.5*q(e*2)}},shrug(e){return{armL:26,armR:-26,elbowL:-34,elbowR:34,headTilt:2*q(e*1.4),bob:1+1.4*(.5-.5*IO(e*3))}},think(e){return{armR:-96,elbowR:-62,headTilt:8,armL:6,bob:.8*q(e*1.1)}},shocked(e){return{armR:-42,armL:42,elbowR:22,elbowL:-22,headTilt:-6,mOpen:15,mWidth:12,bob:-3+.6*q(e*8)}},celebrate(e){return{armL:150,armR:-150,elbowL:10,elbowR:-10,headTilt:2*q(e*4),bob:-6*Math.abs(q(e*4))}},cry(e){return{armR:-104,armL:104,elbowR:-58,elbowL:58,headTilt:12+2*q(e*5),mCurve:-8,bob:1.4*q(e*3)}},whisper(e){return{armR:-98,elbowR:-54,headTilt:6,mOpen:3+1.5*q(e*8),mWidth:12,bob:.6*q(e*1.5)}},talkGesture(e,t={}){return{armR:-14+10*q(e*4.6),elbowR:-16,armL:12+8*q(e*4.6+1),headTilt:1.6*q(e*2.2)+(t.aimDX||0)*4,bob:1.1*q(e*1.5)}},carryBox(e){return{armL:66,armR:-66,elbowL:-40,elbowR:40,headTilt:2,bob:1+.8*q(e*1.4)}},type(e){return{armR:-30,armL:30,elbowR:22,elbowL:-22,headTilt:7,bob:.5*q(e*6)}},drink(e){return{armR:-120,elbowR:-72,headTilt:-5,armL:8,bob:.6*q(e*1.3)}},sleep(e){return{headTilt:32,bob:1.4*q(e*.8),armR:-4,armL:4}},march(e,t={}){let n=e*(t.speed||1)%1*2*RO;return{legR:-24*q(n),legL:-24*q(n+RO),kneeR:40*LO(0,q(n+2)),kneeL:40*LO(0,q(n+RO+2)),armR:-10+16*q(n+RO),armL:10+16*q(n),elbowR:-24,elbowL:24,bob:-2-3*(.5-.5*IO(2*n)),headTilt:0}},flee(e,t={}){return{...BO.run(e,t),headTilt:-18+3*q(e*6),armR:-30+40*q(e*8),armL:30+40*q(e*8+RO),mOpen:6}},salute(e){return{armR:-150,elbowR:-78,headTilt:-2,armL:6,bob:.5*q(e*1.2)}},aim(e,t={}){return{armR:-92-zO((t.aimDY||0)*16,-12,16),elbowR:4,armL:6,headTilt:zO((t.aimDX||0)*6,-8,8),bob:.5*q(e*1.3)}},duck(e){return{bob:30,kneeR:60,kneeL:60,legR:-18,legL:-18,headTilt:14,armR:-30,armL:30,elbowR:30,elbowL:-30}},cheer(e){return{armL:160,armR:-160,elbowL:8,elbowR:-8,headTilt:3*q(e*5),bob:-7*Math.abs(q(e*5)),mOpen:10,mWidth:14}},tablePoint(e,t={}){return{armR:-50-zO((t.aimDY||0)*20,-14,18),elbowR:40,headTilt:zO(10+(t.aimDX||0)*6,2,18),armL:8,bob:.6*q(e*1.2)}},standGuard(e){return{headTilt:.6*q(e*.8),bob:.5*q(e*1),armR:-4,armL:4,elbowR:8,elbowL:-8,legR:-6,legL:6}},sneak(e,t={}){let n=e*(t.speed||.7)%1*2*RO;return{legR:-16*q(n),legL:-16*q(n+RO),kneeR:44+10*LO(0,q(n)),kneeL:44+10*LO(0,q(n+RO)),bob:22,headTilt:6,armR:-24,armL:24,elbowR:30,elbowL:-30}},jump(e){let t=e%1*2*RO,n=LO(0,q(t));return{bob:30-n*70,legR:-20+n*40,legL:-20+n*40,kneeR:40-n*30,kneeL:40-n*30,armR:-20-n*120,armL:20+n*120,headTilt:-2}},climb(e){let t=e*3;return{armR:-150+20*q(t),armL:-150+20*q(t+RO),elbowR:-20,elbowL:-20,legR:-30+20*q(t+RO),legL:-30+20*q(t),kneeR:40,kneeL:40,bob:-2+3*q(t*2),headTilt:-4}},nod(e){let t=q(e*4);return{headTilt:1.5*q(e*1.1),bob:1+3*LO(0,t),armR:-8,armL:8}},headShake(e){return{headTilt:12*q(e*5),bob:.6*q(e*1.3),armR:-8,armL:8}},facepalm(e){return{armR:-128,elbowR:-96,headTilt:16,armL:6,bob:.6*q(e*1.1)}},thumbsUp(e){return{armR:-70,elbowR:44,headTilt:-3,armL:8,bob:.8*q(e*1.4)}},clap(e){let t=24*(.5+.5*q(e*9));return{armR:-40-t,armL:40+t,elbowR:40,elbowL:-40,headTilt:2*q(e*2),bob:1+.8*q(e*4.5)}},beckon(e,t={}){return{armR:-60+12*q(e*5),elbowR:30+20*q(e*5),headTilt:zO(2+(t.aimDX||0)*5,-8,8),armL:8,bob:.8*q(e*1.4)}},presentPalm(e,t={}){return{armR:-58-zO((t.aimDY||0)*14,-10,14),elbowR:24,headTilt:zO((t.aimDX||0)*6,-8,8),armL:8,bob:.6*q(e*1.3)}},laugh(e){return{headTilt:-12+4*q(e*9),bob:2+3*LO(0,q(e*7)),armR:-40,armL:40,elbowR:30,elbowL:-30,mOpen:12,mWidth:18,mCurve:8}},angryStomp(e){let t=e%1*2*RO,n=LO(0,q(t));return{legR:-10-n*20,kneeR:20+n*40,legL:4,bob:6-n*8,headTilt:-8,armR:-30+10*q(e*6),armL:30-10*q(e*6),elbowR:40,elbowL:-40,mOpen:6}},exhausted(e){return{headTilt:20,bob:8+3*q(e*1.4),armR:-18,armL:18,elbowR:8,elbowL:-8,legR:-4,legL:4,mOpen:3+2*q(e*1.4)}},proud(e){return{armR:-44,armL:44,elbowR:64,elbowL:-64,headTilt:-4,bob:.6*q(e*1.1),legR:-8,legL:8}},worry(e){let t=q(e*.8);return{headTilt:5*q(e*1.6),bob:1*q(e*1.4),armR:-70+4*q(e*3),armL:-70-4*q(e*3),elbowR:-40,elbowL:40,legR:-3*t,legL:3*t}},hug(e){return{armR:-74,armL:74,elbowR:64,elbowL:-64,headTilt:6,bob:1+.6*q(e*1.3),legR:-4,legL:4}},pushObject(e){let t=.5-.5*IO(e*3);return{armR:-70,armL:70,elbowR:12,elbowL:-12,headTilt:9,bob:2+2*t,legR:-18-4*t,legL:10}},pull(e){let t=q(e*3.4);return{armR:-46-6*t,armL:46+6*t,elbowR:72,elbowL:-72,headTilt:-7,bob:2+2*t,legR:-16,legL:8}},liftOverhead(e){return{armR:-172,armL:172,elbowR:-8,elbowL:8,headTilt:-6,bob:2+1.4*q(e*1.6),legR:-6,legL:6}},throw(e){let t=e%1*2*RO,n=IO(t);return{armR:-70-90*n,elbowR:-30-30*LO(0,-n),armL:20+14*n,headTilt:-4-4*n,bob:1+1.5*q(e*1.4),legR:-10-6*n,legL:8}},catch(e){let t=LO(0,q(e*2.4));return{armR:-58+6*t,armL:58-6*t,elbowR:52,elbowL:-52,headTilt:-4,bob:-2+4*t}},examine(e,t={}){return{armR:-110,elbowR:-68,headTilt:10+3*q(e*1.6)+(t.aimDX||0)*4,armL:14,elbowL:-10,bob:.5*q(e*1.3)}},write(e){return{armR:-34+3*q(e*8),elbowR:26,armL:22,elbowL:-12,headTilt:13,bob:.4*q(e*5)}},eat(e){let t=LO(0,q(e*3));return{armR:-96-26*t,elbowR:-60-10*t,headTilt:-3,armL:10,bob:.5*q(e*1.3),mOpen:3+6*t}},phoneTalk(e){return{armR:-142,elbowR:-98,headTilt:8,armL:8,bob:.5*q(e*1.3),mOpen:3+2*q(e*7),mWidth:10}},phoneScroll(e){return{armL:44,armR:-34+2*q(e*7),elbowL:-34,elbowR:42,headTilt:15,bob:.4*q(e*1.4)}},sweep(e){let t=q(e*2.2);return{armR:-66+22*t,armL:-38+22*t,elbowR:28,elbowL:22,headTilt:9,bob:1+.6*t,legR:-6,legL:6}},hammer(e){let t=e*2%1*2*RO,n=LO(0,q(t));return{armR:-56-84*n,elbowR:-38,headTilt:6-4*n,armL:10,bob:1+1.4*n,legR:-6,legL:6}},dig(e){let t=e*1.5%1*2*RO,n=LO(0,q(t));return{armR:-44-10*n,armL:30-10*n,elbowR:34,elbowL:-20,headTilt:12+8*n,bob:5+12*n,kneeR:24+16*n,kneeL:24+16*n,legR:-10,legL:6}},drive(e){return{bob:40,legR:-52,legL:-50,kneeR:72,kneeL:70,armR:-46,armL:46,elbowR:38,elbowL:-38,headTilt:2*q(e*1.1)}},read(e){return{armR:-66,armL:66,elbowR:46,elbowL:-46,headTilt:16,bob:.5*q(e*1.2)}},blockShield(e){return{armR:-28,armL:38,elbowR:52,elbowL:-74,headTilt:6,bob:6+.6*q(e*2),kneeR:26,kneeL:26,legR:-8,legL:8}},dodge(e){let t=q(e*3.2);return{headTilt:-16+6*t,bob:5,armR:-40+8*t,armL:40+8*t,elbowR:24,elbowL:-24,legR:-20,legL:12,kneeR:22}}},VO=Object.keys(BO),HO=[`point`,`look`,`talk`,`talkGesture`,`lookAround`,`aim`,`tablePoint`,`presentPalm`,`beckon`]}));function WO(){return{limbWidenX:1,limbWidenLeg:1,torsoScale:1,cover:{}}}function GO(e={}){let t=WO();return[Ek[e.outerwear],Ck[e.top],Ok[e.bottom],wk[e.sleeves]].filter(Boolean).forEach(e=>{let n=e.fit||{};t.limbWidenX=Math.max(t.limbWidenX,n.limbWidenX||1),t.limbWidenLeg=Math.max(t.limbWidenLeg,n.limbWidenLeg||1),t.torsoScale=Math.max(t.torsoScale,n.torsoScale||1)}),t}function KO(e,t,n=0){let r=104-e,i=134-n,a=226+n;return hk(`M${i} 100 Q${i-4} ${r} 180 ${r-6} Q${a+4} ${r} ${a} 100 L${a-6} ${t+100} Q180 ${t+108} ${i+6} ${t+100} Z`)}function qO(e={}){let t=e.h||34,n=e.b||-34,r=100-t*.5;return KO(t,n,e.wob||0)+hk(`M136 ${r} Q180 ${68-t*.3} 224 ${r} Q200 ${80-t*.3} 180 80 Q160 80 136 ${r} Z`,`hairSh`,` opacity=".3"`)}function JO(e={}){let t=e.up||20,n=52-t,r=46-t;return hk(`M130 104 Q126 ${n} 180 ${r} Q234 ${n} 230 104 Q222 ${80-t*.5} 200 76 Q188 66 174 70 Q152 74 140 86 Q133 94 130 104 Z`)+hk(`M130 104 Q126 ${54-t} 180 ${48-t} Q150 58 140 92 Q134 99 130 104 Z`,`hairSh`,` opacity=".28"`)}function YO(e={}){let t=e.s||1;return hk(`M132 104 Q130 54 180 50 Q230 54 228 104 Q220 82 196 78 Q${180-20*t} 64 ${160-6*t} 74 Q144 82 132 104 Z`)+hk(`M132 104 Q130 56 180 52 Q164 60 150 88 Q138 98 132 104 Z`,`hairSh`,` opacity=".26"`)}function XO(e={}){let t=e.len||210;return hk(`M126 108 Q124 50 180 46 Q236 50 234 108 L228 ${t} Q224 ${t+22} 210 ${t+26} L206 150 Q206 96 180 92 Q154 96 154 150 L150 ${t+26} Q136 ${t+22} 132 ${t} Z`)+hk(`M132 100 Q145 58 180 56 Q215 58 228 100 Q206 74 180 74 Q154 74 132 100 Z`,`hairSh`,` opacity=".3"`)}function ZO(e={}){let t=e.r||27,n=e.rows||2,r=``,i=[137,163,195,222],a=[85,61,61,85];return i.forEach((e,n)=>r+=gk(e,a[n],t)),n>1&&[132,154,205,228].forEach((e,n)=>r+=gk(e,[115,126,126,115][n],t-2)),r}function QO(e={}){let t=e.n||10,n=KO(30,-30);for(let e=0;e<t;e++){let r=e/t*Math.PI,i=180+Math.cos(r)*48,a=80-Math.sin(r)*26;n+=gk(i,a,7)}return n}function $O(e={}){let t=e.n||7,n=hk(`M134 102 Q140 78 180 74 Q220 78 226 102 Q206 88 180 86 Q154 88 134 102 Z`);for(let e=0;e<t;e++){let r=138+e*(80/(t-1));n+=hk(`M${r} 86 L${r-5} ${52+e%2*8} L${r+5} 54 Z`)}return n}function ek(){return hk(`M168 108 Q168 46 180 44 Q192 46 192 108 Z`)+hk(`M170 100 Q170 52 180 50 Q178 70 178 100 Z`,`hairSh`,` opacity=".3"`)}function tk(e={}){return KO(28,-30)+gk(180,46,e.r||16)}function nk(e={}){let t=e.side||1,n=e.len||170;return KO(30,-28)+hk(`M${180+t*40} 70 Q${180+t*70} 90 ${180+t*62} ${n} Q${180+t*44} ${n+10} ${180+t*40} ${n} Q${180+t*50} 120 ${180+t*30} 78 Z`)}function rk(e={}){return e.fringe?hk(`M136 100 Q140 84 180 82 Q220 84 224 100 Q206 92 180 92 Q154 92 136 100 Z`):``}function ik(){return hk(`M138 104 Q140 74 165 72 Q150 82 146 104 Z M222 104 Q220 74 195 72 Q210 82 214 104 Z`)}function ak(e={}){let t=e.n||6,n=KO(20,-22);for(let e=0;e<t;e++){let r=142+e*(76/(t-1)),i=180+(r-180)*.3;n+=hk(`M${r-2.5} 100 Q${r-2.5} 62 ${i-2.5} 54 L${i+2.5} 54 Q${r+2.5} 62 ${r+2.5} 100 Z`)}return n}function ok(e,t=`#59352b`){return`<g class="wardrobeHairArt" style="color:${t}">${(_k[e]||_k.crop).fn({})}</g>`}function sk(e,t){if(!Ek[e])return``;let n=sO(t,.8),r=sO(t,.72),i=[`jacket`,`blazer`,`cardigan`,`hoodieOpen`,`bomber`,`suitJacket`,`denimJacket`,`vestOuter`,`kimono`,`peacoat`].includes(e),a=`<path d="M124 192 Q108 210 116 258 Q120 310 136 346 Q180 360 224 346 Q240 310 244 258 Q252 210 236 192 Q208 172 180 170 Q152 172 124 192 Z" fill="${t}"/>`,o=i?`<path d="M180 172 L164 348 M180 172 L196 348" stroke="${r}" stroke-width="4" fill="none"/><path d="M180 172 L150 196 L164 348 M180 172 L210 196 L196 348" fill="${n}" opacity=".5"/>`:`<path d="M180 172 L180 348" stroke="${r}" stroke-width="2.5" fill="none"/>`,s=e===`hiVisVest`?`<rect x="150" y="238" width="60" height="14" fill="#fff" opacity=".75"/><rect x="150" y="262" width="60" height="14" fill="#fff" opacity=".75"/>`:e===`labCoat`?`<rect x="152" y="256" width="16" height="20" fill="#eef2f5"/>`:e===`apron`?`<path d="M158 200 L158 344 L202 344 L202 200 Q180 190 158 200 Z" fill="${n}"/>`:e===`cape`?`<path d="M126 190 Q112 300 130 360 L230 360 Q248 300 234 190 Q208 200 180 200 Q152 200 126 190 Z" fill="${n}" opacity=".9"/>`:``;return`<g data-role="wardrobeOuter">${e===`cape`?s:``}${a}${o}${e===`cape`?``:s}</g>`}function ck(e,t){let n=t,r=sO(n,.82),i=e===`skirtLong`||e===`dressBottom`||e===`palazzo`,a=i?470:400,o=i?26:14;return`<g data-role="wardrobeBottom"><path d="M150 330 Q180 322 210 330 L${210+o} ${a} Q180 ${a+14} ${150-o} ${a} Z" fill="${n}"/><path d="M150 330 Q180 322 210 330" fill="none" stroke="${r}" stroke-width="3"/></g>`}function lk(e,t=`#2a2f3a`){if(e===`barefoot`||!Ak[e])return``;let n=n=>{let r=e===`heels`?`<rect x="${n+12}" y="568" width="5" height="18" fill="${t}"/>`:``;return`${e===`boots`||e===`winterBoots`?`<rect x="${n-16}" y="530" width="32" height="34" rx="6" fill="${t}"/>`:``}<path d="M${n-20} 566Q${n-22} 556 ${n-12} 554L${n+18} 554Q${n+26} 556 ${n+26} 566Q${n+26} 574 ${n+14} 574L${n-18} 574Q${n-22} 572 ${n-20} 566Z" fill="${t}"/>${r}`};return`<g data-role="wardrobeFeet">${n(160)}${n(200)}</g>`}function uk(e,t=`#2a2018`){if(e===`none`||!Fk(e))return``;let n={stubble:`M145 131Q152 152 180 160Q208 152 215 131Q208 145 180 149Q152 145 145 131Z`,shortBeard:`M145 130Q150 160 180 170Q210 160 215 130Q208 152 180 156Q152 152 145 130Z`,fullBeard:`M143 126Q146 172 180 186Q214 172 217 126Q210 156 180 160Q150 156 143 126Z`,goatee:`M170 140Q180 168 190 140Q184 156 180 156Q176 156 170 140Z`,vanDyke:`M170 138Q180 164 190 138Q184 152 180 152ZM168 120Q180 126 192 120Q180 130 168 120Z`,mustache:`M164 122Q180 130 196 122Q188 118 180 120Q172 118 164 122Z`,handlebar:`M158 122Q180 132 202 122Q194 116 180 120Q166 116 158 122Q160 128 156 130Q162 126 158 122ZM202 122Q204 128 208 130Q202 126 202 122Z`,mutton:`M145 118Q142 150 158 164Q160 140 156 118ZM215 118Q218 150 202 164Q200 140 204 118Z`,soulPatch:`M176 138Q180 148 184 138Q180 144 176 138Z`,circleBeard:`M164 122Q180 130 196 122Q188 118 180 120Q172 118 164 122ZM170 138Q180 166 190 138Q184 154 180 154Q176 154 170 138Z`,chinStrap:`M146 118Q148 158 180 168Q212 158 214 118Q210 150 180 154Q150 150 146 118ZM160 130L200 130Q198 140 180 142Q162 140 160 130Z`,verstache:`M164 122Q180 130 196 122Q188 118 180 120Q172 118 164 122ZM176 138Q180 148 184 138Z`,longBeard:`M143 126Q146 190 180 210Q214 190 217 126Q210 156 180 160Q150 156 143 126Z`};return`<path data-role="wardrobeFacial" d="${n[e]||n.shortBeard}" fill="${t}"/>`}function dk(e){if(e===`none`||e===!1||!Lk(e))return``;let t=`#26313a`,n=e===`square`?e=>`<rect x="${e-13}" y="99" width="26" height="22" rx="4" fill="none" stroke="${t}" stroke-width="3"/>`:e===`catEye`?e=>`<path d="M${e-13} 116 Q${e-14} 100 ${e} 100 Q${e+14} 100 ${e+13} 116 Q${e} 122 ${e-13} 116 Z" fill="none" stroke="${t}" stroke-width="3"/>`:e===`sunglasses`?e=>`<circle cx="${e}" cy="110" r="13" fill="#26313a"/>`:n=>`<circle cx="${n}" cy="110" r="13" fill="${e===`rimless`?`rgba(180,200,220,.25)`:`none`}" stroke="${e===`rimless`?`none`:t}" stroke-width="3"/>`;return`<g data-role="wardrobeGlasses">${n(164)}${n(196)}<rect x="177" y="108" width="6" height="3" rx="1.5" fill="${t}"/></g>`}function fk(e,t=`#37455a`){if(e===`none`||!zk(e))return``;let n=sO(t,.8);return`<g data-role="wardrobeHat">${{cap:`<path d="M134 66 Q180 30 226 62 Q228 74 180 74 Q140 74 134 66 Z" fill="${t}"/><path d="M226 62 Q252 62 256 74 L226 76 Q224 68 226 62 Z" fill="${n}"/>`,beanie:`<path d="M132 72 Q132 34 180 32 Q228 34 228 72 Q180 82 132 72 Z" fill="${t}"/><rect x="130" y="66" width="100" height="12" rx="6" fill="${n}"/>`,fedora:`<ellipse cx="180" cy="72" rx="66" ry="12" fill="${n}"/><path d="M146 70 Q150 38 180 36 Q210 38 214 70 Z" fill="${t}"/><rect x="146" y="60" width="68" height="8" fill="${n}"/>`,topHat:`<ellipse cx="180" cy="66" rx="58" ry="10" fill="${n}"/><rect x="150" y="8" width="60" height="60" rx="4" fill="${t}"/><rect x="150" y="52" width="60" height="8" fill="${n}"/>`,hardHat:`<path d="M138 66 Q180 30 222 66 Q180 76 138 66 Z" fill="${t}"/><rect x="132" y="64" width="96" height="8" rx="4" fill="${t}"/><rect x="176" y="34" width="8" height="30" fill="${n}"/>`,crown:`<path d="M142 66 L146 40 L160 56 L180 34 L200 56 L214 40 L218 66 Z" fill="#f2b134"/><circle cx="180" cy="40" r="4" fill="#fff"/>`,helmet:`<path d="M130 76 Q130 32 180 30 Q230 32 230 76 Q180 86 130 76 Z" fill="${t}"/><rect x="176" y="30" width="8" height="46" fill="${n}"/>`,headband:`<rect x="132" y="60" width="96" height="12" rx="6" fill="${t}"/>`,cowboyHat:`<path d="M118 72 Q180 60 242 72 Q180 88 118 72 Z" fill="${t}"/><path d="M150 68 Q154 38 180 36 Q206 38 210 68 Z" fill="${t}"/><rect x="150" y="60" width="60" height="7" fill="${n}"/>`,wizardHat:`<path d="M180 4 L214 70 L146 70 Z" fill="${t}"/><ellipse cx="180" cy="70" rx="44" ry="8" fill="${n}"/><circle cx="180" cy="26" r="4" fill="#ffd54a"/>`,beret:`<ellipse cx="180" cy="52" rx="42" ry="22" fill="${t}"/><circle cx="200" cy="40" r="4" fill="${n}"/>`,visor:`<rect x="134" y="62" width="92" height="10" rx="5" fill="${t}"/><path d="M226 66 Q250 66 254 76 L226 78 Z" fill="${n}"/>`,bandana:`<path d="M132 66 Q180 52 228 66 Q228 74 180 78 Q140 74 132 66 Z" fill="${t}"/><path d="M226 68 L246 84 L232 86 L222 72 Z" fill="${n}"/>`,partyHat:`<path d="M180 8 L200 66 L160 66 Z" fill="${t}"/><circle cx="180" cy="12" r="5" fill="#ff6b5e"/>`,santaHat:`<path d="M134 68 Q140 30 202 34 Q214 40 210 66 Z" fill="#c0392b"/><rect x="126" y="64" width="92" height="12" rx="6" fill="#fff"/><circle cx="210" cy="38" r="8" fill="#fff"/>`}[e]||``}</g>`}function pk(e={}){let t=``;return e.freckles&&(t+=`<g fill="#b5794f" opacity=".5">${[[152,116],[158,120],[148,122],[202,116],[208,120],[212,122]].map(([e,t])=>`<circle cx="${e}" cy="${t}" r="1.6"/>`).join(``)}</g>`),e.blush&&(t+=`<ellipse cx="150" cy="120" rx="10" ry="6" fill="#ff8a8a" opacity=".3"/><ellipse cx="210" cy="120" rx="10" ry="6" fill="#ff8a8a" opacity=".3"/>`),e.earrings&&(t+=`<circle cx="134" cy="122" r="3" fill="#f2b134"/><circle cx="226" cy="122" r="3" fill="#f2b134"/>`),e.wrinkles&&(t+=`<g stroke="#c9a882" stroke-width="1.2" fill="none" opacity=".5"><path d="M150 90 Q164 88 176 90"/><path d="M186 90 Q198 88 210 90"/><path d="M156 128 Q164 132 172 128"/><path d="M188 128 Q196 132 204 128"/></g>`),t?`<g data-role="wardrobeFaceExtras">${t}</g>`:``}var mk,hk,gk,_k,vk,yk,bk,xk,Sk,Ck,wk,Tk,Ek,Dk,Ok,kk,Ak,jk,Mk,Nk,Pk,Fk,Ik,Lk,Rk,zk,Bk,Vk,Hk,Uk,Wk,Gk,Kk,qk=o((()=>{pO(),mk={armU:20,armL:17,legU:26,legL:22},hk=(e,t=`hair`,n=``)=>`<path class="${t}" d="${e}"${n}/>`,gk=(e,t,n,r=`hair`)=>`<circle class="${r}" cx="${e}" cy="${t}" r="${n}"/>`,_k={},vk=(e,t,n)=>t.forEach((t,r)=>{_k[t]={cat:e,fn:n(r)}}),vk(`short`,[`crop`,`buzz`,`caesar`,`ivyLeague`,`crewCut`,`taper`,`flatTop`,`hightop`,`shortAfro`,`pixie`,`frenchCrop`,`butch`,`burr`,`induction`,`shortBrush`,`lowFade`,`midFade`,`highFade`,`blowout`,`edgar`],e=>e===8?e=>ZO({r:20,rows:1}):e===6||e===7?e=>JO({up:8}):t=>qO({h:28+e%5*2,wob:e%3-1})),vk(`medium`,[`quiff`,`pompadour`,`sidePart`,`comboOver`,`sweptBack`,`curtains`,`waves`,`shag`,`bob`,`lob`,`fauxHawkMed`,`texturedCrop`,`messyMed`,`flowMed`,`middlePart`,`slickBack`,`wolfCut`,`mullet`,`featheredMed`,`layeredMed`],e=>e<=1?t=>JO({up:18+e*6}):e===8||e===9?e=>XO({len:160}):e<=4?t=>YO({s:e%2?1:-1}):e=>qO({h:38,b:6,wob:2})),vk(`long`,[`straightLong`,`ponytail`,`highPonytail`,`braid`,`doubleBraid`,`bun`,`topKnot`,`spaceBuns`,`longAfro`,`dreads`,`longLayers`,`sidePonytail`,`lowBun`,`halfUp`,`mermaid`,`hime`,`longWavy`,`longStraight`,`longCurly`,`longShag`],e=>e===1||e===2||e===11?t=>nk({len:175,side:e===11?1:.1}):e===5||e===6||e===12?e=>tk({}):e===8?e=>ZO({r:27,rows:2}):t=>XO({len:200+e%3*10})),vk(`textured`,[`curly`,`tightCurls`,`afro`,`afroTaper`,`coils`,`ringlets`,`wavyLong`,`kinky`,`twistOut`,`curlyFade`,`curlyBob`,`curlyShag`,`looseCurls`,`spiralCurls`,`bantuKnots`],e=>e===2||e===3?e=>ZO({r:27,rows:2}):e===4||e===8?e=>QO({n:10}):e=>ZO({r:22,rows:1})),vk(`styled`,[`mohawk`,`fauxHawk`,`undercut`,`manBun`,`cornrows`,`locs`,`spiky`,`emoFringe`,`bunched`,`hatHairShort`,`liberty`,`devilock`,`quiffPunk`,`razorPart`,`flattopHi`],e=>e===0||e===10||e===11||e===12?e=>ek():e===3?e=>tk({r:14}):e===4?e=>ak({n:6}):e===6||e===13||e===14?e=>$O({n:7}):e=>qO({h:30})),vk(`aged`,[`greySwept`,`greyBun`,`balding`,`saltPepper`,`wispy`,`recedingGrey`,`baldFringe`,`thinTop`,`combover`,`silverLong`],e=>e===1?e=>tk({}):e===2||e===7?e=>ik():e===6?e=>rk({fringe:!0}):e===9?e=>XO({len:180}):e=>YO({s:1})),_k.bald={cat:`aged`,fn:e=>rk({})},_k.widowsPeak={cat:`styled`,fn:e=>hk(`M136 104Q138 70 165 68L180 84L195 68Q222 70 224 104Q206 84 180 82Q154 84 136 104Z`)},_k.receding={cat:`aged`,fn:e=>ik()},yk=Object.keys(_k),bk=e=>Object.prototype.hasOwnProperty.call(_k,e),xk={tee:``,tank:e=>`<path d="M156 196L156 250M204 196L204 250" stroke="${sO(e,.8)}" stroke-width="3" fill="none" opacity=".5"/>`,poloShirt:e=>`<path d="M168 176L180 190L192 176" fill="none" stroke="${sO(e,.78)}" stroke-width="4"/><circle cx="180" cy="210" r="2.4" fill="${sO(e,.7)}"/><circle cx="180" cy="226" r="2.4" fill="${sO(e,.7)}"/>`,buttonUp:e=>`<path d="M180 176L180 340" stroke="${sO(e,.72)}" stroke-width="2.5"/>${[196,220,252,284,316].map(t=>`<circle cx="180" cy="${t}" r="2.2" fill="${sO(e,.6)}"/>`).join(``)}`,hoodie:e=>`<path d="M150 182Q180 168 210 182Q206 200 180 206Q154 200 150 182Z" fill="${sO(e,.82)}"/><path d="M172 206L172 250M188 206L188 250" stroke="${sO(e,.7)}" stroke-width="3"/><rect x="150" y="300" width="60" height="26" rx="8" fill="${sO(e,.86)}"/>`,jersey:e=>`<text x="180" y="270" text-anchor="middle" font-size="34" font-weight="900" fill="${sO(e,.6)}">${`0`+(1+e.length%9)}</text>`,turtleneck:e=>`<rect x="164" y="158" width="32" height="22" rx="8" fill="${e}"/>`,vest:e=>`<path d="M150 196L150 330M210 196L210 330" stroke="${sO(e,.7)}" stroke-width="4" fill="none"/>`,henley:e=>`<path d="M180 178L180 220" stroke="${sO(e,.72)}" stroke-width="2.5"/><circle cx="180" cy="196" r="2" fill="${sO(e,.6)}"/><circle cx="180" cy="212" r="2" fill="${sO(e,.6)}"/>`},Sk=[`tee`,`tank`,`poloShirt`,`buttonUp`,`blouse`,`sweater`,`turtleneck`,`hoodie`,`jersey`,`croptop`,`vest`,`dressTop`,`tunic`,`henley`,`flannel`,`stripedTee`,`graphicTee`,`longSleeveTee`,`raglan`,`workShirt`,`scrubTop`,`thermal`,`poncho`,`halterTop`,`wrapTop`],Ck={},Sk.forEach(e=>{let t=[`sweater`,`turtleneck`,`hoodie`,`longSleeveTee`,`workShirt`,`thermal`,`flannel`,`blouse`,`scrubTop`].includes(e);Ck[e]={id:e,slot:`top`,kind:`paint`,covers:[`arm`],longSleeve:t,capRx:10,detail:xk[e]||``,fit:{limbWidenX:t?1.12:1}}}),wk={short:{id:`short`,slot:`sleeves`,kind:`paint`,covers:[`arm`],longSleeve:!1,capRx:10},long:{id:`long`,slot:`sleeves`,kind:`paint`,covers:[`arm`],longSleeve:!0,capRx:8.5,fit:{limbWidenX:1.1}},rolled:{id:`rolled`,slot:`sleeves`,kind:`paint`,covers:[`arm`],longSleeve:!1,capRx:10},threeQuarter:{id:`threeQuarter`,slot:`sleeves`,kind:`paint`,covers:[`arm`],longSleeve:!0,capRx:8.5,fit:{limbWidenX:1.06}},sleeveless:{id:`sleeveless`,slot:`sleeves`,kind:`paint`,covers:[],capRx:10}},Tk=[`jacket`,`blazer`,`coat`,`trenchcoat`,`hoodieOpen`,`cardigan`,`puffer`,`bomber`,`apron`,`labCoat`,`hiVisVest`,`robe`,`cape`,`suitJacket`,`denimJacket`,`raincoat`,`parka`,`peacoat`,`windbreaker`,`fleece`,`vestOuter`,`poncho2`,`kimono`,`overalls`,`wetsuitTop`],Ek={},Tk.forEach(e=>{let t=[`coat`,`trenchcoat`,`puffer`,`parka`,`peacoat`,`robe`,`labCoat`,`raincoat`,`fleece`].includes(e),n=e===`puffer`||e===`parka`?1.5:t?1.34:1.18;Ek[e]={id:e,slot:`outerwear`,kind:`overlay`,covers:[`arm`],longSleeve:!0,capRx:12,fit:{limbWidenX:n,torsoScale:t?1.08:1.03,cover:{armU:mk.armU*n+2,armL:mk.armL*n+2}}}}),Dk=[`shorts`,`jeans`,`trousers`,`slacks`,`joggers`,`cargos`,`skirtShort`,`skirtLong`,`leggings`,`dressBottom`,`kilt`,`shortsAthletic`,`snowPants`,`chinos`,`sweatpants`,`capris`,`overallsBottom`,`palazzo`,`culottes`,`bikeShorts`],Ok={},Dk.forEach(e=>{let t=![`shorts`,`skirtShort`,`shortsAthletic`,`bikeShorts`,`capris`].includes(e),n=e===`snowPants`;Ok[e]={id:e,slot:`bottom`,kind:`paint`,covers:[`leg`],longLeg:t,capRx:11,skirt:e.startsWith(`skirt`)||e===`kilt`||e===`dressBottom`||e===`palazzo`,fit:{limbWidenLeg:n?1.4:t?1.06:1}}}),kk=[`sneakers`,`dressShoes`,`boots`,`heels`,`sandals`,`cleats`,`winterBoots`,`barefoot`,`loafers`,`hightops`],Ak={},kk.forEach(e=>Ak[e]={id:e,slot:`footwear`,kind:`overlay`}),jk=[`oval`,`round`,`square`,`heart`,`long`,`diamond`,`wide`,`narrow`,`soft`,`angular`,`chubby`,`gaunt`],Mk={oval:[1,1],round:[1.06,.96],square:[1.04,1],heart:[1.03,1],long:[.94,1.08],diamond:[.98,1.04],wide:[1.12,.96],narrow:[.9,1.02],soft:[1.05,1],angular:[.98,1.02],chubby:[1.1,.98],gaunt:[.9,1.05]},Nk=e=>jk.includes(e),Pk=[`none`,`stubble`,`shortBeard`,`fullBeard`,`goatee`,`vanDyke`,`mustache`,`handlebar`,`mutton`,`soulPatch`,`circleBeard`,`chinStrap`,`verstache`,`longBeard`],Fk=e=>Pk.includes(e),Ik=[`none`,`round`,`square`,`rimless`,`sunglasses`,`catEye`,`aviator`],Lk=e=>Ik.includes(e),Rk=[`none`,`cap`,`beanie`,`fedora`,`topHat`,`hardHat`,`crown`,`helmet`,`headband`,`cowboyHat`,`wizardHat`,`beret`,`visor`,`bandana`,`partyHat`,`santaHat`],zk=e=>Rk.includes(e),Bk=[`round`,`almond`,`narrow`,`wide`],Vk={round:[6.5,9],almond:[7,6],narrow:[7,4.5],wide:[8,9.5]},Hk=[`flat`,`arched`,`angled`],Uk={flat:0,arched:-4,angled:3},Wk={casual:{top:`tee`,sleeves:`short`,bottom:`jeans`,footwear:`sneakers`,outerwear:`none`},business:{top:`buttonUp`,sleeves:`long`,outerwear:`blazer`,bottom:`slacks`,footwear:`dressShoes`},uniformMilitary:{top:`workShirt`,sleeves:`long`,outerwear:`jacket`,bottom:`cargos`,footwear:`boots`},uniformPolice:{top:`buttonUp`,sleeves:`long`,outerwear:`vestOuter`,bottom:`trousers`,footwear:`boots`},doctor:{top:`scrubTop`,sleeves:`short`,outerwear:`labCoat`,bottom:`trousers`,footwear:`sneakers`},worker:{top:`workShirt`,sleeves:`long`,outerwear:`hiVisVest`,bottom:`cargos`,footwear:`boots`},chef:{top:`buttonUp`,sleeves:`long`,outerwear:`apron`,bottom:`trousers`,footwear:`sneakers`},athlete:{top:`jersey`,sleeves:`sleeveless`,bottom:`shortsAthletic`,footwear:`cleats`,outerwear:`none`},royal:{top:`dressTop`,sleeves:`long`,outerwear:`cape`,bottom:`dressBottom`,footwear:`dressShoes`},winter:{top:`sweater`,sleeves:`long`,outerwear:`puffer`,bottom:`snowPants`,footwear:`winterBoots`},ancient:{top:`tunic`,sleeves:`long`,outerwear:`robe`,bottom:`trousers`,footwear:`sandals`},spacesuit:{top:`thermal`,sleeves:`long`,outerwear:`parka`,bottom:`snowPants`,footwear:`boots`}},Gk=Object.keys(Wk),Kk={hair:yk,top:Object.keys(Ck),sleeves:Object.keys(wk),outerwear:[`none`,...Tk],bottom:Object.keys(Ok),footwear:kk,faceShape:jk,facialHair:Pk,glasses:Ik}}));function Jk(e,t){return typeof e==`string`&&e[0]===`@`?(oA[t]||oA.auto)[e.slice(1)]||oA.auto[e.slice(1)]||`#888888`:e}function Yk(e,t){let n={...e};return[`skin`,`hairColor`,`shirt`,`shorts`,`legs`].forEach(e=>{n[e]!=null&&(n[e]=Jk(n[e],t))}),n}function Xk(e={}){return{...sA,...e}}function Zk(e,t,n){e.querySelectorAll(`.`+t).forEach(e=>e.setAttribute(`fill`,n))}function Qk(e,t){let n=Xk(t),r=n.shorts||n.shirt,i=n.legs||n.shirt;e.querySelectorAll(`.hairStyle`).forEach(e=>e.setAttribute(`opacity`,e.dataset.style===n.hairStyle?`1`:`0`)),Zk(e,`hair`,n.hairColor),Zk(e,`hairSh`,sO(n.hairColor,.78)),Zk(e,`shirt`,n.shirt),Zk(e,`shirtSh`,sO(n.shirt,.78)),Zk(e,`shorts`,r),Zk(e,`shortsSh`,sO(r,.78)),Zk(e,`leg`,i),Zk(e,`legSh`,sO(i,.78)),Zk(e,`skin`,n.skin),Zk(e,`skinSh`,sO(n.skin,.88));let a=e.querySelector(`[data-role="glasses"]`);a&&a.setAttribute(`opacity`,n.glasses?`1`:`0`);let o=e.querySelector(`[data-role="beard"]`);o&&(o.setAttribute(`opacity`,n.beard?`1`:`0`),n.beard&&o.setAttribute(`fill`,sO(n.hairColor,.85)));let s=e.querySelector(`[data-role="collar"]`);if(s&&s.setAttribute(`opacity`,n.collar||n.build===`dave`?`1`:`0`),e.querySelector(`[data-role="hairProfShort"]`)){let t=[`bob`,`long`,`ponytail`,`curly`,`afro`].includes(n.hairStyle),r=e.querySelector(`[data-role="hairProfLong"]`);r&&r.setAttribute(`opacity`,t?`1`:`0`);let i=e.querySelector(`[data-role="hairPony"]`);i&&i.setAttribute(`opacity`,n.hairStyle===`ponytail`?`1`:`0`)}n.appearance&&nA(e,n)}function $k(e,t,n){let r=e.querySelector(`[data-role="${t}"]`);return r||(r=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),r.setAttribute(`data-role`,t),(e.querySelector(n)||e).appendChild(r)),r}function eA(e,t,n=`char`,r=`head`){let i=e.querySelector(`[data-role="${t}"]`);if(!i){i=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),i.setAttribute(`data-role`,t);let a=e.querySelector(`[data-role="${n}"]`),o=e.querySelector(`[data-role="${r}"]`);a&&o?a.insertBefore(i,o):a&&a.appendChild(i)}return i}function tA(e,t,n){[`armL`,`armR`].forEach(n=>{let r=e.querySelector(`[data-role="${n}"] > rect`);r&&r.setAttribute(`fill`,t)}),n&&[`armLf`,`armRf`].forEach(n=>{let r=e.querySelector(`[data-role="${n}"] > rect`);r&&r.setAttribute(`fill`,t)})}function nA(e,t){let n=t.appearance,r=t.hairColor;if(n.hair&&bk(n.hair)&&(e.querySelectorAll(`.hairStyle`).forEach(e=>e.setAttribute(`opacity`,`0`)),e.querySelector(`[data-role="hairRoot"]`))){let t=$k(e,`wardrobeHair`,`[data-role="hairRoot"]`);t.innerHTML=ok(n.hair,r),Zk(t,`hair`,r),Zk(t,`hairSh`,sO(r,.78))}if(n.faceShape&&Nk(n.faceShape)){let[t,r]=Mk[n.faceShape],i=e.querySelector(`[data-role="face"]`);i&&i.setAttribute(`transform`,`translate(180 104) scale(${t} ${r}) translate(-180 -104)`)}if(n.top&&Ck[n.top]){let r=n.topColor||t.shirt;Zk(e,`shirt`,r),Zk(e,`shirtSh`,sO(r,.78));let i=Ck[n.top].detail,a=$k(e,`wardrobeTop`,`[data-role="torsoWrap"]`);a.innerHTML=typeof i==`function`?i(r):i||``}if(n.sleeves&&wk[n.sleeves]&&wk[n.sleeves].longSleeve&&tA(e,n.topColor||t.shirt,!0),n.outerwear&&n.outerwear!==`none`&&Ek[n.outerwear]){let r=n.outerColor||sO(t.shirt,.7);tA(e,r,!0);let i=eA(e,`wardrobeOuterRoot`);i.innerHTML=sk(n.outerwear,r)}else{let t=e.querySelector(`[data-role="wardrobeOuterRoot"]`);t&&(t.innerHTML=``)}if(n.bottom&&Ok[n.bottom]){let r=n.bottomColor||t.shorts||t.shirt;Zk(e,`shorts`,r),Zk(e,`shortsSh`,sO(r,.78)),Ok[n.bottom].longLeg&&(Zk(e,`leg`,r),Zk(e,`legSh`,sO(r,.78)));let i=eA(e,`wardrobeBottomRoot`);i.innerHTML=Ok[n.bottom].skirt?ck(n.bottom,r):``}{let t=$k(e,`wardrobeFeetRoot`,`[data-role="char"]`);t.innerHTML=n.footwear?lk(n.footwear,n.footColor||`#2a2f3a`):``}if(n.facialHair&&Fk(n.facialHair)){let t=e.querySelector(`[data-role="beard"]`);t&&t.setAttribute(`opacity`,(n.facialHair,`0`));let i=eA(e,`wardrobeFacialRoot`,`faceFeatures`,`mouth`);i.innerHTML=uk(n.facialHair,sO(r,.85))}if(n.glasses&&Lk(n.glasses)){let t=e.querySelector(`[data-role="glasses"]`);t&&t.setAttribute(`opacity`,`0`);let r=$k(e,`wardrobeGlassesRoot`,`[data-role="faceFeatures"]`);r.innerHTML=dk(n.glasses)}{let t=$k(e,`wardrobeHatRoot`,`[data-role="head"]`);t.innerHTML=n.headwear&&zk(n.headwear)?fk(n.headwear,n.headwearColor||`#37455a`):``}{let t=eA(e,`wardrobeExtrasRoot`,`faceFeatures`,`mouth`);t.innerHTML=pk(n)}if(n.eyeShape||n.irisColor||n.eyeSpacing!=null||n.lashes){let[t,r]=Vk[n.eyeShape]||Vk.round,i=(n.eyeSpacing||0)*6;[[`eyeL`,164-i],[`eyeR`,196+i]].forEach(([i,a])=>{let o=e.querySelector(`[data-role="${i}"]`);o&&(o.setAttribute(`rx`,t),o.setAttribute(`ry`,r),o.setAttribute(`cx`,a),n.irisColor&&o.setAttribute(`fill`,n.irisColor))});let a=$k(e,`wardrobeLashRoot`,`[data-role="faceFeatures"]`);a.innerHTML=n.lashes?`<path d="M${158-i} ${104-r} Q${164-i} ${101-r} ${170-i} ${104-r}" stroke="#243038" stroke-width="1.4" fill="none"/><path d="M${190+i} ${104-r} Q${196+i} ${101-r} ${202+i} ${104-r}" stroke="#243038" stroke-width="1.4" fill="none"/>`:``}if(n.browShape||n.browThickness||n.browColor){let t=Uk[n.browShape]||0;[[`browL`,153,174],[`browR`,186,207]].forEach(([r,i,a])=>{let o=e.querySelector(`[data-role="${r}"]`);o&&(n.browThickness&&o.setAttribute(`stroke-width`,n.browThickness),n.browColor&&o.setAttribute(`stroke`,n.browColor),o.setAttribute(`d`,`M${i} 94 Q${(i+a)/2} ${89+t} ${a} 94`))})}}function rA(e,t,n={}){let r=Xk(e),i=aA[r.ageHint]||aA.adult,a=iA.includes(r.ageHint)?CO[r.ageHint]:null,o=a||CO[r.build]||CO.default,s=GO(r.appearance||{}),c={...o,armX:o.armX*s.limbWidenX,legX:o.legX*s.limbWidenLeg,torsoX:o.torsoX*s.torsoScale},l=a?1:i.headScale,u=a?o.scale||1:i.heightScale;return{profile:SO[r.body]||SO.regular,build:c,hairVol:r.hairVol,eyeMul:r.eye,browTilt:n.browTilt||0,headScale:l,heightScale:(r.heightScale||1)*u*(n.depthScale||1),limbScale:n.limbScale||1,rigX:t,facing:n.facing||`front`,squash:n.squash==null?1:n.squash,yShift:n.yShift||0,opacity:n.opacity==null?1:n.opacity}}var iA,aA,oA,sA,cA=o((()=>{pO(),jO(),qk(),iA=[`childYoung`,`child`,`teen`],aA={child:{heightScale:.72,headScale:1.14},adult:{heightScale:1,headScale:1},elder:{heightScale:.95,headScale:1.02}},Object.keys(aA),oA={auto:{primary:`#2BB3A3`,accent:`#FF6B5E`,warm:`#F2B134`,cool:`#5B6CE0`,ink:`#2E3440`,pale:`#F2C9A0`},sunset:{primary:`#E07A5F`,accent:`#F2CC8F`,warm:`#F4A261`,cool:`#81B29A`,ink:`#3D405B`,pale:`#F4EBDD`},ocean:{primary:`#2b6cb0`,accent:`#38b2ac`,warm:`#ecc94b`,cool:`#4299e1`,ink:`#1a365d`,pale:`#bee3f8`}},sA={skin:`#F2C9A0`,hairStyle:`bob`,hairColor:`#59352B`,hairVol:1,shirt:`#2BB3A3`,shorts:null,legs:null,body:`regular`,build:`default`,eye:1,glasses:!1,beard:!1,collar:!1,heightScale:1}}));function lA(e,t,n=fA){let r=pA[e]||pA.central;return{x:r.x*t,y:r.y*n,tint:r.tint}}function uA(e=7){return[{d:0,draw:(e,t,n)=>{let r=e.createLinearGradient(0,0,0,n);r.addColorStop(0,`#123a52`),r.addColorStop(1,`#0c2536`),e.fillStyle=r,e.fillRect(-500,-500,t+1e3,n+1e3)}},{d:0,draw:(e,t,n)=>{e.strokeStyle=`rgba(255,255,255,.05)`,e.lineWidth=1;for(let r=0;r<=t;r+=t/12)e.beginPath(),e.moveTo(r,0),e.lineTo(r,n),e.stroke();for(let r=0;r<=n;r+=n/8)e.beginPath(),e.moveTo(0,r),e.lineTo(t,r),e.stroke()}},{d:0,draw:(t,n,r)=>{let i=oO(`map`+e);mA.forEach(e=>{let a=pA[e],o=a.x*n,s=a.y*r,c=a.r*n;t.save(),t.fillStyle=a.tint,t.globalAlpha=.94,t.beginPath();for(let e=0;e<=Math.PI*2+.01;e+=Math.PI/7){let n=c*(.8+i()*.4),r=o+Math.cos(e)*n,a=s+Math.sin(e)*n*.82;e===0?t.moveTo(r,a):t.lineTo(r,a)}t.closePath(),t.fill(),t.strokeStyle=`rgba(0,0,0,.12)`,t.lineWidth=2,t.stroke(),t.restore()})}}]}function dA(e=7){return[{d:.1,draw:(e,t,n)=>{e.fillStyle=`#1b2230`,e.fillRect(-500,-500,t+1e3,n+1e3)}},{d:.18,draw:(e,t,n)=>{let r=e.createRadialGradient(t/2,n*.28,20,t/2,n*.28,n*.85);r.addColorStop(0,`rgba(150,180,220,.20)`),r.addColorStop(1,`rgba(150,180,220,0)`),e.fillStyle=r,e.fillRect(0,0,t,n)}},{d:.4,draw:(t,n,r,i,a)=>{t.save(),t.fillStyle=`#2a3446`,t.beginPath(),t.moveTo(n*.26,i-30*a),t.lineTo(n*.74,i-30*a),t.lineTo(n*.92,i+130*a),t.lineTo(n*.08,i+130*a),t.closePath(),t.fill(),t.fillStyle=`#39496a`,t.beginPath(),t.moveTo(n*.3,i-22*a),t.lineTo(n*.7,i-22*a),t.lineTo(n*.84,i+96*a),t.lineTo(n*.16,i+96*a),t.closePath(),t.fill();let o=oO(`wr`+e);t.fillStyle=`#c9a36a`;for(let e=0;e<5;e++)t.beginPath(),t.arc(n*(.36+o()*.28),i+(6+o()*56)*a,6*a,0,7),t.fill();t.strokeStyle=`rgba(230,200,140,.5)`,t.lineWidth=2*a,t.beginPath(),t.moveTo(n*.4,i+20*a),t.lineTo(n*.6,i+60*a),t.stroke(),t.restore()}}]}var fA,pA,mA,hA=o((()=>{pO(),fA=640,pA={north:{x:.3,y:.3,r:.14,tint:`#8fae7a`},south:{x:.42,y:.68,r:.12,tint:`#c9a36a`},east:{x:.68,y:.4,r:.15,tint:`#7a9bb5`},west:{x:.15,y:.52,r:.11,tint:`#b58a7a`},central:{x:.5,y:.47,r:.11,tint:`#a7b98c`},isles:{x:.82,y:.66,r:.07,tint:`#8aa6b5`}},mA=Object.keys(pA)}));function gA(e){let t=e===`grid`?4:e===`hero`||e===`islands`?3:e===`pin`||e===`steps`||e===`orbit`?5:3,n=[{key:`bg`,default:!0},{key:`accent`,default:!0}];for(let e=0;e<t;e++)n.push({key:`panel`+e,default:!0});n.push({key:`fgBlob`,default:!0}),e===`pin`&&n.push({key:`strings`,default:!0},{key:`boardTexture`,default:!0}),e===`steps`&&n.push({key:`path`,default:!0}),e===`orbit`&&n.push({key:`orbitLines`,default:!0}),n.push({key:`focusRing`,default:!1},{key:`hud`,default:!1});let r=e===`steps`?[4200,1600]:e===`grid`?[2600,1900]:e===`orbit`?[2600,2e3]:e===`islands`?[3200,1900]:e===`hero`?[3e3,1700]:[800+t*760,1500];return{world:r,view:[1920,1080],kind:e,manifest:n,build(n,i){let[a,o]=r,s=oO(`board`+e+n),c=_A(e,t,a,o,s),l=[],u=[],d=[],f=`pmbg_`+e,p=`<defs><linearGradient id="${f}" x1="0" x2="1" y1="0" y2="1"><stop offset="0" stop-color="${AA[e][0]}"/><stop offset="1" stop-color="${AA[e][1]}"/></linearGradient></defs>`;i(`bg`)?l.push(p+`<rect x="${-a}" y="${-o}" width="${3*a}" height="${3*o}" fill="url(#${f})"/>`):l.push(p),i(`accent`)&&l.push(`<circle cx="${(a*.2).toFixed(0)}" cy="${(o*.26).toFixed(0)}" r="${(o*.22).toFixed(0)}" fill="${AA[e][2]}" opacity=".5"/><circle cx="${(a*.82).toFixed(0)}" cy="${(o*.3).toFixed(0)}" r="${(o*.28).toFixed(0)}" fill="${AA[e][3]}" opacity=".45"/>`),e===`pin`&&i(`boardTexture`)&&l.push(xA(a,o)),e===`steps`&&i(`path`)&&u.push(vA(c)),e===`orbit`&&i(`orbitLines`)&&u.push(yA(c)),e===`pin`&&i(`strings`)&&u.push(bA(c));let m=[],h=[];return c.forEach((t,n)=>{if(!i(`panel`+n))return;let r=t.depth===.24?l:t.depth===1.28?d:u,a=e===`pin`?s()*6-3:0,o=OA(0,0,t.w,t.h)+DA(0,0,t.w,t.h,t.fill||`#fff`,t.op||.95)+(e===`pin`?`<circle cx="0" cy="${(-t.h/2+26).toFixed(0)}" r="12" fill="#c0392b"/>`:``);r.push(`<g transform="translate(${t.x.toFixed(0)} ${t.y.toFixed(0)}) rotate(${a.toFixed(1)})">${o}</g>`),m.push({id:`panel`+n,x:t.x,y:t.y,w:t.w,h:t.h,depth:t.depth}),h.push({id:`panel`+n,x:t.x,y:t.y,importance:t.importance||1})}),i(`fgBlob`)&&d.push(`<circle cx="${(a*.1).toFixed(0)}" cy="${(o*.88).toFixed(0)}" r="${(o*.12).toFixed(0)}" fill="#25155b" opacity=".3"/><circle cx="${(a*.94).toFixed(0)}" cy="${(o*.84).toFixed(0)}" r="${(o*.15).toFixed(0)}" fill="#25155b" opacity=".26"/>`),{planes:[{depth:.24,id:`bg`,svg:l.join(``)},{depth:1,id:`mid`,svg:u.join(``)},{depth:1.28,id:`fg`,svg:d.join(``)}],panels:m,subjects:h}}}}function _A(e,t,n,r,i){let a=n/2,o=r/2,s=[];if(e===`row`){let e=n/(t+.4),r=e*.72;for(let n=0;n<t;n++)s.push({x:e*(.7+n),y:o+(n%2?70:-70),w:r,h:560,depth:1})}else if(e===`grid`){let e=[n*.3,n*.7],t=[r*.32,r*.7];for(let n=0;n<4;n++)s.push({x:e[n%2],y:t[n<2?0:1],w:720,h:520,depth:1})}else if(e===`hero`)s.push({x:n*.36,y:o,w:1120,h:900,depth:1,importance:1.15}),s.push({x:n*.78,y:r*.34,w:560,h:440,depth:1}),s.push({x:n*.78,y:r*.7,w:560,h:440,depth:1});else if(e===`islands`)s.push({x:n*.22,y:r*.3,w:560,h:440,depth:.24,importance:.9}),s.push({x:n*.52,y:r*.56,w:760,h:580,depth:1,importance:1.1}),s.push({x:n*.82,y:r*.4,w:620,h:480,depth:1.28});else if(e===`pin`)for(let e=0;e<t;e++){let c=e/t*6.28;s.push({x:a+Math.cos(c)*n*.28+(i()-.5)*120,y:o+Math.sin(c)*r*.26+(i()-.5)*100,w:480,h:380,depth:1,fill:[`#fffaf0`,`#fef3e2`,`#eef7ff`][e%3]})}else if(e===`steps`)for(let e=0;e<t;e++){let i=e/(t-1);s.push({x:n*(.1+i*.8),y:o+Math.sin(i*Math.PI*1.6)*r*.26,w:560,h:460,depth:1})}else if(e===`orbit`){s.push({x:a,y:o,w:720,h:620,depth:1,importance:1.15,fill:`#fff`});for(let e=0;e<t-1;e++){let i=e/(t-1)*6.28-1.57;s.push({x:a+Math.cos(i)*n*.3,y:o+Math.sin(i)*r*.32,w:420,h:340,depth:1})}}return s}function vA(e){return e.length<2?``:`<path d="${e.map((e,t)=>(t?`L`:`M`)+e.x.toFixed(0)+` `+e.y.toFixed(0)).join(` `)}" fill="none" stroke="#8a7a5a" stroke-width="10" stroke-dasharray="4 26" stroke-linecap="round" opacity=".7"/>`}function yA(e){if(!e.length)return``;let t=e[0];return e.slice(1).map(e=>`<line x1="${t.x.toFixed(0)}" y1="${t.y.toFixed(0)}" x2="${e.x.toFixed(0)}" y2="${e.y.toFixed(0)}" stroke="#5b6ce0" stroke-width="5" stroke-dasharray="2 14" opacity=".55"/>`).join(``)}function bA(e){let t=``;for(let n=1;n<e.length;n++)t+=`<line x1="${e[n-1].x.toFixed(0)}" y1="${e[n-1].y.toFixed(0)}" x2="${e[n].x.toFixed(0)}" y2="${e[n].y.toFixed(0)}" stroke="#b04a3a" stroke-width="4" opacity=".6"/>`;return t}function xA(e,t){return`<rect x="0" y="0" width="${e}" height="${t}" fill="#c8a97a" opacity=".5"/>`}function SA(e,t={}){let n=kA[e];if(!n)throw Error(`unknown board "${e}"`);let r={};n.manifest.forEach(e=>r[e.key]=e.default);for(let n of Object.keys(t))if(!(n in r))throw Error(`unknown element "${n}" for board "${e}" (has: ${Object.keys(r).join(`, `)})`);return{...r,...t}}function CA(e){let t=kA[e];return t?t.manifest:[]}function wA(e,t=0,n={}){let r=kA[e];if(!r)throw Error(`unknown board "${e}"`);let i=SA(e,n),a=e=>i[e]!==!1,o=r.build(t,a);return{worldW:r.world[0],worldH:r.world[1],viewW:r.view[0],viewH:r.view[1],focusRing:a(`focusRing`),hud:a(`hud`),elements:i,...o}}function TA(e,t,n=0){let r=175+Math.sin(n*4)*12;return`<circle cx="${e.toFixed(1)}" cy="${t.toFixed(1)}" r="155" fill="none" stroke="#fff" stroke-width="18" opacity=".78"/><circle cx="${e.toFixed(1)}" cy="${t.toFixed(1)}" r="${r.toFixed(1)}" fill="none" stroke="#f5c43e" stroke-width="6" opacity=".8"/>`}var EA,DA,OA,kA,AA,jA,MA,NA=o((()=>{pO(),EA=44,DA=(e,t,n,r,i=`#fff`,a=.92)=>`<rect x="${(e-n/2).toFixed(0)}" y="${(t-r/2).toFixed(0)}" width="${n.toFixed(0)}" height="${r.toFixed(0)}" rx="${EA}" fill="${i}" opacity="${a}"/>`,OA=(e,t,n,r)=>`<ellipse cx="${e.toFixed(0)}" cy="${(t+r/2+8).toFixed(0)}" rx="${(n*.44).toFixed(0)}" ry="${Math.max(14,r*.05).toFixed(0)}" fill="#2b2140" opacity=".16"/>`,kA={conceptTriptych:{world:[3e3,1800],view:[1920,1080],manifest:[{key:`bgGradient`,default:!0},{key:`bgCircleA`,default:!0},{key:`bgCircleB`,default:!0},{key:`roseBand`,default:!0},{key:`panelA`,default:!0},{key:`panelB`,default:!0},{key:`panelC`,default:!0},{key:`panelShadows`,default:!0},{key:`swoosh`,default:!0},{key:`fgBlobA`,default:!0},{key:`fgBlobB`,default:!0},{key:`focusRing`,default:!1},{key:`hud`,default:!1}],build(e,t){let n=`<defs><linearGradient id="pmbg_ct" x1="0" x2="1"><stop offset="0" stop-color="#f7dca7"/><stop offset="1" stop-color="#d9c5ef"/></linearGradient></defs>`;t(`bgGradient`)&&(n+=`<rect x="-500" y="-300" width="4000" height="2400" fill="url(#pmbg_ct)"/>`),t(`bgCircleA`)&&(n+=`<circle cx="350" cy="320" r="200" fill="#fff5dc" opacity=".65"/>`),t(`bgCircleB`)&&(n+=`<circle cx="2630" cy="420" r="280" fill="#8eddf1" opacity=".55"/>`),t(`roseBand`)&&(n+=`<path d="M-200 1550 Q700 1050 1450 1420 T3200 1200 L3200 2100 H-200Z" fill="#d86d82" opacity=".28"/>`);let r=``;t(`panelA`)&&(r+=`<rect x="120" y="260" width="630" height="520" rx="44" fill="#fff" opacity=".9"/>`),t(`panelB`)&&(r+=`<rect x="1840" y="290" width="720" height="560" rx="44" fill="#fff" opacity=".9"/>`),t(`panelC`)&&(r+=`<rect x="920" y="910" width="730" height="520" rx="44" fill="#fff" opacity=".92"/>`),t(`panelShadows`)&&(r+=`<ellipse cx="480" cy="710" rx="120" ry="30" fill="#2b2140" opacity=".16"/><ellipse cx="2200" cy="790" rx="160" ry="35" fill="#2b2140" opacity=".16"/><ellipse cx="1280" cy="1400" rx="220" ry="45" fill="#2b2140" opacity=".16"/>`);let i=``;return t(`swoosh`)&&(i+=`<path d="M-400 1750 Q350 1180 860 1600 T2050 1510 T3400 1310 L3400 2200 H-400Z" fill="#54379e" opacity=".72"/>`),t(`fgBlobA`)&&(i+=`<circle cx="220" cy="1440" r="150" fill="#25155b" opacity=".35"/>`),t(`fgBlobB`)&&(i+=`<circle cx="2900" cy="1360" r="220" fill="#25155b" opacity=".28"/>`),{planes:[{depth:.24,id:`bg`,svg:n},{depth:1,id:`mid`,svg:r},{depth:1.28,id:`fg`,svg:i}],panels:[{id:`panelA`,x:480,y:500,w:630,h:520},{id:`panelB`,x:2200,y:540,w:720,h:560},{id:`panelC`,x:1280,y:1180,w:730,h:520}],subjects:[{id:`panelA`,x:480,y:500,importance:1.05},{id:`panelB`,x:2200,y:540,importance:1.08},{id:`panelC`,x:1280,y:1180,importance:1.1}]}}},panelRow:gA(`row`),panelGrid:gA(`grid`),heroPanelSide:gA(`hero`),floatingIslands:gA(`islands`),pinboard:gA(`pin`),stepsPath:gA(`steps`),orbitBoard:gA(`orbit`)},AA={row:[`#f7dca7`,`#d9c5ef`,`#fff5dc`,`#8eddf1`],grid:[`#e8f0e6`,`#cfe0f0`,`#fff2d6`,`#bfe3d8`],hero:[`#fbe3cf`,`#e6d2f0`,`#ffe6c2`,`#c9d8f2`],islands:[`#dfeafc`,`#f3e2ef`,`#cfe9ff`,`#ffd9ec`],pin:[`#e8d9bf`,`#d3c0a3`,`#fff3d6`,`#d9c19a`],steps:[`#e9f2df`,`#d4e8f0`,`#fff0cf`,`#c7e6d6`],orbit:[`#1b1740`,`#2b2160`,`#5b6ce0`,`#8eddf1`]},jA=Object.keys(kA),MA=e=>Object.prototype.hasOwnProperty.call(kA,e)}));function PA(e){return function(t=7){let n=XA[e]||XA.day,r=e+t;return[J(0,(e,t,r)=>{let i=e.createLinearGradient(0,0,0,r);i.addColorStop(0,n.skyTop),i.addColorStop(1,n.skyBot),e.fillStyle=i,e.fillRect(-500,-500,t+1e3,r+1e3)}),$A(.14,`dfar`+r,n.far,90,150),$A(.3,`dmid`+r,n.mid,80,90),KA(n.ground),$A(.66,`dnear`+r,n.near,70,40),ej(-1,n),ej(1,n)]}}function FA(e,t){return function(n=7,r=`day`){let i=XA[r]||XA.day,a=e+r+n,o=(mj[t]||{}).bias||0;if(e===`room`)return[GA(i.skyBot),J(.2,(e,t,n,r)=>{e.fillStyle=i.mid,e.fillRect(-500,-500,t+1e3,r+500)}),J(.28,(e,t,n)=>{e.fillStyle=i.far,e.fillRect(t*.34,n*.15,t*.32,n*.32),e.fillStyle=i.skyTop,e.fillRect(t*.36,n*.17,t*.28,n*.28)}),KA(i.ground),J(.66,(e,t,n,r,a)=>{e.fillStyle=i.near,e.fillRect(-500,r-14*a,t+1e3,14*a)}),...hj(t,i)];let s=cj[e]||cj.field;return[nj(i),lj(s[0],.14,`far`+a,{col:i.far,bias:o}),lj(s[1],.3,`mid`+a,{col:i.mid,bias:o}),KA(i.ground),lj(s[2],.66,`near`+a,{col:i.near,bias:o}),...hj(t,i)]}}function IA(e,t){let n=Fj[e]||Fj[`center.c`];return{x:n.x*t,y:n.y,z:n.z==null?.5:n.z}}function LA(e){let t={};return e.map((e,n)=>{let r=zj(e.d);return t[r]=(t[r]||0)+1,{key:`l`+n,default:!0,label:r+(t[r]>1?` `+t[r]:``)}})}function RA(e){return MA(e)?CA(e):LA((UA[e]||UA.plain)(7,`day`))}function zA(e,t={}){let n={};RA(e).forEach(e=>n[e.key]=e.default);for(let r of Object.keys(t))if(!(r in n))throw Error(`unknown element "${r}" for setup "${e}" (has: ${Object.keys(n).join(`, `)})`);return{...n,...t}}function BA(e,t=7,n=`2.5d`,r=`day`,i={}){let a=(UA[e]||UA.plain)(t,r),o=zA(Rj(e)?e:`plain`,i);return{name:Rj(e)?e:`plain`,mode:n,seed:t,palette:r,slots:Nj[e]||Ij,layers:a,elements:o}}function VA(e,t,n,r,i,a={scale:0,pan:0},o=0){let s=n/HA;t&&t.layers.length&&t.layers.forEach((c,l)=>{if(t.elements&&t.elements[`l`+l]===!1)return;e.save();let u=1+a.scale*c.d,d=a.pan*c.d*s;e.translate(n/2,i),e.scale(u,u),e.translate(-n/2,-i),e.translate(d,0),c.draw(e,n,r,i,s,o),e.restore()})}var HA,UA,J,WA,GA,KA,qA,JA,YA,XA,ZA,QA,$A,ej,tj,nj,rj,ij,aj,oj,sj,cj,lj,uj,dj,fj,pj,mj,hj,gj,_j,vj,yj,bj,xj,Sj,Cj,wj,Tj,Ej,Dj,Oj,kj,Aj,jj,Mj,Nj,Pj,Fj,Ij,Lj,Rj,zj,Bj=o((()=>{pO(),hA(),NA(),HA=960,UA={plain(){return[]},skyDay(e){let t=oO(`skyDay`+e),n=[];for(let e=0;e<6;e++)n.push({x:t()*HA,y:60+t()*200,s:.7+t()*.9});return[{d:0,draw:(e,t,n)=>{let r=e.createLinearGradient(0,0,0,n);r.addColorStop(0,`#3d8fd6`),r.addColorStop(.6,`#8fc4ec`),r.addColorStop(1,`#dceffa`),e.fillStyle=r,e.fillRect(-500,-500,t+1e3,n+1e3),e.fillStyle=`rgba(255,246,214,0.95)`,e.beginPath(),e.arc(t*.8,n*.22,44,0,7),e.fill()}},{d:.18,draw:(e,t,r,i,a)=>{e.fillStyle=`rgba(255,255,255,0.9)`,n.forEach(t=>{let n=t.x*a,i=t.y/540*r,o=26*t.s*a;e.beginPath(),e.arc(n,i,o,0,7),e.arc(n+o,i+4*a,o*.8,0,7),e.arc(n-o,i+4*a,o*.8,0,7),e.arc(n+o*.4,i-o*.6,o*.7,0,7),e.fill()})}}]},skyNight(e){let t=oO(`skyNight`+e),n=[];for(let e=0;e<90;e++)n.push({x:t()*HA,y:t()*480,r:.6+t()*1.8});return[{d:0,draw:(e,t,n)=>{let r=e.createLinearGradient(0,0,0,n);r.addColorStop(0,`#0b1430`),r.addColorStop(1,`#26325c`),e.fillStyle=r,e.fillRect(-500,-500,t+1e3,n+1e3),e.fillStyle=`rgba(240,240,220,0.9)`,e.beginPath(),e.arc(t*.24,n*.2,30,0,7),e.fill()}},{d:.12,draw:(e,t,r,i,a)=>{e.fillStyle=`#fdfbe8`,n.forEach(t=>{e.globalAlpha=.5+t.r%1*.5,e.beginPath(),e.arc(t.x*a,t.y/540*r,t.r*a,0,7),e.fill()}),e.globalAlpha=1}}]},city(e){let t=oO(`city`+e),n=[],r=[],i=[],a=-60;for(;a<1020;){let e=26+t()*30,r=80+t()*150;n.push({x:a,w:e,h:r}),a+=e+10}for(a=-80;a<1040;){let e=60+t()*70,n=120+t()*180;r.push({x:a,w:e,h:n}),a+=e+16}for(a=-100;a<1060;){let e=90+t()*80,n=90+t()*120;i.push({x:a,w:e,h:n}),a+=e+70}return[{d:0,draw:(e,t,n)=>{let r=e.createLinearGradient(0,0,0,n);r.addColorStop(0,`#bfe3f2`),r.addColorStop(1,`#eaf6fb`),e.fillStyle=r,e.fillRect(-500,-500,t+1e3,n+1e3),e.fillStyle=`rgba(255,255,255,0.55)`,e.beginPath(),e.arc(t*.78,n*.2,46,0,7),e.fill()}},{d:.15,draw:(e,t,r,i,a)=>{e.fillStyle=`#cdd7e6`,n.forEach(t=>e.fillRect(t.x*a,i-t.h*a,t.w*a,t.h*a+260))}},{d:.34,draw:(e,t,n,i,a)=>{r.forEach(t=>{e.fillStyle=`#7d8aa0`,e.fillRect(t.x*a,i-t.h*a,t.w*a,t.h*a),e.fillStyle=`rgba(255,235,170,0.9)`;let n=Math.floor(t.h/22);for(let r=0;r<3;r++)for(let o=0;o<n-1;o++)(r*7+o*13+(t.x|0))%3!=0&&e.fillRect((t.x+8+r*((t.w-16)/3))*a,i-(t.h-14-o*22)*a,((t.w-16)/3-7)*a,10*a)})}},{d:.46,draw:(e,t,n,r)=>{e.fillStyle=`#8e9aac`,e.fillRect(-500,r,t+1e3,n-r+500)}},{d:.78,draw:(e,t,n,r,a)=>{e.fillStyle=`#6a7689`,i.forEach(t=>e.fillRect(t.x*a,r-t.h*a,t.w*a,t.h*a))}}]},nature(e){let t=oO(`nature`+e),n=[],r=20;for(;r<HA;)n.push({x:r,h:70+t()*60}),r+=90+t()*70;return[{d:0,draw:(e,t,n)=>{let r=e.createLinearGradient(0,0,0,n);r.addColorStop(0,`#bfe6ef`),r.addColorStop(1,`#eaf8f3`),e.fillStyle=r,e.fillRect(-500,-500,t+1e3,n+1e3),e.fillStyle=`rgba(255,255,255,0.5)`,e.beginPath(),e.arc(t*.76,n*.22,42,0,7),e.fill()}},{d:.16,draw:(e,t,n,r,i)=>{e.fillStyle=`#bfe0a8`,e.beginPath(),e.moveTo(-500,r);for(let n=-500;n<=t+500;n+=36)e.lineTo(n,r-Math.abs(Math.sin(n*.004+1))*90*i-30*i);e.lineTo(t+500,r),e.closePath(),e.fill()}},{d:.34,draw:(e,t,n,r,i)=>{e.fillStyle=`#9fcf9a`,e.beginPath(),e.moveTo(-500,r);for(let n=-500;n<=t+500;n+=36)e.lineTo(n,r-Math.abs(Math.sin(n*.005+3))*60*i-10*i);e.lineTo(t+500,r),e.closePath(),e.fill()}},{d:.46,draw:(e,t,n,r)=>{e.fillStyle=`#7cae5a`,e.fillRect(-500,r,t+1e3,n-r+500)}},{d:.7,draw:(e,t,r,i,a)=>{n.forEach(t=>{let n=t.h;e.fillStyle=`#6b4a2e`,e.fillRect(t.x*a-3*a,i-n*.5*a,6*a,n*.5*a),e.fillStyle=`#3f8f63`,e.beginPath(),e.arc(t.x*a,i-n*.5*a,n*.42*a,0,7),e.fill()})}}]},interior(){return[{d:.1,draw:(e,t,n,r,i)=>{e.fillStyle=`#dcd2c2`,e.fillRect(-500,-500,t+1e3,r+500),e.fillStyle=`#cfc3b0`,e.fillRect(-500,r-30*i,t+1e3,30*i)}},{d:.3,draw:(e,t,n,r,i)=>{for(let r=0;r<3;r++){let a=t*(.24+r*.26),o=n*.3,s=72*i,c=60*i;e.fillStyle=`#fff`,e.fillRect(a-s/2,o-c/2,s,c),e.fillStyle=[`#d98c6a`,`#7c9fd9`,`#7cc08a`][r],e.fillRect(a-s/2+6*i,o-c/2+6*i,s-12*i,c-12*i)}}},{d:.46,draw:(e,t,n,r,i)=>{e.fillStyle=`#b9966f`,e.fillRect(-500,r,t+1e3,n-r+500),e.fillStyle=`#a8865f`;for(let t=-5;t<20;t++)e.fillRect(t*90*i,r,3*i,n-r+300)}}]},abstract(e){let t=oO(`abstract`+e),n=[];for(let e=0;e<8;e++)n.push({x:t()*HA,y:t()*540,r:50+t()*120,d:.12+t()*.72,h:t()});let r=[{d:0,draw:(e,t,n)=>{let r=e.createLinearGradient(0,0,0,n);r.addColorStop(0,`#2a2350`),r.addColorStop(1,`#5b3f8f`),e.fillStyle=r,e.fillRect(-500,-500,t+1e3,n+1e3)}}];return n.sort((e,t)=>e.d-t.d).forEach(e=>r.push({d:e.d,draw:(t,n,r,i,a)=>{t.globalAlpha=.82,t.fillStyle=e.h<.5?`#7c5cff`:`#ff7ab0`,t.beginPath(),t.arc(e.x*a,e.y/540*r,e.r*a,0,7),t.fill(),t.globalAlpha=1}})),r}},J=(e,t)=>({d:e,draw:t}),WA=(e,t)=>J(0,(n,r,i)=>{let a=n.createLinearGradient(0,0,0,i);a.addColorStop(0,e),a.addColorStop(1,t),n.fillStyle=a,n.fillRect(-500,-500,r+1e3,i+1e3)}),GA=e=>J(0,(t,n,r)=>{t.fillStyle=e,t.fillRect(-500,-500,n+1e3,r+1e3)}),KA=(e,t=0)=>J(.46,(n,r,i,a)=>{n.fillStyle=e,n.fillRect(-500,a+t,r+1e3,i-a+500)}),qA=(e,t,n,r,i,a)=>J(e,(e,o,s,c,l)=>{let u=oO(t);e.fillStyle=n;for(let t=0;t<r;t++){let t=u()*HA,n=i[0]+u()*i[1],r=a[0]+u()*a[1];e.fillRect(t*l,c-r*l,n*l,r*l)}}),JA=(e,t,n,r)=>J(e,(e,i,a,o,s)=>{let c=oO(t),l=20;for(;l<HA;){let t=60+c()*70;e.fillStyle=n,e.fillRect(l*s-3*s,o-t*.5*s,6*s,t*.5*s),e.fillStyle=r,e.beginPath(),e.arc(l*s,o-t*.5*s,t*.42*s,0,7),e.fill(),l+=80+c()*70}}),YA=e=>J(.3,(t,n,r,i,a)=>{for(let i=0;i<3;i++){let o=n*(.22+i*.28),s=r*.28,c=66*a,l=54*a;t.fillStyle=`#fff`,t.fillRect(o-c/2,s-l/2,c,l),t.fillStyle=e[i%e.length],t.fillRect(o-c/2+6*a,s-l/2+6*a,c-12*a,l-12*a)}}),Object.assign(UA,{genericRoom(e){return UA.interior(e)},office(e){return[WA(`#dfe6ee`,`#eef2f6`),YA([`#7c9fd9`,`#3fae6b`]),J(.34,(e,t,n,r,i)=>{e.fillStyle=`#c9d2da`;for(let t=0;t<3;t++)e.fillRect((120+t*300)*i,r-70*i,200*i,70*i)}),KA(`#c9b79a`)]},classroom(){return[GA(`#e8ede2`),J(.28,(e,t,n)=>{e.fillStyle=`#3a6b52`,e.fillRect(t*.24,n*.16,t*.52,n*.34),e.strokeStyle=`#2c5240`,e.lineWidth=6,e.strokeRect(t*.24,n*.16,t*.52,n*.34)}),KA(`#c7b79a`)]},workshop(e){return[GA(`#d8d3c6`),qA(.3,`wk`+e,`#9a8b6f`,8,[30,40],[20,60]),KA(`#b09571`)]},kitchen(){return[GA(`#eef1eb`),J(.34,(e,t,n,r,i)=>{e.fillStyle=`#c7cdb9`,e.fillRect(-500,r-40*i,t+1e3,12*i)}),KA(`#cdbfa4`)]},stagePodium(){return[GA(`#242a34`),J(.2,(e,t,n)=>{let r=e.createRadialGradient(t/2,n*.3,20,t/2,n*.3,n*.7);r.addColorStop(0,`rgba(255,240,200,.35)`),r.addColorStop(1,`rgba(255,240,200,0)`),e.fillStyle=r,e.fillRect(0,0,t,n)}),KA(`#39414f`)]},corridor(){return[GA(`#dfe1e6`),J(.3,(e,t,n)=>{e.strokeStyle=`#c3c8d0`,e.lineWidth=3;for(let r=-3;r<=3;r++)e.beginPath(),e.moveTo(t/2+r*t*.16,0),e.lineTo(t/2+r*t*.04,n),e.stroke()}),KA(`#b8bcc6`)]},storeInterior(e){return[GA(`#e9e4da`),qA(.32,`st`+e,`#b79c74`,6,[70,20],[60,40]),KA(`#c3b393`)]},labGeneric(e){return[GA(`#eef3f5`),qA(.32,`lb`+e,`#cdd7dc`,5,[40,50],[30,60]),KA(`#d3dde0`)]},controlRoom(e){return[GA(`#1d2430`),J(.3,(t,n,r,i,a)=>{oO(`cr`+e);for(let e=0;e<8;e++)t.fillStyle=[`#2b6cb0`,`#2bb3a3`,`#c98a3a`][e%3],t.globalAlpha=.7,t.fillRect((60+e*110)*a,(120+e%2*40)*a,80*a,50*a),t.globalAlpha=1}),KA(`#2a323f`)]},street(e){return[WA(`#bfe3f2`,`#eaf6fb`),qA(.4,`str`+e,`#8e9aac`,10,[50,60],[90,150]),KA(`#7a8391`),J(.5,(e,t,n,r,i)=>{e.fillStyle=`#5c636e`,e.fillRect(-500,r,t+1e3,n),e.strokeStyle=`#e6c34a`,e.lineWidth=3*i,e.setLineDash([20*i,18*i]),e.beginPath(),e.moveTo(-500,r+(n-r)*.5),e.lineTo(t+500,r+(n-r)*.5),e.stroke(),e.setLineDash([])})]},park(){return[WA(`#bfe6ef`,`#eaf8f3`),KA(`#7cae5a`),JA(.6,`park`,`#6b4a2e`,`#3f8f63`),J(.5,(e,t,n,r)=>{e.fillStyle=`#cdbd8f`,e.beginPath(),e.moveTo(t*.3,n),e.lineTo(t*.46,r),e.lineTo(t*.54,r),e.lineTo(t*.7,n),e.fill()})]},forest(e){return[WA(`#cfe6d6`,`#eef7ef`),KA(`#5f8f4e`),JA(.4,`f1`+e,`#5a3e26`,`#357a4e`),JA(.7,`f2`+e,`#6b4a2e`,`#3f8f63`)]},mountain(e){return[WA(`#cfe0ef`,`#eef4f9`),J(.2,(t,n,r,i,a)=>{let o=oO(`mt`+e);t.fillStyle=`#9fb0c4`;for(let e=0;e<5;e++){let n=e*HA/4*a,r=(160+o()*120)*a;t.beginPath(),t.moveTo(n-140*a,i),t.lineTo(n,i-r),t.lineTo(n+140*a,i),t.fill()}}),KA(`#7f9e6f`)]},desertPlain(){return[WA(`#f4dcae`,`#f8eccf`),KA(`#e4c483`),J(.3,(e,t,n,r,i)=>{e.fillStyle=`#d9b46e`,e.beginPath(),e.moveTo(-500,r);for(let n=-500;n<=t+500;n+=40)e.lineTo(n,r-Math.abs(Math.sin(n*.003))*30*i);e.lineTo(t+500,r),e.fill()})]},coastBeach(){return[WA(`#bfe3f2`,`#e8f6fb`),J(.34,(e,t,n,r,i)=>{e.fillStyle=`#4aa3c4`,e.fillRect(-500,r-60*i,t+1e3,60*i)}),KA(`#ead9a6`)]},farmField(){return[WA(`#c7e6f0`,`#eef9f3`),KA(`#8bab4e`),J(.5,(e,t,n,r,i)=>{e.strokeStyle=`#79993f`,e.lineWidth=3*i;for(let n=0;n<6;n++)e.beginPath(),e.moveTo(-500,r+n*20*i),e.lineTo(t+500,r+n*20*i),e.stroke()})]},skylineWide(e){return[WA(`#bcd8ee`,`#eaf4fb`),qA(.2,`sk`+e,`#aebccd`,14,[30,40],[80,160]),qA(.42,`sk2`+e,`#8695a9`,9,[60,60],[60,120]),KA(`#79879a`)]},rooftop(e){return[WA(`#bfe3f2`,`#eaf6fb`),qA(.2,`rf`+e,`#9caabd`,10,[40,50],[60,120]),KA(`#8a8f98`),J(.5,(e,t,n,r,i)=>{e.fillStyle=`#6f747d`,e.fillRect(-500,r-16*i,t+1e3,16*i)})]},roadHighway(){return[WA(`#bfe3f2`,`#eaf6fb`),KA(`#5c636e`),J(.5,(e,t,n,r,i)=>{e.strokeStyle=`#eef2f4`,e.lineWidth=4*i,e.setLineDash([26*i,22*i]),[.35,.65].forEach(i=>{e.beginPath(),e.moveTo(-500,r+(n-r)*i),e.lineTo(t+500,r+(n-r)*i),e.stroke()}),e.setLineDash([])})]},oceanSurface(){return[WA(`#a9d6ec`,`#dff1fb`),J(.4,(e,t,n,r,i)=>{e.fillStyle=`#2f8fc0`,e.fillRect(-500,r-30*i,t+1e3,n),e.strokeStyle=`rgba(255,255,255,.5)`,e.lineWidth=2*i;for(let n=0;n<5;n++){e.beginPath(),e.moveTo(-500,r+n*26*i);for(let a=-500;a<t+500;a+=30)e.lineTo(a,r+n*26*i+Math.sin(a*.03+n)*4*i);e.stroke()}})]},underwater(e){return[WA(`#1f6f9e`,`#0c3f5f`),J(.3,(t,n,r,i,a)=>{let o=oO(`uw`+e);t.fillStyle=`rgba(255,255,255,.25)`;for(let e=0;e<30;e++)t.beginPath(),t.arc(o()*n,o()*r,(2+o()*6)*a,0,7),t.fill()}),KA(`#b79a5f`)]},skyClouds(){return UA.skyDay(3)},spacePlanet(e){return[WA(`#0a0f22`,`#161f3e`),J(.12,(t,n,r,i,a)=>{let o=oO(`sp`+e);t.fillStyle=`#fdfbe8`;for(let e=0;e<80;e++)t.fillRect(o()*n,o()*r,2,2)}),J(.2,(e,t,n,r,i)=>{e.fillStyle=`#c96a5e`,e.beginPath(),e.arc(t*.76,n*.3,60*i,0,7),e.fill(),e.fillStyle=`rgba(255,255,255,.12)`,e.beginPath(),e.arc(t*.72,n*.26,60*i,0,7),e.fill()})]},arcticIce(){return[WA(`#cfe6f2`,`#eef7fb`),KA(`#dfeef4`),J(.4,(e,t,n,r,i)=>{e.fillStyle=`#bcd7e4`;for(let t=0;t<4;t++){let n=(120+t*260)*i;e.beginPath(),e.moveTo(n-90*i,r),e.lineTo(n,r-70*i),e.lineTo(n+90*i,r),e.fill()}})]},studioPlain(){return[WA(`#eef3f4`,`#dbe8ea`)]},gradientAbstract(e){let t=oO(`ga`+e),n=Math.floor(t()*360);return[J(0,(e,t,r)=>{let i=e.createLinearGradient(0,0,t,r);i.addColorStop(0,`hsl(${n} 55% 62%)`),i.addColorStop(1,`hsl(${(n+60)%360} 55% 48%)`),e.fillStyle=i,e.fillRect(0,0,t,r)})]},gridBoard(){return[GA(`#f4f7f8`),J(.2,(e,t,n,r,i)=>{e.strokeStyle=`#dde5e9`,e.lineWidth=1.5;for(let r=0;r<t;r+=40*i)e.beginPath(),e.moveTo(r,0),e.lineTo(r,n),e.stroke();for(let r=0;r<n;r+=40*i)e.beginPath(),e.moveTo(0,r),e.lineTo(t,r),e.stroke()})]},mapStage(e){return[GA(`#dcece2`),J(.2,(t,n,r,i,a)=>{let o=oO(`mp`+e);t.fillStyle=`#b7d8c1`,t.beginPath(),t.moveTo(n*.2,r*.3);for(let e=0;e<10;e++)t.lineTo(n*(.2+o()*.6),r*(.2+o()*.6));t.closePath(),t.fill()})]},chartStage(){return[GA(`#f6f8f9`),J(.2,(e,t,n,r,i)=>{e.strokeStyle=`#d7dee3`,e.lineWidth=2,e.beginPath(),e.moveTo(t*.15,n*.2),e.lineTo(t*.15,n*.8),e.lineTo(t*.85,n*.8),e.stroke()})]},timelineBand(){return[GA(`#f4f7f8`),J(.3,(e,t,n,r,i)=>{e.fillStyle=`#e7edf1`,e.fillRect(0,n*.46,t,n*.08)})]},splitVersus(){return[J(0,(e,t,n)=>{e.fillStyle=`#dfeaf6`,e.fillRect(0,0,t/2,n),e.fillStyle=`#f6e3df`,e.fillRect(t/2,0,t/2,n),e.strokeStyle=`#c7d0d6`,e.lineWidth=3,e.beginPath(),e.moveTo(t/2,0),e.lineTo(t/2,n),e.stroke()})]},iconField(e){return[GA(`#f2f5f6`),J(.2,(t,n,r,i,a)=>{let o=oO(`if`+e);t.fillStyle=`#dbe4e8`;for(let e=0;e<24;e++)t.beginPath(),t.arc(o()*n,o()*r,10*a,0,7),t.fill()})]},blueprint(){return[GA(`#123a63`),J(.2,(e,t,n,r,i)=>{e.strokeStyle=`rgba(255,255,255,.22)`,e.lineWidth=1;for(let r=0;r<t;r+=34*i)e.beginPath(),e.moveTo(r,0),e.lineTo(r,n),e.stroke();for(let r=0;r<n;r+=34*i)e.beginPath(),e.moveTo(0,r),e.lineTo(t,r),e.stroke()})]},spotlightDark(){return[GA(`#171c24`),J(.1,(e,t,n,r)=>{let i=e.createRadialGradient(t/2,r-120,30,t/2,r-120,t*.6);i.addColorStop(0,`rgba(255,255,255,.16)`),i.addColorStop(1,`rgba(255,255,255,0)`),e.fillStyle=i,e.fillRect(0,0,t,n)}),KA(`#20262f`)]},crowdScene(e){return[WA(`#cfd8e2`,`#eaeff4`),KA(`#9aa2ad`),J(.6,(t,n,r,i,a)=>{let o=oO(`cw`+e);for(let e=0;e<26;e++){let e=o()*HA*a,n=(50+o()*30)*a;t.fillStyle=`hsl(${Math.floor(o()*360)} 30% 55%)`,t.fillRect(e,i-n,16*a,n),t.beginPath(),t.arc(e+8*a,i-n,9*a,0,7),t.fill()}})]},marketplace(e){return[WA(`#e9d9b0`,`#f4ead0`),KA(`#c9b184`),J(.5,(t,n,r,i,a)=>{oO(`mk`+e);for(let e=0;e<5;e++){let n=(80+e*200)*a;t.fillStyle=[`#c0563f`,`#3f7fc0`,`#3fae6b`,`#c9a13a`,`#8b5cf6`][e],t.fillRect(n,i-90*a,140*a,20*a),t.fillStyle=`#a9855c`,t.fillRect(n+6*a,i-70*a,6*a,70*a),t.fillRect(n+128*a,i-70*a,6*a,70*a)}})]},constructionSite(e){return[WA(`#cfe0ec`,`#eef4f9`),KA(`#b79a6a`),J(.4,(e,t,n,r,i)=>{e.strokeStyle=`#e0a52e`,e.lineWidth=6*i,e.strokeRect(t*.3,r-200*i,6*i,200*i),e.beginPath(),e.moveTo(t*.3,r-200*i),e.lineTo(t*.55,r-200*i),e.stroke()})]},harborDock(e){return[WA(`#bfe3f2`,`#eaf6fb`),J(.4,(e,t,n,r,i)=>{e.fillStyle=`#3f8fb5`,e.fillRect(-500,r-20*i,t+1e3,n)}),KA(`#8a6a45`,20),J(.3,(e,t,n,r,i)=>{e.strokeStyle=`#c9553f`,e.lineWidth=6*i,e.strokeRect(t*.6,r-150*i,6*i,150*i)})]},weatherStorm(e){return[WA(`#4a5361`,`#6a7484`),J(.2,(t,n,r,i,a)=>{let o=oO(`ws`+e);t.strokeStyle=`rgba(220,230,240,.4)`,t.lineWidth=2;for(let e=0;e<60;e++){let e=o()*n,i=o()*r;t.beginPath(),t.moveTo(e,i),t.lineTo(e-6*a,i+18*a),t.stroke()}}),KA(`#3c4450`)]}}),XA={day:{skyTop:`#7fb2e0`,skyBot:`#cfe6f5`,far:`#b8cdde`,mid:`#7f93a8`,ground:`#6d8196`,near:`#4f6172`,occluder:`#26323f`},goldenHour:{skyTop:`#f0a35a`,skyBot:`#f7d79a`,far:`#d8b58a`,mid:`#b5876a`,ground:`#8f6a4f`,near:`#5f4636`,occluder:`#2a1c14`},dusk:{skyTop:`#e98a5b`,skyBot:`#f4c78d`,far:`#caa088`,mid:`#9c6f6a`,ground:`#7a5b57`,near:`#513f4a`,occluder:`#241826`},night:{skyTop:`#0b1430`,skyBot:`#26325c`,far:`#33406a`,mid:`#26314f`,ground:`#1b2740`,near:`#141d33`,occluder:`#060a16`},dawn:{skyTop:`#b98db5`,skyBot:`#f3d0c9`,far:`#c9b3c4`,mid:`#9e8ba0`,ground:`#7d7085`,near:`#55495e`,occluder:`#221c2b`},overcast:{skyTop:`#b8bfc6`,skyBot:`#d8dde1`,far:`#b3bcc4`,mid:`#97a2ad`,ground:`#808b95`,near:`#5e6771`,occluder:`#333a42`},desert:{skyTop:`#e6c98a`,skyBot:`#f4ead0`,far:`#dcc59a`,mid:`#c9a56f`,ground:`#b98d5a`,near:`#9a6f45`,occluder:`#4a3520`},arctic:{skyTop:`#a9c9e0`,skyBot:`#eef7fb`,far:`#cddfe9`,mid:`#b6cdd8`,ground:`#cfe0e6`,near:`#93b0bd`,occluder:`#35505e`},underwater:{skyTop:`#1f6f8f`,skyBot:`#0d3f4f`,far:`#2f7f8a`,mid:`#266b70`,ground:`#1b4f52`,near:`#143a3a`,occluder:`#08201f`},space:{skyTop:`#05060f`,skyBot:`#10132a`,far:`#1e2340`,mid:`#191d38`,ground:`#12162c`,near:`#0c0f20`,occluder:`#04050c`},neonNight:{skyTop:`#14082a`,skyBot:`#2a1050`,far:`#7a3fb0`,mid:`#b03f8a`,ground:`#2a1a4a`,near:`#16102e`,occluder:`#080416`},sepiaPast:{skyTop:`#cdb488`,skyBot:`#e6d4ad`,far:`#c4ac82`,mid:`#a98d64`,ground:`#8a7150`,near:`#5f4c34`,occluder:`#2f2419`}},ZA=Object.keys(XA),QA={day:`light`,goldenHour:`light`,dusk:`light`,night:`dark`,dawn:`light`,overcast:`light`,desert:`light`,arctic:`light`,underwater:`dark`,space:`dark`,neonNight:`dark`,sepiaPast:`light`},$A=(e,t,n,r,i,a=0)=>J(e,(e,o,s,c,l)=>{let u=oO(t),d=[];for(let e=0;e<=16;e++)d.push((i+u()*r)*(1+a*.45*(e/8-1)));e.fillStyle=n,e.beginPath(),e.moveTo(-500,c);for(let t=0;t<=16;t++){let n=-200+t/16*(o+400);e.lineTo(n,c-d[t]*l)}e.lineTo(o+500,c),e.closePath(),e.fill()}),ej=(e,t)=>J(.9,(n,r,i,a,o,s=0)=>{let c=1+Math.sin(s*.55+(e<0?0:1.7))*.02,l=Math.sin(s*.12+e)*22*o,u=r*.24*c,d=e<0?-60+l:r-u+60+l;n.save(),n.globalAlpha=.97,n.fillStyle=t.occluder,n.beginPath(),n.moveTo(d,-60),n.lineTo(d+u,-60),n.lineTo(d+u-26*o,i*.42),n.lineTo(d+u+10*o,i*.64),n.lineTo(d+u-34*o,i+60),n.lineTo(d-60,i+60),n.closePath(),n.fill(),n.restore()}),tj={dioramaDay:PA(`day`),dioramaDusk:PA(`dusk`),dioramaNight:PA(`night`),dioramaDesert:PA(`desert`),dioramaArctic:PA(`arctic`)},Object.assign(UA,tj),Object.keys(tj),nj=e=>J(0,(t,n,r)=>{let i=t.createLinearGradient(0,0,0,r);i.addColorStop(0,e.skyTop),i.addColorStop(1,e.skyBot),t.fillStyle=i,t.fillRect(-500,-500,n+1e3,r+1e3)}),rj=(e,t,n,r,i,a=0)=>J(e,(e,o,s,c,l)=>{let u=oO(t);e.fillStyle=n,e.beginPath(),e.moveTo(-500,c);for(let t=0;t<=9;t++){let n=-200+t/9*(o+400),s=(t%2?i+u()*r:i*.28)*(1+a*.45*(t/4.5-1));e.lineTo(n,c-s*l)}e.lineTo(o+500,c),e.closePath(),e.fill()}),ij=(e,t,n,r,i,a=0)=>J(e,(t,o,s,c,l)=>{t.fillStyle=n,t.beginPath(),t.moveTo(-500,c);for(let n=-200;n<=o+400;n+=22){let s=(n+200)/(o+400);t.lineTo(n,c-(i+Math.abs(Math.sin(n*.004+e*3))*r)*(1+a*.45*(s*2-1))*l)}t.lineTo(o+500,c),t.closePath(),t.fill()}),aj=(e,t,n,r,i,a=0)=>J(e,(e,o,s,c,l)=>{let u=oO(t);e.fillStyle=n;let d=-80;for(;d<o+80;){let t=d/o,n=(r+u()*(i-r))*(1+a*.45*(t*2-1))*l,s=(40+u()*60)*l;e.fillRect(d,c-n,s,n+300),d+=s+(6+u()*14)*l}}),oj=(e,t,n,r,i)=>J(e,(e,a,o,s,c)=>{let l=oO(t);e.fillStyle=n;let u=-40;for(;u<a+40;){let t=(r+l()*i)*c;e.beginPath(),e.arc(u,s-t*.5,t*.5,0,7),e.fill(),e.fillRect(u-t*.14,s-t*.5,t*.28,t*.5+200),u+=(30+l()*22)*c}}),sj=(e,t)=>J(e,(e,n,r,i,a)=>{e.fillStyle=t,e.fillRect(-500,i-10*a,n+1e3,r),e.strokeStyle=`rgba(255,255,255,.16)`,e.lineWidth=1.5*a;for(let t=0;t<4;t++){e.beginPath();for(let r=-500;r<n+500;r+=26)e.lineTo(r,i+t*22*a+Math.sin(r*.03+t)*3*a);e.stroke()}}),cj={field:[[`rolling`,60,110],[`rolling`,48,64],[`rolling`,36,28]],hills:[[`rolling`,110,150],[`rolling`,80,88],[`rolling`,56,38]],ridge:[[`jagged`,150,150],[`jagged`,110,86],[`jagged`,78,40]],valley:[[`rolling`,120,150],[`rolling`,44,58],[`rolling`,80,44]],dunes:[[`dune`,70,110],[`dune`,54,66],[`dune`,40,30]],mesa:[[`jagged`,110,150],[`jagged`,84,84],[`jagged`,60,40]],coast:[[`rolling`,56,100],[`water`,0,0],[`rolling`,40,28]],harbor:[[`skyline`,70,140],[`water`,0,0],[`skyline`,56,86]],forest:[[`rolling`,70,110],[`tree`,64,40],[`tree`,48,30]],city:[[`skyline`,90,170],[`skyline`,110,150],[`skyline`,78,110]],plaza:[[`skyline`,80,150],[`rolling`,28,44],[`skyline`,60,84]]},lj=(e,t,n,r)=>{let[i,a,o]=e,s=r.bias||0;return i===`jagged`?rj(t,n,r.col,a,o,s):i===`dune`?ij(t,n,r.col,a,o,s):i===`skyline`?aj(t,n,r.col,o,o+a,s):i===`tree`?oj(t,n,r.col,o,a):i===`water`?sj(t,r.col):$A(t,n,r.col,a,o,s)},uj=e=>1+Math.sin(e*.55)*.02,dj=(e,t)=>Math.sin(e*.12+t)*16,fj={curtain:(e,t)=>J(.88,(n,r,i,a,o,s=0)=>{let c=r*.15*uj(s),l=dj(s,t)*o,u=t<0?-40+l:r-c+40+l;n.save(),n.globalAlpha=.9,n.fillStyle=e.occluder,n.beginPath(),n.moveTo(u,-60),n.lineTo(u+c,-60),n.lineTo(u+c-20*o,i*.5),n.lineTo(u+c-30*o,i+60),n.lineTo(u-40,i+60),n.closePath(),n.fill(),n.restore()}),foliage:(e,t)=>J(.9,(n,r,i,a,o,s=0)=>{let c=dj(s,t)*o,l=t<0?-16+c:r+16+c,u=t<0?1:-1;n.save(),n.globalAlpha=.9,n.fillStyle=e.occluder;for(let e=0;e<5;e++){let t=l+u*e*42*o,r=(18+e*22)*o+Math.sin(s*.5+e)*4*o;n.beginPath(),n.arc(t,r,(48-e*4)*o,0,7),n.fill()}n.restore()}),pillar:(e,t)=>J(.88,(n,r,i,a,o,s=0)=>{let c=dj(s,t)*o*.3,l=r*.085,u=t<0?r*.05+c:r*.865+c;n.save(),n.globalAlpha=.94,n.fillStyle=e.occluder,n.fillRect(u,-40,l,i+80),n.fillStyle=sO(e.occluder,1.35),n.fillRect(u,-40,l*.32,i+80),n.restore()}),archTop:e=>J(.9,(t,n,r,i,a,o=0)=>{let s=uj(o);t.save(),t.globalAlpha=.94,t.fillStyle=e.occluder,t.beginPath(),t.moveTo(-60,-60),t.lineTo(n+60,-60),t.lineTo(n+60,r*.2*s),t.quadraticCurveTo(n*.5,r*.44*s,-60,r*.2*s),t.closePath(),t.fill(),t.restore()}),ledge:e=>J(.9,(t,n,r,i,a,o=0)=>{let s=uj(o);t.save(),t.globalAlpha=.94,t.fillStyle=e.occluder,t.fillRect(-60,r-58*a*s,n+120,90*a),t.restore()}),rocks:(e,t)=>J(.9,(n,r,i,a,o)=>{let s=t<0?r*.03:r*.8;n.save(),n.globalAlpha=.94,n.fillStyle=e.occluder,n.beginPath(),n.moveTo(s-70,i+60),n.lineTo(s,i-66*o),n.lineTo(s+52*o,i-40*o),n.lineTo(s+112*o,i-92*o),n.lineTo(s+190*o,i+60),n.closePath(),n.fill(),n.restore()}),kelp:(e,t)=>J(.9,(n,r,i,a,o,s=0)=>{let c=t<0?r*.07:r*.9;n.save(),n.globalAlpha=.78,n.strokeStyle=e.occluder,n.lineWidth=13*o,n.lineCap=`round`;for(let e=0;e<2;e++){let t=c+e*24*o;n.beginPath(),n.moveTo(t,i+40);for(let r=i;r>i*.3;r-=28)n.lineTo(t+Math.sin(r*.02+s*.6+e)*20*o,r);n.stroke()}n.restore()}),beam:(e,t)=>J(.88,(n,r,i,a,o)=>{let s=t<0?1:-1,c=t<0?-40:r+40;n.save(),n.globalAlpha=.9,n.strokeStyle=e.occluder,n.lineWidth=22*o,n.beginPath(),n.moveTo(c,-40),n.lineTo(c+s*r*.5,i*.7),n.stroke(),n.restore()}),crowdFg:e=>J(.92,(t,n,r,i,a,o=0)=>{t.save(),t.globalAlpha=.9,t.fillStyle=e.occluder;for(let e=0;e<7;e++){let i=(e+.5)*(n/7)+Math.sin(o*.6+e)*4*a;t.beginPath(),t.arc(i,r+34*a,44*a,Math.PI,0),t.fill(),t.beginPath(),t.arc(i,r-18*a,20*a,0,7),t.fill()}t.restore()})},pj={genericRoom:[{kind:`pillar`,side:1}],office:[{kind:`beam`,side:-1}],classroom:[{kind:`pillar`,side:-1}],workshop:[{kind:`beam`,side:1}],kitchen:[{kind:`ledge`}],stagePodium:[{kind:`curtain`,side:-1},{kind:`curtain`,side:1}],corridor:[{kind:`archTop`}],storeInterior:[{kind:`pillar`,side:1}],labGeneric:[],controlRoom:[{kind:`pillar`,side:-1}],courtroomGeneric:[{kind:`pillar`,side:1}],hospitalWard:[],throneHall:[{kind:`pillar`,side:-1},{kind:`pillar`,side:1}],street:[{kind:`curtain`,side:1}],park:[{kind:`foliage`,side:-1}],forest:[{kind:`foliage`,side:-1},{kind:`foliage`,side:1}],mountain:[{kind:`rocks`,side:-1}],desertPlain:[],coastBeach:[{kind:`rocks`,side:1}],farmField:[],skylineWide:[{kind:`curtain`,side:1}],rooftop:[{kind:`ledge`}],roadHighway:[],rooftopNight:[{kind:`ledge`}],ruins:[{kind:`rocks`,side:1}],cave:[{kind:`archTop`}],oceanSurface:[],underwater:[{kind:`kelp`,side:-1},{kind:`kelp`,side:1}],harborDock:[{kind:`beam`,side:1}],skyClouds:[],spacePlanet:[],arcticIce:[{kind:`rocks`,side:-1}],weatherStorm:[{kind:`curtain`,side:-1}],crowdScene:[{kind:`crowdFg`}],marketplace:[{kind:`crowdFg`}],marketStreetDense:[{kind:`crowdFg`}],stadium:[{kind:`crowdFg`}],constructionSite:[{kind:`beam`,side:-1}],openField:[],rollingHills:[{kind:`foliage`,side:-1}],mountainRidge:[{kind:`rocks`,side:1}],valleyStage:[],pineForest:[{kind:`foliage`,side:-1},{kind:`foliage`,side:1}],sandDunes:[],mesaFlats:[{kind:`rocks`,side:-1}],seaCoast:[{kind:`ledge`}],portHarbor:[{kind:`beam`,side:1}],cityscape:[{kind:`curtain`,side:1}],townPlaza:[{kind:`pillar`,side:-1}],interiorRoom:[{kind:`pillar`,side:1}]},[`studioPlain`,`gradientAbstract`,`gridBoard`,`mapStage`,`chartStage`,`timelineBand`,`splitVersus`,`iconField`,`blueprint`,`spotlightDark`].forEach(e=>{pj[e]=[]}),mj={genericRoom:{focal:`left`,bias:1},office:{focal:`right`,bias:-1},classroom:{focal:`right`,bias:-1},workshop:{focal:`left`,bias:1},kitchen:{focal:`center`,bias:0},stagePodium:{focal:`center`,bias:0},corridor:{focal:`center`,bias:0},storeInterior:{focal:`left`,bias:1},labGeneric:{focal:`right`,bias:-1},controlRoom:{focal:`right`,bias:-1},courtroomGeneric:{focal:`left`,bias:1},hospitalWard:{focal:`center`,bias:0},throneHall:{focal:`center`,bias:0},street:{focal:`left`,bias:1},park:{focal:`right`,bias:-1},forest:{focal:`center`,bias:0},mountain:{focal:`right`,bias:1},desertPlain:{focal:`left`,bias:1},coastBeach:{focal:`left`,bias:-1},farmField:{focal:`right`,bias:-1},skylineWide:{focal:`left`,bias:1},rooftop:{focal:`center`,bias:0},roadHighway:{focal:`center`,bias:0},rooftopNight:{focal:`right`,bias:-1},ruins:{focal:`left`,bias:1},cave:{focal:`center`,bias:0},oceanSurface:{focal:`left`,bias:1},underwater:{focal:`center`,bias:0},harborDock:{focal:`left`,bias:1},skyClouds:{focal:`center`,bias:0},spacePlanet:{focal:`right`,bias:-1},arcticIce:{focal:`right`,bias:-1},weatherStorm:{focal:`right`,bias:-1},crowdScene:{focal:`center`,bias:0},marketplace:{focal:`right`,bias:-1},marketStreetDense:{focal:`left`,bias:1},stadium:{focal:`center`,bias:0},constructionSite:{focal:`right`,bias:-1},openField:{focal:`right`,bias:-1},rollingHills:{focal:`right`,bias:-1},mountainRidge:{focal:`left`,bias:1},valleyStage:{focal:`center`,bias:0},pineForest:{focal:`center`,bias:0},sandDunes:{focal:`left`,bias:1},mesaFlats:{focal:`right`,bias:-1},seaCoast:{focal:`left`,bias:1},portHarbor:{focal:`left`,bias:1},cityscape:{focal:`left`,bias:1},townPlaza:{focal:`right`,bias:-1},interiorRoom:{focal:`left`,bias:1}},[`studioPlain`,`gradientAbstract`,`gridBoard`,`mapStage`,`chartStage`,`timelineBand`,`splitVersus`,`iconField`,`blueprint`,`spotlightDark`].forEach(e=>{mj[e]={focal:`center`,bias:0}}),hj=(e,t)=>(pj[e]||[]).map(e=>fj[e.kind]?fj[e.kind](t,e.side||-1):null).filter(Boolean),gj={openField:`field`,rollingHills:`hills`,mountainRidge:`ridge`,valleyStage:`valley`,sandDunes:`dunes`,mesaFlats:`mesa`,seaCoast:`coast`,portHarbor:`harbor`,pineForest:`forest`,cityscape:`city`,townPlaza:`plaza`,interiorRoom:`room`},_j=Object.keys(gj),Object.keys(gj).forEach(e=>{UA[e]=FA(gj[e],e)}),vj=(e,t=.18)=>J(t,(t,n,r,i)=>{t.fillStyle=e.mid,t.fillRect(-500,-500,n+1e3,i+500)}),yj=e=>J(.66,(t,n,r,i,a)=>{t.fillStyle=e.near,t.fillRect(-500,i-12*a,n+1e3,12*a)}),bj=(e,t,n)=>J(0,(r,i,a)=>{let o=n?r.createLinearGradient(0,0,i,a):r.createLinearGradient(0,0,0,a);o.addColorStop(0,e),o.addColorStop(1,t),r.fillStyle=o,r.fillRect(-500,-500,i+1e3,a+1e3)}),xj=(e,t)=>[GA(e.skyBot),vj(e),J(.3,t(e)),KA(e.ground),yj(e)],Sj=(e,t,n,r,i,a,o=0)=>[nj(e),lj(n,.14,`f`+t,{col:e.far,bias:o}),lj(r,.3,`m`+t,{col:e.mid,bias:o}),J(.46,(t,n,r,i,o,s)=>{t.fillStyle=e.ground,t.fillRect(-500,i,n+1e3,r-i+500),a&&a(e)(t,n,r,i,o,s)}),lj(i,.66,`n`+t,{col:e.near,bias:o})],Cj={window:e=>(t,n,r)=>{t.fillStyle=e.far,t.fillRect(n*.34,r*.15,n*.32,r*.34),t.fillStyle=e.skyTop,t.fillRect(n*.36,r*.17,n*.28,r*.3),t.strokeStyle=e.occluder,t.lineWidth=3,t.beginPath(),t.moveTo(n*.5,r*.17),t.lineTo(n*.5,r*.49),t.moveTo(n*.36,r*.32),t.lineTo(n*.64,r*.32),t.stroke()},monitors:e=>(t,n,r)=>{for(let i=0;i<4;i++)t.fillStyle=e.near,t.fillRect(n*(.16+i*.19),r*.24,n*.13,r*.16),t.fillStyle=e.skyTop,t.fillRect(n*(.165+i*.19),r*.25,n*.12,r*.14)},board:e=>(t,n,r)=>{t.fillStyle=`#2f5240`,t.fillRect(n*.22,r*.16,n*.56,r*.34),t.strokeStyle=e.ground,t.lineWidth=6,t.strokeRect(n*.22,r*.16,n*.56,r*.34),t.strokeStyle=`rgba(255,255,255,.4)`,t.lineWidth=2,t.beginPath(),t.moveTo(n*.28,r*.3),t.lineTo(n*.5,r*.3),t.stroke()},pegboard:e=>(t,n,r)=>{t.fillStyle=e.near;for(let e=0;e<6;e++)t.fillRect(n*(.2+e*.1),r*.2,n*.03,r*.22)},counter:e=>(t,n,r,i,a)=>{t.fillStyle=e.near,t.fillRect(-500,i-60*a,n+1e3,14*a),t.fillStyle=e.far;for(let e=0;e<4;e++)t.fillRect(n*(.2+e*.16),r*.2,n*.11,r*.16)},spotlight:e=>(e,t,n,r)=>{let i=e.createRadialGradient(t/2,r-130,20,t/2,r-130,t*.55);i.addColorStop(0,`rgba(255,250,230,.28)`),i.addColorStop(1,`rgba(255,250,230,0)`),e.fillStyle=i,e.fillRect(0,0,t,n)},perspective:e=>(t,n,r)=>{t.strokeStyle=e.near,t.lineWidth=3;for(let e=-3;e<=3;e++)t.beginPath(),t.moveTo(n/2+e*n*.16,0),t.lineTo(n/2+e*n*.04,r),t.stroke()},shelves:e=>(t,n,r,i,a)=>{t.fillStyle=e.near;for(let i=0;i<3;i++){t.fillRect(n*.14,r*(.22+i*.1),n*.72,8*a);for(let o=0;o<8;o++)t.fillStyle=e.far,t.fillRect(n*(.16+o*.088),r*(.22+i*.1)-14*a,n*.05,14*a),t.fillStyle=e.near}},panels:e=>(t,n,r)=>{for(let i=0;i<6;i++)t.fillStyle=i%2?e.far:e.near,t.globalAlpha=.8,t.fillRect(n*(.15+i*.12),r*(.2+i%2*.05),n*.09,r*.14),t.globalAlpha=1},screens:e=>(t,n,r)=>{for(let i=0;i<8;i++)t.fillStyle=[e.skyTop,e.far,e.mid][i%3],t.globalAlpha=.8,t.fillRect(n*(.1+i%4*.21),r*(.18+Math.floor(i/4)*.16),n*.17,r*.12),t.globalAlpha=1},bench:e=>(t,n,r,i,a)=>{t.fillStyle=e.near,t.fillRect(n*.3,i-90*a,n*.4,60*a),t.fillStyle=e.far,t.fillRect(n*.44,r*.2,n*.12,r*.2)},beds:e=>(t,n,r,i,a)=>{for(let r=0;r<3;r++)t.fillStyle=e.near,t.fillRect(n*(.14+r*.28),i-44*a,n*.2,44*a),t.fillStyle=`#e8edf1`,t.fillRect(n*(.14+r*.28),i-44*a,n*.2,16*a)},columns:e=>(t,n,r,i,a)=>{for(let a=0;a<5;a++)t.fillStyle=e.far,t.fillRect(n*(.1+a*.2),r*.1,n*.05,i-r*.1);t.fillStyle=e.near,t.fillRect(n*.42,i-80*a,n*.16,80*a)}},wj=cj,Tj=(e,t)=>J(.16,(n,r,i,a,o,s=0)=>{let c=oO(`cl`+t);n.fillStyle=e.far;for(let e=0;e<6;e++){let t=c()*r+Math.sin(s*.1+e)*10,a=i*(.12+c()*.3),l=(24+c()*26)*o;n.globalAlpha=.85,n.beginPath(),n.arc(t,a,l,0,7),n.arc(t+l,a+4,l*.8,0,7),n.arc(t-l,a+4,l*.8,0,7),n.fill()}n.globalAlpha=1}),Ej=(e,t)=>J(.1,(n,r,i)=>{let a=oO(`st`+t);n.fillStyle=`#fdfbe8`;for(let e=0;e<90;e++)n.globalAlpha=.4+a()*.6,n.fillRect(a()*r,a()*i*.8,2,2);n.globalAlpha=1,n.fillStyle=e.near,n.beginPath(),n.arc(r*.76,i*.3,54,0,7),n.fill(),n.fillStyle=e.far,n.globalAlpha=.5,n.beginPath(),n.arc(r*.72,i*.26,54,0,7),n.fill(),n.globalAlpha=1}),Dj=(e,t,n,r,i)=>J(e,(e,t,a,o,s,c=0)=>{let l=oO(`cw`+n);e.fillStyle=r;for(let n=0;n<22;n++){let r=l()*(t+80)-40,a=(i+l()*20)*s,u=Math.sin(c*1.2+n)*2;e.fillRect(r+u,o-a,15*s,a),e.beginPath(),e.arc(r+u+7.5*s,o-a,9*s,0,7),e.fill()}}),Oj=(e,t,n,r)=>J(e,(e,i,a,o,s)=>{oO(`mk`+n);for(let n=0;n<r;n++){let a=40+i/r*n;e.fillStyle=[t.far,t.mid,t.near][n%3],e.fillRect(a,o-80*s,i/r*.7,18*s),e.fillStyle=t.near,e.fillRect(a+4*s,o-62*s,6*s,62*s),e.fillRect(a+i/r*.7-10*s,o-62*s,6*s,62*s)}}),kj={genericRoom:e=>xj(e,Cj.window),office:e=>xj(e,Cj.monitors),classroom:e=>xj(e,Cj.board),workshop:e=>xj(e,Cj.pegboard),kitchen:e=>xj(e,Cj.counter),stagePodium:e=>xj(e,Cj.spotlight),corridor:e=>xj(e,Cj.perspective),storeInterior:e=>xj(e,Cj.shelves),labGeneric:e=>xj(e,Cj.panels),controlRoom:e=>xj(e,Cj.screens),street:(e,t,n)=>Sj(e,t,wj.city[0],wj.city[1],[`skyline`,60,90],e=>(e,t,n,r,i)=>{e.strokeStyle=`#e6c34a`,e.lineWidth=3*i,e.setLineDash([20*i,18*i]),e.beginPath(),e.moveTo(-500,r+(n-r)*.5),e.lineTo(t+500,r+(n-r)*.5),e.stroke(),e.setLineDash([])},n),park:(e,t,n)=>Sj(e,t,wj.field[0],[`tree`,60,40],[`tree`,46,30],null,n),forest:(e,t,n)=>Sj(e,t,[`tree`,70,50],[`tree`,60,44],[`tree`,50,34],null,n),mountain:(e,t,n)=>Sj(e,t,wj.ridge[0],wj.ridge[1],wj.ridge[2],null,n),desertPlain:(e,t,n)=>Sj(e,t,wj.dunes[0],wj.dunes[1],wj.dunes[2],null,n),coastBeach:(e,t,n)=>Sj(e,t,wj.coast[0],[`water`,0,0],wj.coast[2],null,n),farmField:(e,t,n)=>Sj(e,t,wj.field[0],wj.field[1],wj.field[2],e=>(t,n,r,i,a)=>{t.strokeStyle=e.near,t.lineWidth=2*a;for(let e=0;e<6;e++)t.beginPath(),t.moveTo(-500,i+e*18*a),t.lineTo(n+500,i+e*18*a),t.stroke()},n),skylineWide:(e,t,n)=>Sj(e,t,[`skyline`,90,150],[`skyline`,110,130],[`skyline`,70,100],null,n),rooftop:(e,t,n)=>Sj(e,t,[`skyline`,80,140],[`skyline`,100,120],[`skyline`,60,90],null,n),roadHighway:(e,t,n)=>Sj(e,t,wj.field[0],[`rolling`,30,40],wj.field[2],e=>(e,t,n,r,i)=>{e.fillStyle=`#5c636e`,e.beginPath(),e.moveTo(t*.38,r),e.lineTo(t*.5,n),e.lineTo(t*.62,r),e.fill(),e.strokeStyle=`#eef2f4`,e.lineWidth=3*i,e.setLineDash([26*i,22*i]),e.beginPath(),e.moveTo(t*.5,r),e.lineTo(t*.5,n),e.stroke(),e.setLineDash([])},n),oceanSurface:(e,t,n)=>[nj(e),lj(wj.coast[0],.14,`f`+t,{col:e.far,bias:n}),sj(.4,e.mid),KA(e.ground)],underwater:(e,t)=>[bj(e.skyTop,e.occluder),J(.2,(e,n,r)=>{let i=oO(`uw`+t);e.fillStyle=`rgba(255,255,255,.16)`;for(let t=0;t<26;t++)e.beginPath(),e.arc(i()*n,i()*r,2+i()*6,0,7),e.fill()}),KA(e.ground)],skyClouds:(e,t)=>[nj(e),Tj(e,t),Tj(e,t+`b`)],spacePlanet:(e,t)=>[bj(e.skyTop,e.skyBot),Ej(e,t)],arcticIce:(e,t,n)=>Sj(e,t,[`jagged`,90,120],[`jagged`,70,80],[`jagged`,50,40],null,n),studioPlain:e=>[bj(e.skyBot,sO(e.skyBot,.92))],gradientAbstract:e=>[bj(e.skyTop,e.mid,!0)],gridBoard:e=>[GA(e.skyBot),J(.2,(e,t,n,r,i)=>{e.strokeStyle=`rgba(0,0,0,.08)`,e.lineWidth=1;for(let r=0;r<t;r+=40*i)e.beginPath(),e.moveTo(r,0),e.lineTo(r,n),e.stroke();for(let r=0;r<n;r+=40*i)e.beginPath(),e.moveTo(0,r),e.lineTo(t,r),e.stroke()})],mapStage:(e,t)=>[GA(e.skyBot),J(.2,(n,r,i)=>{let a=oO(`mp`+t);n.fillStyle=e.mid,n.globalAlpha=.8,n.beginPath(),n.moveTo(r*.2,i*.3);for(let e=0;e<10;e++)n.lineTo(r*(.2+a()*.6),i*(.2+a()*.6));n.closePath(),n.fill(),n.globalAlpha=1})],chartStage:e=>[GA(e.skyBot),J(.2,(t,n,r)=>{t.strokeStyle=e.near,t.lineWidth=2,t.beginPath(),t.moveTo(n*.15,r*.2),t.lineTo(n*.15,r*.8),t.lineTo(n*.85,r*.8),t.stroke()})],timelineBand:e=>[GA(e.skyBot),J(.3,(t,n,r)=>{t.fillStyle=e.mid,t.globalAlpha=.5,t.fillRect(0,r*.46,n,r*.08),t.globalAlpha=1})],splitVersus:e=>[J(0,(t,n,r)=>{t.fillStyle=e.skyTop,t.fillRect(0,0,n/2,r),t.fillStyle=e.mid,t.fillRect(n/2,0,n/2,r),t.strokeStyle=e.near,t.lineWidth=3,t.beginPath(),t.moveTo(n/2,0),t.lineTo(n/2,r),t.stroke()})],iconField:(e,t)=>[GA(e.skyBot),J(.2,(n,r,i)=>{let a=oO(`if`+t);n.fillStyle=e.mid,n.globalAlpha=.4;for(let e=0;e<24;e++)n.beginPath(),n.arc(a()*r,a()*i,10,0,7),n.fill();n.globalAlpha=1})],blueprint:e=>[GA(e.occluder),J(.2,(e,t,n,r,i)=>{e.strokeStyle=`rgba(255,255,255,.22)`,e.lineWidth=1;for(let r=0;r<t;r+=34*i)e.beginPath(),e.moveTo(r,0),e.lineTo(r,n),e.stroke();for(let r=0;r<n;r+=34*i)e.beginPath(),e.moveTo(0,r),e.lineTo(t,r),e.stroke()})],spotlightDark:e=>[GA(e.occluder),J(.1,(e,t,n,r)=>{let i=e.createRadialGradient(t/2,r-120,30,t/2,r-120,t*.6);i.addColorStop(0,`rgba(255,255,255,.16)`),i.addColorStop(1,`rgba(255,255,255,0)`),e.fillStyle=i,e.fillRect(0,0,t,n)}),KA(e.near)],crowdScene:(e,t)=>[nj(e),Dj(.2,e,t+`a`,e.far,40),KA(e.ground),Dj(.55,e,t+`b`,e.near,54)],marketplace:(e,t,n)=>[nj(e),lj([`skyline`,60,80],.14,`f`+t,{col:e.far,bias:n}),KA(e.ground),Oj(.5,e,t,5)],constructionSite:(e,t,n)=>[nj(e),lj([`skyline`,70,110],.14,`f`+t,{col:e.far,bias:n}),KA(e.ground),J(.5,(e,t,n,r,i)=>{e.strokeStyle=`#e0a52e`,e.lineWidth=6*i,e.strokeRect(t*.3,r-200*i,6*i,200*i),e.beginPath(),e.moveTo(t*.3,r-200*i),e.lineTo(t*.58,r-200*i),e.stroke(),e.beginPath(),e.moveTo(t*.55,r-200*i),e.lineTo(t*.55,r-120*i),e.stroke()})],harborDock:(e,t,n)=>[nj(e),lj([`skyline`,60,90],.14,`f`+t,{col:e.far,bias:n}),sj(.4,e.mid),KA(e.ground)],weatherStorm:(e,t)=>[bj(e.occluder,e.mid),J(.2,(e,n,r)=>{let i=oO(`ws`+t);e.strokeStyle=`rgba(220,230,240,.35)`,e.lineWidth=2;for(let t=0;t<50;t++){let t=i()*n,a=i()*r;e.beginPath(),e.moveTo(t,a),e.lineTo(t-6,a+18),e.stroke()}}),KA(e.near)],stadium:(e,t)=>[nj(e),J(.14,(t,n,r,i,a)=>{t.fillStyle=e.far;for(let e=0;e<4;e++)t.fillRect(-500,i-(140-e*30)*a,n+1e3,26*a)}),Dj(.3,e,t,e.mid,18),KA(e.ground)],courtroomGeneric:e=>xj(e,Cj.bench),hospitalWard:e=>xj(e,Cj.beds),throneHall:e=>xj(e,Cj.columns),cave:e=>[GA(e.occluder),J(.2,(t,n,r,i)=>{let a=t.createRadialGradient(n/2,i-80,40,n/2,i-80,n*.5);a.addColorStop(0,e.skyBot),a.addColorStop(1,e.occluder),t.fillStyle=a,t.beginPath(),t.ellipse(n/2,i-40,n*.3,r*.4,0,0,7),t.fill()}),KA(e.near)],ruins:(e,t,n)=>[nj(e),lj([`rolling`,50,90],.14,`f`+t,{col:e.far,bias:n}),J(.4,(n,r,i,a,o)=>{let s=oO(`ru`+t);n.fillStyle=e.mid;for(let e=0;e<5;e++){let t=(60+s()*90)*o;n.fillRect(r*(.12+e*.19),a-t,20*o,t)}}),KA(e.ground)],rooftopNight:(e,t,n)=>Sj(e,t,[`skyline`,100,160],[`skyline`,120,140],[`skyline`,70,100],null,n),marketStreetDense:(e,t)=>[nj(e),lj([`skyline`,70,110],.14,`f`+t,{col:e.far}),Oj(.3,e,t+`a`,6),KA(e.ground),Oj(.58,e,t+`b`,4)]},Aj=Object.keys(kj),Object.keys(kj).forEach(e=>{let t=kj[e];UA[e]=(n=7,r=`day`)=>{let i=XA[r]||XA.day,a=(mj[e]||{}).bias||0;return[...t(i,`:`+r+n,a),...hj(e,i)]}}),jj=e=>Object.prototype.hasOwnProperty.call(kj,e)||Object.prototype.hasOwnProperty.call(gj,e),Object.assign(UA,{mapBoard:uA,warRoomTable:dA}),Mj=[`groundL`,`groundC`,`groundR`,`midL`,`midR`,`skyL`,`skyR`,`skyBand`],Nj={plain:[`center.c`],skyDay:[`sky.c`,`ground.c`],skyNight:[`sky.c`,`ground.c`],city:[`ground.c`,`wall.a`,`wall.b`],nature:[`ground.c`,`tree.a`],interior:[`wall.a`,`wall.b`,`wall.c`,`table.c`],abstract:[`center.c`],dioramaDay:Mj,dioramaDusk:Mj,dioramaNight:Mj,dioramaDesert:Mj,dioramaArctic:Mj,mapBoard:[`center.c`],warRoomTable:[`tableFrontL`,`tableFrontR`,`tableBack`,`tableMap`]},_j.forEach(e=>{Nj[e]=Mj}),Aj.forEach(e=>{Nj[e]=Mj}),Pj={plain:`light`,skyDay:`light`,skyNight:`dark`,city:`light`,nature:`light`,interior:`light`,abstract:`dark`,stagePodium:`dark`,controlRoom:`dark`,underwater:`dark`,spacePlanet:`dark`,blueprint:`dark`,spotlightDark:`dark`,weatherStorm:`dark`,gradientAbstract:`dark`,dioramaDay:`light`,dioramaDusk:`light`,dioramaNight:`dark`,dioramaDesert:`light`,dioramaArctic:`light`,mapBoard:`dark`,warRoomTable:`dark`},Fj={"center.c":{x:.5,y:300,z:.5},"ground.c":{x:.5,y:520,z:.5},"table.c":{x:.5,y:470,z:.42},"wall.a":{x:.28,y:180,z:.62},"wall.b":{x:.5,y:168,z:.62},"wall.c":{x:.72,y:180,z:.62},"sky.c":{x:.5,y:120,z:.85},"tree.a":{x:.72,y:430,z:.55},left:{x:.2,y:300,z:.5},right:{x:.8,y:300,z:.5},hover:{x:.5,y:250,z:.5},lowerThird:{x:.5,y:500,z:.5},skyBand:{x:.5,y:110,z:.9},groundL:{x:.22,y:500,z:.45},groundC:{x:.5,y:500,z:.45},groundR:{x:.78,y:500,z:.45},midL:{x:.3,y:430,z:.62},midR:{x:.7,y:430,z:.62},skyL:{x:.28,y:150,z:.82},skyR:{x:.72,y:150,z:.82},tableFrontL:{x:.4,y:560,z:.42},tableFrontR:{x:.6,y:560,z:.42},tableBack:{x:.5,y:470,z:.6},tableMap:{x:.5,y:500,z:.45}},Ij=[`center.c`,`ground.c`,`left`,`right`],Lj=Object.keys(UA),Rj=e=>Object.prototype.hasOwnProperty.call(UA,e)||MA(e),zj=e=>e<=.12?`sky`:e<=.3?`back`:e<=.5?`mid`:`near`}));function Vj(e,t,n){let r=typeof e==`string`?e:e&&e.type,i=Yj[r];return i?i(typeof e==`object`?e:{type:r},t,n):``}var Hj,Uj,Wj,Gj,Kj,qj,Jj,Yj,Xj=o((()=>{pO(),Hj=640,Uj=Math.sin,Wj=Math.cos,Gj=Math.floor,Kj=e=>{let t=Uj(e*127.1)*43758.5453;return t-Gj(t)},qj=[`rain`,`snow`,`wind`,`fog`,`heatShimmer`,`lightning`],Jj=e=>e.intensity===`storm`||typeof e.intensity==`number`&&e.intensity>.6,Yj={rain(e,t,n){let r=Jj(e),i=r?92:54,a=r?34:24,o=r?1180:820,s=r?9:4,c=``;for(let e=0;e<i;e++){let r=Kj(e)*(n+80)-40,i=(Kj(e+9)*700+t*o)%700-30,l=r+i/Hj*s*3;c+=`M${l.toFixed(1)} ${i.toFixed(1)} l${s} ${a} `}let l=``;for(let e=0;e<(r?16:9);e++){let r=Kj(e+40)*n,i=(t*3+Kj(e+40)*5)%1,a=i*11;l+=`<circle cx="${r.toFixed(1)}" cy="598" r="${a.toFixed(1)}" fill="none" stroke="rgba(200,220,235,${(.5*(1-i)).toFixed(2)})" stroke-width="1.5"/>`}return`${r?`<rect x="0" y="0" width="${n}" height="${Hj}" fill="#20303f" opacity="0.16"/>`:``}<path d="${c}" stroke="rgba(190,214,232,${r?.52:.4})" stroke-width="${r?2:1.5}" stroke-linecap="round"/>${l}`},snow(e,t,n){let r=Jj(e)?96:68,i=``;for(let e=0;e<r;e++){let r=(Kj(e+3)*680+t*(56+Kj(e)*64))%680-20,a=Kj(e+7)*n+Uj(t*(.6+Kj(e))+e)*18,o=1.5+Kj(e+5)*2.4;i+=`<circle cx="${a.toFixed(1)}" cy="${r.toFixed(1)}" r="${o.toFixed(1)}" fill="rgba(255,255,255,${(.55+Kj(e+1)*.4).toFixed(2)})"/>`}return`<rect x="0" y="0" width="${n}" height="${Hj}" fill="#dfeaf2" opacity="0.10"/><rect x="0" y="614" width="${n}" height="26" fill="#f2f7fb" opacity="0.5"/>${i}`},wind(e,t,n){let r=n+140,i=``;for(let e=0;e<28;e++){let n=(Kj(e+2)*r+t*(250+Kj(e)*180))%r-70,a=110+Kj(e+4)*410+Uj(t*3+e)*16,o=(t*200+e*63)%360;i+=`<g transform="translate(${n.toFixed(1)} ${a.toFixed(1)}) rotate(${o.toFixed(0)})"><path d="M0 0 q6 -5 12 0 q-6 5 -12 0Z" fill="${[`#c98b52`,`#9bb06a`,`#b9863f`][e%3]}" opacity="0.85"/></g>`}let a=``;for(let e=0;e<6;e++){let r=90+Hj/7*e,i=(t*420+e*210)%(n+320)-160;a+=`<path d="M${i.toFixed(1)} ${r.toFixed(1)} q60 -8 140 0" stroke="rgba(232,237,242,0.22)" stroke-width="2" fill="none"/>`}return a+i},fog(e,t,n){let r=Uj(t*.3)*34,i=Wj(t*.22)*44,a=Jj(e)?.4:.28;return`<rect x="0" y="0" width="${n}" height="${Hj}" fill="#c9d4dc" opacity="${a.toFixed(2)}"/><ellipse cx="${(n*.35+r).toFixed(1)}" cy="${Hj*.72}" rx="${(n*.6).toFixed(0)}" ry="120" fill="#dde5eb" opacity="0.35"/><ellipse cx="${(n*.7+i).toFixed(1)}" cy="${Hj*.86}" rx="${(n*.7).toFixed(0)}" ry="150" fill="#eef3f6" opacity="0.4"/>`},heatShimmer(e,t,n){let r=``;for(let e=0;e<9;e++){let i=Hj*.48+e*18,a=Uj(t*3+e*.7)*7;r+=`<rect x="${a.toFixed(1)}" y="${i.toFixed(0)}" width="${n}" height="11" fill="rgba(255,246,214,0.06)"/>`}return r},lightning(e,t,n){let r=3.2,i=t%r/r;if(i>.16)return``;let a=K(i<.05?i/.05:1-(i-.05)/.11,0,1),o=``;if(i<.09){let e=n*(.3+Kj(Gj(t/r))*.4),i=`M${e.toFixed(1)} 0`,s=0,c=e;for(;s<Hj*.62;)s+=40+Kj(s)*30,c+=(Kj(s+1)-.5)*64,i+=` L${c.toFixed(1)} ${s.toFixed(1)}`;o=`<path d="${i}" stroke="#fdfbef" stroke-width="3" fill="none" opacity="${a.toFixed(2)}"/>`}return`<rect x="0" y="0" width="${n}" height="${Hj}" fill="#f4f2e2" opacity="${(a*.5).toFixed(2)}"/>${o}`}}}));function Zj(e){let t=e>>>0;return function(){t|=0,t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}function Qj(e,t,n,r,i){let a=i*i,o=a*i;return .5*(2*t+(-e+n)*i+(2*e-5*t+4*n-r)*a+(-e+3*t-3*n+r)*o)}function $j(e,t,n,r){let i=e[Math.max(0,t-1)][r],a=e[t][r],o=e[Math.min(e.length-1,t+1)][r],s=e[Math.min(e.length-1,t+2)][r];return Qj(i,a,o,s,n)}function eM(e,t){let n=[...e].sort((e,t)=>e.time-t.time);if(!n.length)throw Error(`PanMaster requires at least one camera point.`);return n[0].time>0&&n.unshift({...n[0],time:0}),n[n.length-1].time<t&&n.push({...n[n.length-1],time:t}),n.map((e,t)=>({time:e.time,x:e.x??0,y:e.y??0,scale:e.scale??1,rotation:e.rotation??0,subjectId:e.subjectId??null,ease:e.ease||`smoother`,index:t}))}function tM({duration:e=5,subjects:t=[],seed:n=1,viewW:r=1920,viewH:i=1080,worldW:a=2800,worldH:o=1700,style:s=`editorial`,styleCustom:c=null}={}){let l=Zj(n),u=r*.22,d=i*.2,f={editorial:{zoom:[1,1.22],rot:[-1.2,1.2],wander:150},calm:{zoom:[1.02,1.14],rot:[-.6,.6],wander:90},energetic:{zoom:[1.04,1.32],rot:[-2.2,2.2],wander:210},dramatic:{zoom:[1.08,1.42],rot:[-2.8,2.8],wander:170}},p=s===`custom`&&c?{zoom:c.zoom,rot:c.rot,wander:c.wander}:f[s]||f.editorial,m=t.length?t:[{id:`center`,x:a/2,y:o/2,importance:1}],h=Math.max(4,Math.min(7,Math.round(e*1.05))),g=[];for(let t=0;t<h;t++){let n=t/(h-1),r=m[t%m.length],i=t%2==0?1:-1,s=Math.sin(n*Math.PI*1.7)*p.wander*i,c=(l()-.5)*p.wander*.55,f=(l()-.5)*p.wander*.38,_=sM(r.x+s+c,u,a-u),v=sM(r.y+Math.cos(n*Math.PI*1.6)*p.wander*.42+f,d,o-d),y=Math.sin(n*Math.PI*2.1)*.5+.5,b=cM(p.zoom[0],p.zoom[1],.28+.72*y)*(r.importance||1),x=cM(p.rot[0],p.rot[1],l());g.push({time:n*e,x:_,y:v,scale:b,rotation:x,subjectId:r.id})}return g[0].scale=Math.min(g[0].scale,1.08),g[g.length-1].rotation*=.25,{duration:e,points:eM(g,e),viewW:r,viewH:i,worldW:a,worldH:o,seed:n,style:s}}function nM(e,t){let n=e.points,r=e.duration,i=sM(t,0,r),a=0;for(;a<n.length-2&&i>n[a+1].time;)a++;let o=n[a],s=n[Math.min(a+1,n.length-1)],c=Math.max(1e-4,s.time-o.time),l=sM((i-o.time)/c);return l=o.ease===`linear`?l:o.ease===`smooth`?lM(l):uM(l),{x:$j(n,a,l,`x`),y:$j(n,a,l,`y`),scale:$j(n,a,l,`scale`),rotation:$j(n,a,l,`rotation`),subjectId:l<.5?o.subjectId:s.subjectId,progress:i/r}}function rM(e,t=1,n=1920,r=1080){let i=sM(t,0,1.6),a=1+(e.scale-1)*i,o=cM(n/2,e.x,i),s=cM(r/2,e.y,i),c=e.rotation*i*.55;return`translate(${n/2} ${r/2}) rotate(${-c}) scale(${a}) translate(${-o} ${-s})`}function iM({duration:e,points:t=[],viewW:n=1920,viewH:r=1080,worldW:i=2800,worldH:a=1700,zoomMin:o=dM,zoomMax:s=3}){let c=[];for(let e of t){let t=sM(e.zoom==null?e.scale==null?1:e.scale:e.zoom,o,s),n={time:e.time,x:e.x,y:e.y,scale:t,rotation:e.rotation||0,ease:e.ease||`smoother`,subjectId:e.subjectId??null};c.push(n),e.hold&&c.push({...n,time:e.time+e.hold})}let l=e??Math.max(...c.map(e=>e.time),.001);return{duration:l,points:eM(c,l),viewW:n,viewH:r,worldW:i,worldH:a,mode:`manual`}}function aM(e,t=[]){let n=tM(e),r=n.points.map(e=>({time:e.time,x:e.x,y:e.y,zoom:e.scale,rotation:e.rotation,ease:e.ease,subjectId:e.subjectId}));return t.forEach(e=>{e.index!=null&&r[e.index]&&Object.assign(r[e.index],e)}),iM({duration:n.duration,points:r,viewW:n.viewW,viewH:n.viewH,worldW:n.worldW,worldH:n.worldH})}function oM(e,t={}){let n=t.worldW==null?e.worldW||2800:t.worldW,r=t.worldH==null?e.worldH||1700:t.worldH,i=t.viewW==null?e.viewW||1920:t.viewW,a=t.viewH==null?e.viewH||1080:t.viewH,o=e.duration==null?t.duration:e.duration;return e.mode===`manual`?iM({duration:o,points:e.points||[],viewW:i,viewH:a,worldW:n,worldH:r,zoomMin:e.zoomMin,zoomMax:e.zoomMax}):e.mode===`hybrid`?aM({duration:o,subjects:e.subjects||t.subjects||[],seed:e.seed||1,viewW:i,viewH:a,worldW:n,worldH:r,style:e.style||`editorial`,styleCustom:e.styleCustom},e.edits||[]):tM({duration:o,subjects:e.subjects||t.subjects||[],seed:e.seed||1,viewW:i,viewH:a,worldW:n,worldH:r,style:e.style||`editorial`,styleCustom:e.styleCustom})}var sM,cM,lM,uM,dM,fM=o((()=>{sM=(e,t=0,n=1)=>Math.max(t,Math.min(n,e)),cM=(e,t,n)=>e+(t-e)*n,lM=e=>e*e*(3-2*e),uM=e=>e*e*e*(e*(e*6-15)+10),dM=.5}));function pM(e){let t=e.type,n=jM.includes(t)?null:e.swapWindow||IM[t]||[.45,.55];return{type:t,durationMs:e.durationMs==null?1200:e.durationMs,ease:MM.includes(e.ease)?e.ease:`smoother`,direction:e.direction||LM[t]||`L2R`,colorMode:e.colorMode||`bridge`,colors:e.colors||[],swapWindow:n,carrySubject:e.carrySubject||null,params:{...FM[t]||{},...e.params||{}}}}function mM(e,t,n=0){let r=t.bridge&&t.bridge[0]||`#141c24`,i=t.bridge&&t.bridge[1]||`#0d1220`;return e.colorMode===`custom`&&e.colors.length?e.colors[CM(n,e.colors.length-1)]:e.colorMode===`token`?`#0d1220`:e.colorMode===`incoming`?i:cO(r,i,.5)}function hM(e,t,n){let r=t>0?K(e/t,0,1):1,i=n<1?K((e-n)/(1-n),0,1):0;return CM(r,1-i)}function gM(e,t,n,r,i,a=1){return`<rect x="${e.toFixed(1)}" y="${t.toFixed(1)}" width="${n.toFixed(1)}" height="${r.toFixed(1)}" fill="${i}" opacity="${a}"/>`}function _M(e,t,n,r){if(!e.carrySubject)return null;let i=n.subjectFrom||{x:r*.5,y:Y*.6},a=n.subjectTo||{x:r*.5,y:Y*.6};return{x:lO(i.x,a.x,t),y:lO(i.y,a.y,t)}}function vM(e,t,n={}){let r=pM(e),i=n.VBW||1138,a=K(t,0,1),o=PM[r.ease](a),s=RM[r.type],c=s?s(r,o,a,n,i):{svg:``,alpha:0},l,u,d=1,f=1,p=null,m=null,h=null,g=null;if(r.swapWindow)h=r.swapWindow[0],l=a<h,u=a>=h;else if(r.type===`fade`)l=!0,u=!0,d=1-o,f=o;else{l=!0,u=!0;let e=r.direction===`R2L`||r.direction===`B2T`?-1:1,t=(HM[r.type]||HM.carryTravel)(o,e,i,Y,r.params,n.subject);p=t.fromT,m=t.toT,g={blur:t.blur||0,flip:!!t.flip,split:t.split,axis:t.axis,over:!!t.over,shadow:!!t.shadow,dir:e},t.flip&&(l=a<.5,u=a>=.5)}return{resolved:r,cover:c.svg,coverAlpha:c.alpha,fromShown:l,toShown:u,fromOpacity:d,toOpacity:f,fromTransform:p,toTransform:m,motion:g,swapWindow:r.swapWindow,swapAt:h,subject:_M(r,o,n,i)}}var Y,yM,bM,xM,SM,CM,wM,TM,EM,DM,OM,kM,AM,jM,MM,NM,PM,FM,IM,LM,RM,zM,BM,VM,HM,UM=o((()=>{pO(),Y=640,yM=Math.sin,bM=Math.cos,xM=Math.PI,SM=Math.hypot,CM=Math.min,wM=Math.max,TM=.1,EM=[`fade`,`irisObject`,`strokeSweep`,`slabWipe`,`curtainFall`,`lightWash`,`bandWipe`,`carryTravel`],DM=[`blindsFlip`,`checkerFlip`,`inkBlot`,`smokeConceal`,`particleStorm`,`paperTear`,`shapeStampede`,`typeMask`,`silhouetteWalkWipe`,`pushOff`,`slideOver`,`splitBarn`,`whipPan`,`spinCard`,`zoomThrough`,`pullBackReveal`,`elevatorRise`],OM=[`flashImpact`,`dipToColor`,`silhouettePass`,`dayNightSweep`,`spotlightShift`,`matchMorph`,`pixelMosaic`,`lineArtRebuild`,`stackShuffle`,`ripplePortal`,`doorPass`,`waveCrash`,`pageFlip`,`lightSpeedStreak`,`glitchCut`],kM=[...EM,...DM,...OM],AM=[`carryTravel`,`pushOff`,`slideOver`,`splitBarn`,`whipPan`,`spinCard`,`zoomThrough`,`pullBackReveal`,`elevatorRise`,`stackShuffle`],jM=[`fade`,...AM],MM=[`linear`,`smooth`,`smoother`],NM=e=>kM.includes(e),PM={linear:e=>e,smooth:e=>e*e*(3-2*e),smoother:e=>e*e*e*(e*(e*6-15)+10)},FM={fade:{mode:`direct`},irisObject:{shape:`circle`,origin:`center`,grow:`out`},strokeSweep:{pathPreset:`arc`,glow:!0},slabWipe:{edge:`straight`},curtainFall:{pairedPaletteShift:!0},lightWash:{mode:`radial`,origin:`center`},bandWipe:{bands:3,staggerPct:.08,slantDeg:14,edgeProfile:`straight`},carryTravel:{vector:`L2R`,ms:1200},blindsFlip:{slats:8,axis:`h`},checkerFlip:{grid:6,order:`sweep`},inkBlot:{blobs:3,wobble:.25},smokeConceal:{density:1},particleStorm:{particleType:`confetti`},paperTear:{tearJaggedness:22},shapeStampede:{iconRef:`coin`,count:40},typeMask:{text:`NEXT`},silhouetteWalkWipe:{castRef:null,scale:1,action:`walk`},pushOff:{},slideOver:{shadowEdge:!0},splitBarn:{axis:`v`},whipPan:{blurPx:9},spinCard:{axis:`y`,perspectiveFake:!0},zoomThrough:{targetElement:null,overshoot:1},pullBackReveal:{frameElement:null},elevatorRise:{},flashImpact:{tint:`#ffffff`},dipToColor:{color:null,holdMs:200},silhouettePass:{holdMs:200},dayNightSweep:{},spotlightShift:{origin:`subject`},matchMorph:{fromRef:null,toRef:null},pixelMosaic:{blockPx:48,order:`random`},lineArtRebuild:{strokeColor:`#243038`},stackShuffle:{cardShadow:!0},ripplePortal:{origin:`center`,rings:5},doorPass:{portalElement:null},waveCrash:{foam:!0},pageFlip:{corner:`tr`},lightSpeedStreak:{streakColor:`#bcd4ff`},glitchCut:{intensity:1}},IM={irisObject:[.42,.58],strokeSweep:[.44,.56],slabWipe:[.46,.56],curtainFall:[.46,.56],lightWash:[.42,.58],bandWipe:[.48,.62]},LM={curtainFall:`T2B`,bandWipe:`L2R`,slabWipe:`L2R`,carryTravel:`L2R`},RM={fade(e,t,n,r,i){if(e.params.mode===`toColor`){let t=yM(K(n,0,1)*xM),a=i*TM;return{svg:gM(-a,-64,i+2*a,768,e.colors[0]||mM(e,r),t),alpha:t}}return{svg:``,alpha:0}},irisObject(e,t,n,r,i){let a=e.swapWindow[0],o=e.swapWindow[1],s=hM(n,a,o),c=mM(e,r),l=e.params.origin===`subject`&&r.subject?r.subject:{x:i/2,y:Y/2},u=SM(i,Y)*.5*1.2,d=(e.params.grow===`in`?1-s:s)*u;if(e.params.shape!==`circle`){let e=d/120;return{svg:`<path transform="translate(${l.x.toFixed(1)} ${l.y.toFixed(1)}) scale(${e.toFixed(3)})" d="M0 -120 C70 -120 120 -60 120 10 C120 80 60 120 0 120 C-60 120 -120 80 -120 10 C-120 -60 -70 -120 0 -120 Z" fill="${c}"/>`,alpha:s}}return{svg:`<circle cx="${l.x.toFixed(1)}" cy="${l.y.toFixed(1)}" r="${d.toFixed(1)}" fill="${c}"/>`,alpha:s}},strokeSweep(e,t,n,r,i){let a=e.swapWindow[0],o=e.swapWindow[1],s=hM(n,a,o),c=mM(e,r),l=s*SM(i,Y)*1.15,u=e.params.pathPreset,d=u===`S`?`M -60 ${Y*.2} C ${i*.4} 0, ${i*.6} ${Y} , ${i+60} ${Y*.8}`:u===`bolt`?`M -60 ${Y*.1} L ${i*.45} ${Y*.5} L ${i*.35} ${Y*.55} L ${i+60} ${Y*.95}`:u===`wave`?`M -60 ${Y/2} Q ${i*.25} ${Y*.1}, ${i*.5} ${Y/2} T ${i+60} ${Y/2}`:`M -60 ${Y*.85} Q ${i/2} -224, ${i+60} ${Y*.85}`;return{svg:(e.params.glow?`<path d="${d}" fill="none" stroke="${c}" stroke-width="${(l*1.25).toFixed(1)}" stroke-linecap="round" opacity="0.35"/>`:``)+`<path d="${d}" fill="none" stroke="${c}" stroke-width="${l.toFixed(1)}" stroke-linecap="round"/>`,alpha:s}},slabWipe(e,t,n,r,i){let a=e.swapWindow[0],o=e.swapWindow[1],s=a>0?K(n/a,0,1):1,c=o<1?K((n-o)/(1-o),0,1):0,l=mM(e,r),u=e.direction!==`T2B`&&e.direction!==`B2T`,d=e.direction===`R2L`||e.direction===`B2T`,f=s,p=c,m=d?1-f:p,h=d?1-p:f,g=e.params.edge===`rounded`?26:0,_=i*TM,v=f-p;if(u){let e=m<=1e-6?-_:m*i,t=h>=1-1e-6?i+_:h*i;return{svg:`<rect x="${e.toFixed(1)}" y="${(-64).toFixed(1)}" width="${(t-e).toFixed(1)}" height="${768 .toFixed(1)}" rx="${g}" fill="${l}"/>`,alpha:v}}let y=m<=1e-6?-64:m*Y,b=h>=1-1e-6?704:h*Y;return{svg:`<rect x="${(-_).toFixed(1)}" y="${y.toFixed(1)}" width="${(i+2*_).toFixed(1)}" height="${(b-y).toFixed(1)}" rx="${g}" fill="${l}"/>`,alpha:v}},curtainFall(e,t,n,r,i){let a=e.swapWindow[0],o=e.swapWindow[1],s=a>0?K(n/a,0,1):1,c=o<1?K((n-o)/(1-o),0,1):0,l=e.direction===`B2T`,u=e.params.pairedPaletteShift?cO(mM(e,r),`#0a1020`,.4):mM(e,r),d=s,f=c,p=l?1-d:f,m=l?1-f:d,h=i*TM,g=p<=1e-6?-64:p*Y,_=m>=1-1e-6?704:m*Y;return{svg:`<rect x="${(-h).toFixed(1)}" y="${CM(g,_).toFixed(1)}" width="${(i+2*h).toFixed(1)}" height="${Math.abs(_-g).toFixed(1)}" fill="${u}"/>`,alpha:s-c}},lightWash(e,t,n,r,i){let a=e.swapWindow[0],o=e.swapWindow[1],s=hM(n,a,o),c=e.colors[0]||mM(e,r),l=i*TM;if(e.params.mode===`linear`)return{svg:gM(-l,-64,i+2*l,768,c,s),alpha:s};let u=e.params.origin===`subject`&&r.subject?r.subject:{x:i/2,y:Y/2},d=SM(i,Y)*(.34+.75*s);return{svg:`<defs><radialGradient id="lw" cx="${(u.x/i).toFixed(3)}" cy="${(u.y/Y).toFixed(3)}" r="0.8"><stop offset="0" stop-color="${c}" stop-opacity="${s.toFixed(3)}"/><stop offset="1" stop-color="${c}" stop-opacity="${(s*s).toFixed(3)}"/></radialGradient></defs><circle cx="${u.x.toFixed(1)}" cy="${u.y.toFixed(1)}" r="${d.toFixed(1)}" fill="url(#lw)"/>${gM(-l,-64,i+2*l,768,c,s*s*.9)}`,alpha:s}},bandWipe(e,t,n,r,i){let a=e.swapWindow[0],o=e.swapWindow[1],s=K(e.params.bands|0||3,2,5),c=e.params.staggerPct||.08,l=(e.params.slantDeg||0)*xM/180,u=Math.tan(l)*Y,d=o<1?K((n-o)/(1-o),0,1):0,f=r.bridge&&r.bridge[0]||`#141c24`,p=r.bridge&&r.bridge[1]||`#0d1220`,m=i*TM,h=768/s,g=``,_=1;for(let t=0;t<s;t++){let r=t*c,o=a-r>0?K((n-r)/(a-r),0,1):1,l=CM(o,1-d);_=CM(_,l);let v=e.direction===`R2L`?-1:1,y=l*(i+2*m+Math.abs(u)),b=cO(f,p,s>1?t/(s-1):.5),x=v>0?-m-Math.abs(u):i+m-y+Math.abs(u),S=-64+t*h;g+=`<path d="M ${x.toFixed(1)} ${S.toFixed(1)} l ${y.toFixed(1)} 0 l ${u.toFixed(1)} ${h.toFixed(1)} l ${(-y).toFixed(1)} 0 Z" fill="${b}"/>`}return{svg:g,alpha:_}},carryTravel(e,t,n,r,i){return{svg:``,alpha:0}}},zM=e=>{let t=yM(e*91.7)*43758.5453;return t-Math.floor(t)},BM=(e,t,n,r,i,a=1,o=0)=>`<rect x="${e.toFixed(1)}" y="${t.toFixed(1)}" width="${n.toFixed(1)}" height="${r.toFixed(1)}" rx="${o}" fill="${i}" opacity="${a}"/>`,Object.assign(RM,{blindsFlip(e,t,n,r,i){let a=hM(n,e.swapWindow[0],e.swapWindow[1]),o=mM(e,r),s=K(e.params.slats||8,4,16),c=(e.params.axis||`h`)!==`v`,l=i*TM,u=``,d=(c?768:i+2*l)/s;for(let e=0;e<s;e++){let t=d*a;u+=c?BM(-l,-64+e*d+d/2-t/2,i+2*l,t,o):BM(-l+e*d+d/2-t/2,-64,t,768,o)}return{svg:u,alpha:a}},checkerFlip(e,t,n,r,i){let a=mM(e,r),o=K(e.params.grid||6,3,10),s=i/o,c=Y/o,l=hM(n,e.swapWindow[0],e.swapWindow[1]),u=``,d=1;for(let t=0;t<o;t++)for(let n=0;n<o;n++){let r=e.params.order===`spiral`?(Math.abs(n-(o-1)/2)+Math.abs(t-(o-1)/2))/o:e.params.order===`random`?zM(n*7+t*13+1):(n+t)/(2*o),i=K(l*1.7-r*.7,0,1);d=CM(d,i),u+=BM(n*s+s/2-s*i/2,t*c+c/2-c*i/2,s*i,c*i,a)}return{svg:u,alpha:d}},inkBlot(e,t,n,r,i){let a=hM(n,e.swapWindow[0],e.swapWindow[1]),o=mM(e,r),s=K(e.params.blobs||3,1,6),c=e.params.wobble==null?.25:e.params.wobble,l=BM(-i*TM,-640*TM,i*1.2,Y*1.2,o,a*a*.5);for(let e=0;e<s;e++){let t=i*(.2+.6*zM(e+1)),n=Y*(.25+.5*zM(e+5)),r=a*SM(i,Y)*.5,s=`M ${(t+r).toFixed(1)} ${n.toFixed(1)}`;for(let i=1;i<=12;i++){let a=i/12*2*xM,o=r*(1+c*(zM(e*20+i)-.5));s+=` L ${(t+bM(a)*o).toFixed(1)} ${(n+yM(a)*o).toFixed(1)}`}l+=`<path d="${s} Z" fill="${o}"/>`}return{svg:l,alpha:a}},smokeConceal(e,t,n,r,i){let a=hM(n,e.swapWindow[0],e.swapWindow[1]),o=mM(e,r),s=``;for(let e=0;e<14;e++){let t=i*zM(e+2),n=Y*zM(e+8),r=a*SM(i,Y)*(.24+.14*zM(e));s+=`<circle cx="${t.toFixed(1)}" cy="${n.toFixed(1)}" r="${r.toFixed(1)}" fill="${o}" opacity="${(.5+.5*a).toFixed(2)}"/>`}return{svg:s+BM(-i*TM,-640*TM,i*1.2,Y*1.2,o,a*a),alpha:a}},particleStorm(e,t,n,r,i){let a=hM(n,e.swapWindow[0],e.swapWindow[1]),o=Math.round(120*a),s=e.params.particleType===`snow`?[`#fff`,`#e8eef4`]:e.params.particleType===`debris`?[`#6b5a44`,`#413424`]:[mM(e,r),`#f2b134`,`#ff6b5e`,`#5b6ce0`],c=BM(-i*TM,-640*TM,i*1.2,Y*1.2,mM(e,r),a*a*.85);for(let e=0;e<o;e++){let t=i*zM(e+1),n=Y*zM(e*3+2),r=4+5*zM(e);c+=BM(t,n,r,r,s[e%s.length],.9,2)}return{svg:c,alpha:a}},paperTear(e,t,n,r,i){let a=e.swapWindow[0],o=e.swapWindow[1],s=a>0?K(n/a,0,1):1,c=o<1?K((n-o)/(1-o),0,1):0,l=mM(e,r),u=e.params.tearJaggedness==null?22:e.params.tearJaggedness,d=e.direction===`R2L`,f=(d?1-s:s)*i,p=d?`M ${i+i*TM} ${-640*TM} L ${f} ${-640*TM}`:`M ${-i*TM} ${-640*TM} L ${f} ${-640*TM}`;for(let e=0;e<=Y;e+=24)p+=` L ${(f+(zM(e)-.5)*u).toFixed(1)} ${e}`;return p+=d?` L ${i+i*TM} 704 Z`:` L ${-i*TM} 704 Z`,{svg:`<path d="${p}" fill="${l}"/>`,alpha:s-c}},shapeStampede(e,t,n,r,i){let a=hM(n,e.swapWindow[0],e.swapWindow[1]),o=mM(e,r),s=e.params.iconRef||`coin`,c=Math.round((e.params.count||40)*a),l=BM(-i*TM,-640*TM,i*1.2,Y*1.2,o,a*a*.7);for(let e=0;e<c;e++){let t=i*zM(e+1),n=Y*zM(e*5+3),r=14+8*zM(e);l+=s===`star`?`<path transform="translate(${t.toFixed(0)} ${n.toFixed(0)})" d="M0 -${r} L${r*.3} -${r*.3} L${r} 0 L${r*.3} ${r*.3} L0 ${r} L-${r*.3} ${r*.3} L-${r} 0 L-${r*.3} -${r*.3} Z" fill="#f2b134"/>`:`<circle cx="${t.toFixed(0)}" cy="${n.toFixed(0)}" r="${r.toFixed(0)}" fill="#f2b134" stroke="${VM(o)}" stroke-width="2"/>`}return{svg:l,alpha:a}},typeMask(e,t,n,r,i){let a=hM(n,e.swapWindow[0],e.swapWindow[1]),o=mM(e,r),s=e.params.text||`NEXT`,c=e.direction===`R2L`?-1:1,l=i/2+c*(1-a)*i*.7;return{svg:BM(-i*TM,-640*TM,i*1.2,Y*1.2,o,a*a)+`<text x="${l.toFixed(1)}" y="${(Y*.62).toFixed(0)}" text-anchor="middle" font-family="Nunito,system-ui" font-weight="900" font-size="${(Y*.7*(.6+.4*a)).toFixed(0)}" fill="${o}">${s}</text>`,alpha:a}},silhouetteWalkWipe(e,t,n,r,i){let a=e.swapWindow[0],o=e.swapWindow[1],s=a>0?K(n/a,0,1):1,c=o<1?K((n-o)/(1-o),0,1):0,l=mM(e,r),u=(e.direction===`R2L`?-1:1)>0?-i*.4+s*i*1.4:i*1.4-s*i*1.4,d=i*.9;return{svg:(s>=1&&c<1?BM(-i*TM,-640*TM,i*1.2,Y*1.2,l,1-c):``)+`<g transform="translate(${u.toFixed(1)} 0)"><ellipse cx="0" cy="${Y*.28}" rx="${d*.28}" ry="${d*.3}" fill="${l}"/><rect x="${-d*.32}" y="${Y*.42}" width="${d*.64}" height="${Y*.7}" rx="${d*.2}" fill="${l}"/></g>`,alpha:wM(hM(n,a,o),s*.7)}},flashImpact(e,t,n,r,i){let a=hM(n,e.swapWindow[0],e.swapWindow[1]);return{svg:BM(-i*TM,-640*TM,i*1.2,Y*1.2,e.params.tint||`#ffffff`,a**.5),alpha:a}},dipToColor(e,t,n,r,i){let a=hM(n,e.swapWindow[0],e.swapWindow[1]);return{svg:BM(-i*TM,-640*TM,i*1.2,Y*1.2,e.params.color||e.colors[0]||mM(e,r),a),alpha:a}},silhouettePass(e,t,n,r,i){let a=hM(n,e.swapWindow[0],e.swapWindow[1]);return{svg:BM(-i*TM,-640*TM,i*1.2,Y*1.2,`#1b2230`,a),alpha:a}},dayNightSweep(e,t,n,r,i){let a=mM(e,r),o=e.swapWindow[0],s=e.swapWindow[1],c=o>0?K(n/o,0,1):1,l=s<1?K((n-s)/(1-s),0,1):0,u=l*i,d=c*i;return{svg:`<defs><linearGradient id="dns"><stop offset="0" stop-color="${a}"/><stop offset="1" stop-color="${cO(a,`#0a1020`,.5)}"/></linearGradient></defs>`+BM(u,-640*TM,d-u,Y*1.2,`url(#dns)`),alpha:c-l}},spotlightShift(e,t,n,r,i){let a=hM(n,e.swapWindow[0],e.swapWindow[1]),o=e.params.origin===`subject`&&r.subject?r.subject:{x:i/2,y:Y*.45},s=(1-a)*SM(i,Y)*.4+30;return{svg:`<defs><radialGradient id="sp" cx="${(o.x/i).toFixed(3)}" cy="${(o.y/Y).toFixed(3)}" r="${(s/i+.001).toFixed(3)}" gradientUnits="userSpaceOnUse" fx="${o.x}" fy="${o.y}" r="${s}"><stop offset="0.7" stop-color="#000" stop-opacity="0"/><stop offset="1" stop-color="#050810" stop-opacity="${(.4+.6*a).toFixed(2)}"/></radialGradient></defs><rect x="${-i*TM}" y="${-640*TM}" width="${i*1.2}" height="${Y*1.2}" fill="#050810" opacity="${(a*a).toFixed(2)}"/>`,alpha:a}},matchMorph(e,t,n,r,i){let a=hM(n,e.swapWindow[0],e.swapWindow[1]),o=mM(e,r),s=i/2,c=Y/2,l=40+a*SM(i,Y)*.55,u=a>.5?l*(1-(a-.5)*1.2):l;return{svg:`<rect x="${(s-l).toFixed(1)}" y="${(c-l).toFixed(1)}" width="${(2*l).toFixed(1)}" height="${(2*l).toFixed(1)}" rx="${Math.max(0,u).toFixed(1)}" fill="${o}"/>`,alpha:a}},pixelMosaic(e,t,n,r,i){let a=mM(e,r),o=K(e.params.blockPx||48,20,120),s=Math.ceil(i/o),c=Math.ceil(Y/o),l=hM(n,e.swapWindow[0],e.swapWindow[1]),u=``,d=1;for(let e=0;e<c;e++)for(let t=0;t<s;t++){let n=zM(t*3+e*7+1),r=+(l*1.5-n*.5>=.5);d=CM(d,l>=.99?1:r),r&&(u+=BM(t*o,e*o,o+1,o+1,a))}return{svg:u,alpha:l}},lineArtRebuild(e,t,n,r,i){let a=hM(n,e.swapWindow[0],e.swapWindow[1]),o=mM(e,r),s=e.params.strokeColor||`#243038`,c=BM(-i*TM,-640*TM,i*1.2,Y*1.2,o,a*a);for(let e=0;e<8;e++){let t=Y*(e+.5)/8,n=i*a;c+=`<line x1="0" y1="${t.toFixed(1)}" x2="${n.toFixed(1)}" y2="${t.toFixed(1)}" stroke="${s}" stroke-width="2" opacity="${(.5+.5*(1-a)).toFixed(2)}"/>`}return{svg:c,alpha:a}},ripplePortal(e,t,n,r,i){let a=hM(n,e.swapWindow[0],e.swapWindow[1]),o=mM(e,r),s=e.params.origin&&r.subject?r.subject:{x:i/2,y:Y/2},c=K(e.params.rings||5,2,8),l=`<circle cx="${s.x}" cy="${s.y}" r="${(a*SM(i,Y)*.6).toFixed(1)}" fill="${o}"/>`;for(let e=0;e<c;e++){let t=a*SM(i,Y)*.6+e*26;l+=`<circle cx="${s.x}" cy="${s.y}" r="${t.toFixed(1)}" fill="none" stroke="${cO(o,`#fff`,.3)}" stroke-width="3" opacity="${(.6*(1-a)).toFixed(2)}"/>`}return{svg:l,alpha:a}},doorPass(e,t,n,r,i){let a=e.swapWindow[0],o=e.swapWindow[1],s=a>0?K(n/a,0,1):1,c=o<1?K((n-o)/(1-o),0,1):0,l=mM(e,r);i/2*(1-c)*s;let u=i/2*c;return{svg:BM(-i*TM,-640*TM,i/2*s+i*TM-u,Y*1.2,l)+BM(i/2+u,-640*TM,i/2*s+i*TM-u,Y*1.2,l),alpha:s-c}},waveCrash(e,t,n,r,i){let a=e.swapWindow[0],o=e.swapWindow[1],s=a>0?K(n/a,0,1):1,c=o<1?K((n-o)/(1-o),0,1):0,l=cO(mM(e,r),`#2b6cb0`,.5),u=s*760-60,d=c*760-60,f=`M ${-i*TM} ${d.toFixed(1)}`;for(let e=0;e<=i;e+=40)f+=` L ${e} ${(u+yM(e/i*6+n*6)*26).toFixed(1)}`;f+=` L ${i+i*TM} ${d.toFixed(1)} Z`;let p=e.params.foam===!1?``:`<path d="${f.replace(/Z$/,``)}" fill="none" stroke="#eaf4ff" stroke-width="6" opacity="0.6"/>`;return{svg:`<path d="${f}" fill="${l}"/>${p}`,alpha:s-c}},pageFlip(e,t,n,r,i){let a=hM(n,e.swapWindow[0],e.swapWindow[1]),o=mM(e,r),s=a*(i+Y);return{svg:`<path d="M ${i} 0 L ${(i-s).toFixed(1)} 0 L ${i} ${s.toFixed(1)} Z" fill="${o}"/><path d="M ${(i-s).toFixed(1)} 0 L ${i} ${s.toFixed(1)} L ${(i-s*.7).toFixed(1)} ${(s*.7).toFixed(1)} Z" fill="${cO(o,`#fff`,.25)}"/>`,alpha:a}},lightSpeedStreak(e,t,n,r,i){let a=hM(n,e.swapWindow[0],e.swapWindow[1]),o=e.params.streakColor||`#bcd4ff`,s=i/2,c=Y/2,l=BM(-i*TM,-640*TM,i*1.2,Y*1.2,`#050813`,a*a);for(let e=0;e<40;e++){let t=zM(e+1)*2*xM,n=20+zM(e)*40,r=n+a*SM(i,Y)*.7;l+=`<line x1="${(s+bM(t)*n).toFixed(1)}" y1="${(c+yM(t)*n).toFixed(1)}" x2="${(s+bM(t)*r).toFixed(1)}" y2="${(c+yM(t)*r).toFixed(1)}" stroke="${o}" stroke-width="2" opacity="${(.4+.6*a).toFixed(2)}"/>`}return{svg:l,alpha:a}},glitchCut(e,t,n,r,i){let a=hM(n,e.swapWindow[0],e.swapWindow[1]),o=e.params.intensity||1,s=(zM(Math.floor(n*30))-.5)*20*o,c=BM(-i*TM,-640*TM,i*1.2,Y*1.2,mM(e,r),a*(.4+.6*zM(Math.floor(n*40))));for(let e=0;e<6;e++){let t=Y*zM(e*3+1),n=8+30*zM(e);c+=BM(s,t,i,n,e%2?`#ff2d6a`:`#2dffea`,.35*a)}return{svg:c,alpha:a}}}),VM=e=>cO(e,`#000`,.4),HM={carryTravel:(e,t,n,r)=>({fromT:`translate(${(-t*e*n).toFixed(1)} 0)`,toT:`translate(${(t*(1-e)*n).toFixed(1)} 0)`}),pushOff:(e,t,n,r)=>({fromT:`translate(${(-t*e*n).toFixed(1)} 0)`,toT:`translate(${(t*(1-e)*n).toFixed(1)} 0)`}),slideOver:(e,t,n,r)=>({fromT:``,toT:`translate(${(t*(1-e)*n).toFixed(1)} 0)`,over:!0}),whipPan:(e,t,n,r,i)=>({fromT:`translate(${(-t*e*n*1.25).toFixed(1)} 0)`,toT:`translate(${(t*(1-e)*n*1.25).toFixed(1)} 0)`,blur:yM(e*xM)*(i.blurPx||9)}),spinCard:(e,t,n,r)=>{let i=bM(e*xM);return{fromT:`translate(${n/2} ${r/2}) scale(${e<.5?Math.max(.001,i).toFixed(3):.001} 1) translate(${-n/2} ${-r/2})`,toT:`translate(${n/2} ${r/2}) scale(${e>=.5?Math.max(.001,-i).toFixed(3):.001} 1) translate(${-n/2} ${-r/2})`,flip:!0}},zoomThrough:(e,t,n,r,i,a)=>{let o=a?a.x:n/2,s=a?a.y:r*.42;return{fromT:`translate(${o} ${s}) scale(${(1+e*5).toFixed(3)}) translate(${-o} ${-s})`,toT:`translate(${n/2} ${r/2}) scale(${(.15+.85*e).toFixed(3)}) translate(${-n/2} ${-r/2})`,flip:!0}},pullBackReveal:(e,t,n,r)=>({fromT:`translate(${n/2} ${r/2}) scale(${(1-e*.86).toFixed(3)}) translate(${-n/2} ${-r/2})`,toT:`translate(${n/2} ${r/2}) scale(${(1.7-.7*e).toFixed(3)}) translate(${-n/2} ${-r/2})`,flip:!0}),elevatorRise:(e,t,n,r)=>({fromT:`translate(0 ${(t*e*r).toFixed(1)})`,toT:`translate(0 ${(t*(1-e)*r-t*r).toFixed(1)})`}),stackShuffle:(e,t,n,r,i)=>({fromT:`translate(${(t*e*n).toFixed(1)} ${(e*40).toFixed(1)}) rotate(${(t*e*4).toFixed(1)} ${n/2} 200)`,toT:``,shadow:i.cardShadow!==!1}),splitBarn:(e,t,n,r,i)=>({split:e,axis:i.axis||`v`})}}));function WM(e){e=K(e,0,1);for(let t=0;t<KM.length-1;t++)if(e<=KM[t+1]){let n=(e-KM[t])/(KM[t+1]-KM[t]);return lO(qM[t],qM[t+1],n)}return qM[qM.length-1]}function GM(e,t){return t===`2d`?{scale:1,yShift:0,opacity:1,blur:0,w:WM(.5)}:{scale:JM(e),yShift:YM(e),opacity:XM(e),blur:ZM(e),w:WM(e)}}var KM,qM,JM,YM,XM,ZM,QM=o((()=>{pO(),KM=[0,.25,.5,.75,1],qM=[1.45,1.28,1,.24,.15],JM=e=>1+(.5-e)*.72,YM=e=>-(e-.5)*165,XM=e=>1-K(e-.42,0,.58)*.78,ZM=e=>K(e-.55,0,.45)*6}));function $M(e,t){let n=t/2/Math.max(.001,e.zoom);return n>=t/2?{...e,cx:t/2}:{...e,cx:K(e.cx,n,t-n)}}function eN(e,t,n,r,i){let a=i*i,o=a*i;return .5*(2*t+(-e+n)*i+(2*e-5*t+4*n-r)*a+(-e+3*t-3*n+r)*o)}function tN(e,t){if(e.length===1)return e[0];let n=K(Math.floor(t),0,e.length-2),r=t-n,i=e[Math.max(0,n-1)],a=e[n],o=e[n+1],s=e[Math.min(e.length-1,n+2)];return eN(i,a,o,s,r)}function nN(e,t,n,r,i,a,o){let s=pN[o]||pN.editorial,c=t.zoom;if(e===`locked`)return{...t};if(e===`drift`)return{cx:t.cx+40*s.amp*Math.sin(n*.25*s.speed),cy:t.cy,zoom:c};let l=oO(i+`:cam`),u=a&&a.length?a:[{rigX:t.cx}],d=[t.cx],f=[c],p=Math.max(3,Math.min(6,u.length+2));for(let e=0;e<p;e++){let e=u[Math.floor(l()*u.length)];d.push(t.cx+(e.rigX-t.cx)*s.amp+(l()-.5)*60*s.amp),f.push(c+l()*.08*s.amp)}d.push(t.cx),f.push(c);let m=n/Math.max(.001,r)*(d.length-1)*s.speed%(d.length-1);return{cx:tN(d,m),cy:t.cy-6,zoom:tN(f,m)}}function rN(e,t){let n=fN(t.VBW,t.frame),r=(e||[]).find(e=>e.idle)||{idle:`focusFlow`},i=[],a=n,o=(e||[]).filter(e=>e.directive&&(e.atPhrase!=null||e.atMs!=null)).map(e=>({d:e,t:e.atMs==null?t.phrases[e.atPhrase].t:e.atMs/1e3})).sort((e,t)=>e.t-t.t),s=t.frame&&t.frame.cy>350;return o.forEach((e,r)=>{let c=e.d,l=e.t,u=r+1<o.length?o[r+1].t:t.sceneT1,d=(c.ms||(c.directive===`snapZoom`?280:c.directive===`punchTo`?620:1100))/1e3,f=lN[c.ease]||(s?fO:dO),p=(c.hold||0)/1e3,m=a,h={...n};if(c.directive===`panTo`){let e=t.resolveTarget(c.target);h={cx:e.x+(c.offset&&c.offset.x||0),cy:e.y+(c.offset&&c.offset.y||0),zoom:c.zoom||1.3}}else if(c.directive===`punchTo`){let e=t.resolveTarget(c.target);h={cx:e.x+(c.offset&&c.offset.x||0),cy:e.y+(c.offset&&c.offset.y||0),zoom:c.zoom||1.55}}else if(c.directive===`snapZoom`){let e=t.resolveTarget(c.target);h={cx:e.x+(c.offset&&c.offset.x||0),cy:e.y+(c.offset&&c.offset.y||0),zoom:c.zoom||1.75}}else if(c.directive===`orbitLite`){let e=t.resolveTarget(c.target);h={cx:e.x,cy:e.y,zoom:c.zoom||1.2}}else if(c.directive===`zoomOut`||c.directive===`establish`)h=fN(t.VBW,t.frame);else if(c.directive===`follow`)h=m;else if(c.directive===`travel`)h={cx:m.cx+(c.viewportWidths||1)*t.VBW*.6,cy:m.cy,zoom:c.zoom||m.zoom||1};else if(c.directive===`hop`){let e=t.resolveTarget((c.targets||[])[0]);e&&(h={cx:e.x,cy:e.y,zoom:c.zoom||1.3})}i.push({d:c,t0:l,tNext:u,ms:d,ease:f,hold:p,from:m,to:h}),a=c.then===`return`?n:h}),{base:n,idle:r,shots:i}}function iN(e,t,n){n={...n,frame:n.frame||dN(e)};let r=rN(e.camera,n),i=null;for(let e of r.shots)t>=e.t0-1e-9&&t<e.tNext&&(i=e);let a;if(i){let e=i.d,o=t-i.t0;if(i._dir=e.directive,e.directive===`follow`){let t=n.resolveTarget(e.target),i=K(e.tightness==null?.6:e.tightness,.05,1),o=e.leadRoom?40:0;a={cx:lO(r.base.cx,t.x+o,i),cy:r.base.cy,zoom:e.zoom||1.15,active:!0}}else if(e.directive===`hop`&&e.targets&&e.targets.length){let t=(e.dwell||900)/1e3,r=e.targets.length*t,i=K(Math.floor(o%r/t),0,e.targets.length-1),s=(o%r-i*t)/t,c=n.resolveTarget(e.targets[i]),l=n.resolveTarget(e.targets[Math.min(i+1,e.targets.length-1)]),u=dO(K(s*2,0,1));a={cx:lO(c.x,l.x,u),cy:lO(c.y,l.y,u),zoom:e.zoom||1.3,active:!0}}else if(e.directive===`orbitLite`){let t=n.resolveTarget(e.target),i=(e.deg||8)/8*n.VBW*.06,s=Math.sin(o*(e.speed||.8));a={cx:t.x+s*i,cy:r.base.cy,zoom:e.zoom||1.2,active:!0}}else{let t=i.ease(K(o/i.ms,0,1)),n=lO(i.from.cx,i.to.cx,t),s=lO(i.from.cy,i.to.cy,t),c=lO(i.from.zoom,i.to.zoom,t);if(e.then===`return`){let e=i.tNext-i.t0,t=Math.min(i.ms,e*.5),a=Math.max(i.ms,e-t);if(o>=a){let e=i.ease(K((o-a)/t,0,1));n=lO(i.to.cx,r.base.cx,e),s=lO(i.to.cy,r.base.cy,e),c=lO(i.to.zoom,r.base.zoom,e)}}a={cx:n,cy:s,zoom:c,active:!0},e.directive===`snapZoom`&&(a.whip=K(1-o/.28,0,1))}}else{let e=r.base;for(let n of r.shots)t>=n.t0&&(e=n.d.then===`return`?r.base:n.to);a={...nN(r.idle.idle||`focusFlow`,e,t-n.sceneT0,n.sceneT1-n.sceneT0,n.seed,n.cast,r.idle.stylePreset),active:!1}}return a.directive=i?i.d.directive:`idle`,$M(a,n.VBW)}function aN(e,t){let n=rN(e.camera,t),r=new Set(n.shots.map(e=>e.d.directive)),i=n.shots.map(e=>e.to.zoom).concat([1]),a=Math.max(...i)-Math.min(...i);return K(r.size*.22+n.shots.length*.1+a*.6,0,1)}function oN(e,t){let n=e.rotation?` rotate(${(-e.rotation).toFixed(3)})`:``;return`translate(${(t/2).toFixed(2)} 300)${n} scale(${e.zoom.toFixed(4)}) translate(${(-e.cx).toFixed(2)} ${(-e.cy+300).toFixed(2)})`}function sN(e,t){return{pan:(t/2-e.cx)*(960/t),scale:e.zoom-1}}function cN(e,t){let n=rN(e.camera,t),r=Math.max(.001,t.sceneT1-t.sceneT0),i=0;return n.shots.forEach(e=>{let t=Math.min(e.tNext,e.t0+e.ms+e.hold);i+=Math.max(0,t-e.t0)}),K(i/r,0,1)}var lN,uN,dN,fN,pN,mN=o((()=>{pO(),lN={linear:uO,smooth:dO,smoother:fO},uN={default:{cy:300,zoom:1},warfilm:{cy:560,zoom:1}},dN=e=>{let t=null;return(e&&e.camera||[]).forEach(e=>{e.stylePreset&&(t=e.stylePreset)}),uN[t]||uN.default},fN=(e,t=uN.default)=>({cx:e/2,cy:t.cy,zoom:t.zoom}),pN={editorial:{amp:1,zoom:1.06,speed:1},energetic:{amp:1.7,zoom:1.13,speed:1.6},calm:{amp:.5,zoom:1.03,speed:.6},doc:{amp:.8,zoom:1.05,speed:.8},documentary:{amp:.8,zoom:1.05,speed:.8},dramatic:{amp:1.2,zoom:1.18,speed:.7},warfilm:{amp:1.5,zoom:1.02,speed:1.4}}}));function hN(e,t,n){let r=wN[e.type];return r?r(e,K(t,0,1),n):``}var gN,_N,vN,yN,bN,xN,SN,CN,X,wN,TN,EN,DN=o((()=>{pO(),gN=`#243038`,_N=`#2BB3A3`,vN=`#FF6B5E`,yN=`#8794a0`,bN=`#F2B134`,xN=`#5B6CE0`,SN=(e,t,n=`#fff`)=>`<rect x="${-e/2}" y="${-t/2}" width="${e}" height="${t}" rx="${t/2}" fill="${n}" stroke="rgba(20,40,50,.08)"/>`,CN=(e,t)=>`<rect x="${-e/2}" y="${-t/2}" width="${e}" height="${t}" rx="14" fill="#fff" stroke="rgba(20,40,50,.08)"/>`,X=(e,t,n,r,i=gN,a=800,o=`middle`)=>`<text x="${e}" y="${t}" font-family="Nunito,system-ui,sans-serif" font-size="${n}" font-weight="${a}" text-anchor="${o}" fill="${i}">${r}</text>`,wN={counter(e,t){let n=fO(t),r=e.value==null?0:e.value,i=(Number.isInteger(r)?Math.round(r*n):(r*n).toFixed(1))+(e.unit||``);return e.variant===`chip`?`${SN(Math.max(90,i.length*22+40),56)}${X(0,9,30,(e.label?e.label+` `:``)+i,gN,900)}`:`${X(0,6,62,i,_N,900)}${e.label?X(0,40,20,e.label,yN,800):``}`},proportionFill(e,t){let n=K(e.value||0,0,100),r=n/100*260*fO(t);return`${CN(296,74)}${e.label?X(0,-18,20,e.label,gN,800):``}<rect x="-130" y="2" width="260" height="18" rx="9" fill="#e7edf1"/><rect x="-130" y="2" width="${r}" height="18" rx="9" fill="${_N}"/>${X(134,17,18,Math.round(n*fO(t))+`%`,gN,900,800,`start`)}`},barsCompare(e,t){let n=e.values||[40,70,55],r=e.labels||[],i=[_N,xN,vN,bN],a=Math.max(...n,1),o=n.length*60,s=fO(t),c=n.map((e,t)=>{let n=e/a*120*s,c=-o/2+t*60+10;return`<rect x="${c}" y="${-n}" width="40" height="${n}" rx="6" fill="${i[t%4]}"/>${r[t]?X(c+20,22,15,r[t],yN,800):``}`}).join(``);return`<line x1="${-o/2-6}" y1="0" x2="${o/2+6}" y2="0" stroke="#d7dee3" stroke-width="2"/>${c}`},trendLine(e,t){let n=e.points||[30,42,38,58,74,68,90],r=fO(t),i=n.length,a=Math.max(...n,1),o=n.map((e,t)=>[-130+t/(i-1)*260,-(e/a)*90]),s=Math.max(2,Math.round(2+(i-2)*r)),c=o.slice(0,s).map((e,t)=>(t?`L`:`M`)+e[0].toFixed(1)+` `+e[1].toFixed(1)).join(` `),l=o[s-1];return`${CN(300,150)}<polyline points="${o.map(e=>e.join(`,`)).join(` `)}" fill="none" stroke="#e7edf1" stroke-width="2"/><path d="${c}" fill="none" stroke="${_N}" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><circle cx="${l[0].toFixed(1)}" cy="${l[1].toFixed(1)}" r="5" fill="${_N}"/>${e.label?X(0,67,18,e.label,gN,800):``}`},labelChip(e,t){let n=.6+.4*fO(t),r=(e.text||`label`).length*12+34;return`<g transform="scale(${n})" opacity="${t.toFixed(2)}">${SN(r,44,e.tone===`accent`?vN:`#fff`)}${X(0,7,20,e.text||`label`,e.tone===`accent`?`#fff`:gN,900)}</g>`},mapLite(e,t){let n=(1-fO(t))*40;return`<path d="M-70 20 Q-80 -30 -30 -40 Q10 -60 50 -34 Q86 -20 70 20 Q30 44 -20 40 Q-56 40 -70 20 Z" fill="#cfe3d3" stroke="#a9c6ad" stroke-width="2"/><g transform="translate(${e.px||20} ${-10-n})" opacity="${K(t*1.4,0,1).toFixed(2)}"><path d="M0 0 C-14 -18 -10 -34 0 -34 C10 -34 14 -18 0 0 Z" fill="${vN}"/><circle cx="0" cy="-24" r="5" fill="#fff"/></g>`},timelineStrip(e,t){let n=e.count||5,r=fO(t),i=Math.round(n*r),a=`<line x1="-130" y1="0" x2="130" y2="0" stroke="#d7dee3" stroke-width="3"/><line x1="-130" y1="0" x2="${-130+260*r}" y2="0" stroke="${_N}" stroke-width="3"/>`;for(let e=0;e<n;e++){let t=-130+e/(n-1)*260;a+=`<circle cx="${t}" cy="0" r="7" fill="${e<i?_N:`#e7edf1`}" stroke="#fff" stroke-width="2"/>`}return a},iconBurst(e,t){let n=fO(t),r=``;for(let e=0;e<8;e++){let t=e/8*Math.PI*2,i=20+34*n;r+=`<circle cx="${(Math.cos(t)*i).toFixed(1)}" cy="${(Math.sin(t)*i).toFixed(1)}" r="${(5*n+2).toFixed(1)}" fill="${[_N,bN,vN,xN][e%4]}" opacity="${(1-n*.5).toFixed(2)}"/>`}return`<circle cx="0" cy="0" r="16" fill="${bN}"/>${r}`},gauge(e,t){let n=K(e.value||0,0,100),r=fO(t),i=Math.PI,a=Math.PI-n/100*Math.PI*r,o=(e,t,n,r)=>{let i=Math.cos(e)*70,a=-Math.sin(e)*70,o=Math.cos(t)*70,s=-Math.sin(t)*70;return`<path d="M${i.toFixed(1)} ${a.toFixed(1)} A70 70 0 0 1 ${o.toFixed(1)} ${s.toFixed(1)}" fill="none" stroke="${n}" stroke-width="${r}" stroke-linecap="round"/>`};return`${o(i,0,`#e7edf1`,14)}${o(i,a,_N,14)}${X(0,-6,40,Math.round(n*r)+(e.unit||``),gN,900)}${e.label?X(0,24,18,e.label,yN,800):``}`},quoteCard(e,t){return`<g opacity="${t.toFixed(2)}">${CN(300,110)}${X(-132,-15,44,`“`,_N,900,800,`start`)}<foreignObject x="-110" y="-41" width="240" height="86"><div xmlns="http://www.w3.org/1999/xhtml" style="font:800 17px Nunito,system-ui;color:${gN};line-height:1.25">${e.text||``}</div></foreignObject></g>`},xOut(e,t){let n=fO(t);return`<circle cx="0" cy="0" r="34" fill="none" stroke="${vN}" stroke-width="6"/><line x1="${-34*.7*n}" y1="${-34*.7*n}" x2="${34*.7*n}" y2="${34*.7*n}" stroke="${vN}" stroke-width="7" stroke-linecap="round"/><line x1="${34*.7*n}" y1="${-34*.7*n}" x2="${-34*.7*n}" y2="${34*.7*n}" stroke="${vN}" stroke-width="7" stroke-linecap="round"/>`},connectionLink(e,t){let n=-110+220*fO(t);return`<circle cx="-110" cy="0" r="9" fill="${_N}"/><line x1="-110" y1="0" x2="${n}" y2="0" stroke="${_N}" stroke-width="4" stroke-dasharray="2 8" stroke-linecap="round"/><circle cx="110" cy="0" r="9" fill="${t>.9?_N:`#e7edf1`}"/>`},morph(e,t){return`<rect x="-40" y="-40" width="80" height="80" rx="${(40-32*fO(t)).toFixed(1)}" fill="${_N}"/>`},pieSlice(e,t){let n=K(e.value==null?60:e.value,0,100)/100*fO(t),r=n*2*Math.PI,i=Math.sin(r)*40,a=-Math.cos(r)*40;return`<circle cx="0" cy="0" r="40" fill="#e7edf1"/><path d="M0 0 L0 -40 A40 40 0 ${+(n>.5)} 1 ${i.toFixed(1)} ${a.toFixed(1)} Z" fill="${_N}"/>${X(0,6,20,Math.round(n*100)+`%`,gN,900)}`},statCallout(e,t){let n=e.value==null?``:Math.round(e.value*fO(t));return`${X(0,-2,52,n+(e.unit||``),_N,900)}${e.label?X(0,30,18,e.label,yN,800):``}`},checklist(e,t){let n=e.count||3,r=Math.round(n*fO(t)),i=``;for(let t=0;t<n;t++){let a=-n*15+t*30;i+=`<rect x="-96" y="${a-13}" width="192" height="26" rx="7" fill="#fff" stroke="rgba(20,40,50,.08)"/><circle cx="-78" cy="${a}" r="9" fill="${t<r?_N:`#e7edf1`}"/>${t<r?`<path d="M-82 ${a} l3 4 l7 -8" stroke="#fff" stroke-width="2.5" fill="none"/>`:``}${X(-60,a+5,15,e.labels&&e.labels[t]||`item `+(t+1),gN,800,800,`start`)}`}return i},arrow(e,t){let n=fO(t),r=-70+140*n;return`<line x1="-70" y1="0" x2="${r.toFixed(1)}" y2="0" stroke="${vN}" stroke-width="6" stroke-linecap="round"/><path d="M${r.toFixed(1)} 0 l-14 -9 M${r.toFixed(1)} 0 l-14 9" stroke="${vN}" stroke-width="6" fill="none" stroke-linecap="round" opacity="${n.toFixed(2)}"/>`},highlightRing(e,t){return`<circle cx="0" cy="0" r="${(30+8*Math.sin(t*Math.PI)).toFixed(1)}" fill="none" stroke="${bN}" stroke-width="5"/>`},badge(e,t){return`<g transform="scale(${(.7+.3*fO(t)).toFixed(2)})"><path d="M0 -44 L38 -30 L38 6 Q38 34 0 46 Q-38 34 -38 6 L-38 -30 Z" fill="${_N}"/>${X(0,6,22,e.text||`A+`,`#fff`,900)}</g>`},ratingStars(e,t){let n=K(e.value==null?4:e.value,0,5)*fO(t),r=(e,t)=>`<path transform="translate(${e} 0) scale(0.85)" d="M0 -16 L5 -5 L17 -4 L8 4 L11 16 L0 9 L-11 16 L-8 4 L-17 -4 L-5 -5 Z" fill="${t}"/>`,i=``;for(let e=0;e<5;e++)i+=r(-88+e*44,e<n?bN:`#e7edf1`);return i},deltaBadge(e,t){let n=(e.value||0)>=0,r=Math.abs(Math.round((e.value||0)*fO(t)));return`${SN(130,52,n?`#e6f7f0`:`#fdecea`)}${X(-32,8,24,n?`▲`:`▼`,n?_N:vN,900)}${X(20,8,24,r+(e.unit||``),n?_N:vN,900)}`},keyValue(e,t){return`${CN(230,60)}${X(-100,7,18,e.label||`key`,yN,800,800,`start`)}${X(100,7,22,(e.text==null?e.value||``:e.text)+(e.unit||``),gN,900,800,`end`)}`},progressRing(e,t){let n=K(e.value||0,0,100)/100*fO(t),r=2*Math.PI*40;return`<circle cx="0" cy="0" r="40" fill="none" stroke="#e7edf1" stroke-width="10"/><circle cx="0" cy="0" r="40" fill="none" stroke="${_N}" stroke-width="10" stroke-linecap="round" stroke-dasharray="${r.toFixed(1)}" stroke-dashoffset="${(r*(1-n)).toFixed(1)}" transform="rotate(-90)"/>${X(0,7,24,Math.round(n*100)+`%`,gN,900)}`},flowStep(e,t){let n=Math.min(2,Math.floor(fO(t)*3)),r=``;for(let t=0;t<3;t++){let i=-100+t*100;r+=`<rect x="${i-34}" y="-22" width="68" height="44" rx="8" fill="${t<=n?_N:`#e7edf1`}"/>${X(i,7,16,e.labels&&e.labels[t]||`step `+(t+1),t<=n?`#fff`:yN,800)}${t<2?`<path d="M${i+40} 0 l16 0 M${i+52} -5 l6 5 l-6 5" stroke="#c7d0d6" stroke-width="3" fill="none"/>`:``}`}return r},tally(e,t){let n=Math.round((e.value||7)*fO(t)),r=``;for(let e=0;e<n;e++){let t=Math.floor(e/5),n=e%5,i=-90+t*46+n*8;r+=n===4?`<line x1="${i-34}" y1="-16" x2="${i-2}" y2="16" stroke="${gN}" stroke-width="3"/>`:`<line x1="${i}" y1="-16" x2="${i}" y2="16" stroke="${gN}" stroke-width="3"/>`}return r},thermometer(e,t){let n=K(e.value||0,0,100)/100*fO(t);return`<rect x="-12" y="-110" width="24" height="110" rx="12" fill="#e7edf1"/><rect x="-12" y="${(-110*n).toFixed(1)}" width="24" height="${(110*n).toFixed(1)}" rx="12" fill="${vN}"/><circle cx="0" cy="14" r="18" fill="${vN}"/>${X(30,-110*n+6,18,Math.round(n*100)+`%`,gN,900,800,`start`)}`},sparkbars(e,t){let n=e.points||[3,6,4,8,5,9,7],r=fO(t),i=Math.max(...n,1),a=``;return n.forEach((e,t)=>{let o=e/i*60*r,s=-n.length*15/2+t*15;a+=`<rect x="${s}" y="${-o}" width="12" height="${o}" rx="3" fill="${_N}"/>`}),a},ribbon(e,t){return`<g transform="scale(${(.7+.3*fO(t)).toFixed(2)})"><circle cx="0" cy="-20" r="26" fill="${bN}"/><circle cx="0" cy="-20" r="18" fill="#fff" opacity=".85"/>${X(0,-13,22,e.text||`1`,gN,900)}<path d="M-14 0 L-20 40 L-6 30 L0 42 L6 30 L20 40 L14 0 Z" fill="${vN}"/></g>`},calloutBox(e,t){return`<g opacity="${t.toFixed(2)}">${CN(220,70)}<path d="M-14 35 l14 18 l14 -18 Z" fill="#fff"/>${X(0,6,18,e.text||``,gN,800)}</g>`},comparisonBar(e,t){let n=K(e.value==null?60:e.value,0,100),r=fO(t),i=n/100*260*r;return`<rect x="-130" y="-12" width="260" height="24" rx="12" fill="${xN}"/><rect x="-130" y="-12" width="${i.toFixed(1)}" height="24" rx="12" fill="${_N}"/>${X(-122,7,16,Math.round(n*r)+`%`,`#fff`,900,800,`start`)}${X(122,7,16,100-Math.round(n*r)+`%`,`#fff`,900,800,`end`)}`}},wN.highlightRegion=function(e,t,n){let r=fO(t),i=e.tint||bN,a=(26+18*(.5+.5*Math.sin((n||0)*3)))*r,o=e.label?`<g transform="translate(0 -50)">${SN(e.label.length*12+30,38)}${X(0,6,18,e.label,gN,900)}</g>`:``;return`<circle r="${a.toFixed(1)}" fill="none" stroke="${i}" stroke-width="3" opacity="${(.7*r).toFixed(2)}"/><circle r="${(12*r).toFixed(1)}" fill="${i}" opacity="0.9"/>${o}`},wN.sweepArrow=function(e,t){let n=e.bx==null?160:e.bx,r=e.by==null?-60:e.by,i=fO(t),a=e.tint||vN,o=n*.5,s=Math.min(0,r)-90,c=2*(1-i)*i*o+i*i*n,l=2*(1-i)*i*s+i*i*r,u=`<path d="M 0 0 Q ${o.toFixed(1)} ${s.toFixed(1)} ${c.toFixed(1)} ${l.toFixed(1)}" fill="none" stroke="${a}" stroke-width="5" stroke-linecap="round"/>`,d=``;if(i>.82){let e=Math.atan2(l-s,c-o);d=`<path d="M ${c.toFixed(1)} ${l.toFixed(1)} L ${(c+Math.cos(e+2.6)*18).toFixed(1)} ${(l+Math.sin(e+2.6)*18).toFixed(1)} M ${c.toFixed(1)} ${l.toFixed(1)} L ${(c+Math.cos(e-2.6)*18).toFixed(1)} ${(l+Math.sin(e-2.6)*18).toFixed(1)}" stroke="${a}" stroke-width="5" stroke-linecap="round" fill="none"/>`}return u+d},wN.dropPlate=function(e,t){let n=(1-fO(t))*-24,r=e.label||e.text||`REGION`,i=r.length*14+78;return`<g transform="translate(0 ${n.toFixed(1)})" opacity="${t.toFixed(2)}"><rect x="${(-i/2).toFixed(1)}" y="-26" width="${i.toFixed(1)}" height="52" rx="12" fill="#fff" stroke="rgba(20,40,50,.1)"/><circle cx="${(-i/2+28).toFixed(1)}" cy="0" r="16" fill="${e.tint||vN}"/><circle cx="${(-i/2+28).toFixed(1)}" cy="0" r="16" fill="none" stroke="rgba(0,0,0,.14)"/>${X((-i/2+52).toFixed(1),7,21,r,gN,900,800,`start`)}</g>`},wN.entrantPlate=function(e,t){let n=(1-fO(t))*-140,r=e.label||e.text||`ENTRANT`,i=r.length*20+116;return`<g transform="translate(${n.toFixed(1)} 0)" opacity="${t.toFixed(2)}"><rect x="${(-i/2).toFixed(1)}" y="-34" width="${i.toFixed(1)}" height="68" rx="14" fill="#1b2432" stroke="rgba(255,255,255,.14)"/><circle cx="${(-i/2+36).toFixed(1)}" cy="0" r="22" fill="${e.tint||vN}"/><circle cx="${(-i/2+36).toFixed(1)}" cy="0" r="22" fill="none" stroke="rgba(255,255,255,.22)"/>`+X((-i/2+68).toFixed(1),e.value==null?8:-4,26,r,`#fff`,900,800,`start`)+(e.value==null?``:X((-i/2+68).toFixed(1),20,15,e.value+(e.unit||``),`#9fb0c4`,800,800,`start`))+`</g>`},wN.vsCard=function(e,t){let n=fO(t),r=e.labels||[`A`,`B`],i=70*n,a=r[0].length*16+54,o=r[1].length*16+54;return`<g opacity="${t.toFixed(2)}"><g transform="translate(${(-70-i).toFixed(1)} 0)">${SN(a,62,`#dfeaf6`)}${X(0,8,24,r[0],gN,900)}</g><g transform="translate(${(70+i).toFixed(1)} 0)">${SN(o,62,`#f6e3df`)}${X(0,8,24,r[1],gN,900)}</g><circle r="26" fill="${vN}"/><circle r="26" fill="none" stroke="#fff" stroke-width="2"/>${X(0,9,24,`VS`,`#fff`,900)}</g>`},wN.rangeBand=function(e,t){let n=fO(t),r=e.min==null?0:e.min,i=e.max==null?100:e.max,a=K(e.value==null?(r+i)/2:e.value,r,i),o=-140+280*((a-r)/(i-r||1));return`${e.label?X(0,-30,20,e.label,gN,800):``}<rect x="-140" y="-8" width="280" height="16" rx="8" fill="#e7edf1"/><rect x="${(-50.39999999999999).toFixed(1)}" y="-8" width="${100.8.toFixed(1)}" height="16" rx="8" fill="#cdeee7"/><g transform="translate(${(-140+(o+140)*n).toFixed(1)} 0)"><line x1="0" y1="-20" x2="0" y2="20" stroke="${_N}" stroke-width="4" stroke-linecap="round"/><circle cx="0" cy="0" r="7" fill="${_N}"/></g>`+X(-140,34,14,``+r,yN,800)+X(140,34,14,``+i,yN,800,`middle`)+X(0,34,15,Math.round(a*n)+(e.unit||``),gN,900)},wN.podium=function(e,t){let n=fO(t),r=e.labels||[`1st`,`2nd`,`3rd`],i=e.values||[],a=r.map((e,t)=>({label:e,val:i[t]}));i.length&&(a=a.slice().sort((e,t)=>(t.val||0)-(e.val||0))),a=a.slice(0,3);let o=[1,0,2],s=[130,96,74],c=[bN,yN,`#c98b52`];return a.map((t,r)=>{let i=o[r],a=s[r]*n,l=-66+i*66,u=r+1;return`<rect x="${l}" y="${-a}" width="62" height="${a}" rx="6" fill="${c[r]}"/>${X(l+31,-a+30,26,``+u,`#fff`,900)}`+(t.label?X(l+31,24,14,t.label,gN,800):``)+(t.val==null?``:X(l+31,-a-10,16,t.val+(e.unit||``),gN,900))}).join(``)},wN.rankBadge=function(e,t){let n=.7+.3*fO(t),r=e.value==null?1:e.value,i=r===1?bN:r===2?`#b8c0c8`:r===3?`#c98b52`:_N;return`<g transform="scale(${n.toFixed(2)})"><circle cx="0" cy="0" r="34" fill="${i}"/><circle cx="0" cy="0" r="27" fill="#fff" opacity=".9"/>${X(0,3,30,`#`+r,gN,900)}<path d="M-16 26 L-22 58 L-8 48 L0 60 L8 48 L22 58 L16 26 Z" fill="${i}"/>${e.label?X(0,-46,16,e.label,yN,800):``}</g>`},wN.progressRail=function(e,t){let n=fO(t),r=e.count||(e.labels?e.labels.length:4),i=e.value==null?n:K(e.value,0,100)/100,a=-140+280*i,o=`<rect x="-140" y="-4" width="280" height="8" rx="4" fill="#e7edf1"/><rect x="-140" y="-4" width="${(280*i).toFixed(1)}" height="8" rx="4" fill="${_N}"/>`;for(let t=0;t<r;t++){let n=-140+t/(r-1)*280,i=n<=a+1;o+=`<circle cx="${n.toFixed(1)}" cy="0" r="6" fill="${i?_N:`#fff`}" stroke="${i?_N:`#d7dee3`}" stroke-width="2"/>${e.labels&&e.labels[t]?X(n,26,13,e.labels[t],i?gN:yN,800):``}`}return o+`<g transform="translate(${a.toFixed(1)} 0)"><circle cx="0" cy="0" r="11" fill="${_N}" stroke="#fff" stroke-width="3"/></g>`},wN.ticker=function(e,t,n){let r=(e.labels||[e.text||`BREAKING`]).join(` • `)+` • `,i=r.length*9.2,a=-((n||0)*70%i),o=e.label||`LIVE`;return`<clipPath id="tk"><rect x="-160" y="-20" width="320" height="40" rx="8"/></clipPath><rect x="-160" y="-20" width="320" height="40" rx="8" fill="#1b2432"/><g clip-path="url(#tk)"><text x="${(-148+a).toFixed(1)}" y="6" font-family="Nunito,system-ui" font-size="18" font-weight="800" fill="#fff">${r}${r}</text></g><rect x="-160" y="-20" width="74" height="40" rx="8" fill="${vN}"/>${X(-123,6,16,o,`#fff`,900)}<g opacity="${t.toFixed(2)}"></g>`},wN.scoreboard=function(e,t){let n=e.labels||[`HOME`,`AWAY`],r=e.values||[0,0],i=fO(t),a=Math.round(r[0]*i),o=Math.round(r[1]*i);return`<g opacity="${t.toFixed(2)}"><rect x="-150" y="-42" width="300" height="84" rx="12" fill="#1b2432"/><rect x="-150" y="-42" width="8" height="84" fill="${_N}"/><rect x="142" y="-42" width="8" height="84" fill="${vN}"/>`+X(-90,-12,18,n[0],`#9fb0c4`,900)+X(-90,24,40,``+a,`#fff`,900)+X(90,-12,18,n[1],`#9fb0c4`,900)+X(90,24,40,``+o,`#fff`,900)+`<line x1="0" y1="-30" x2="0" y2="30" stroke="rgba(255,255,255,.14)" stroke-width="2"/>`+(e.text?X(0,-8,16,e.text,bN,900):X(0,8,26,`:`,`#fff`,900))+`</g>`},wN.checkmark=function(e,t){let n=fO(t),r=46*(1-n);return`<circle cx="0" cy="0" r="30" fill="${_N}" opacity="${(.15+.85*n).toFixed(2)}"/><path d="M-14 1 l9 11 l19 -22" fill="none" stroke="#fff" stroke-width="6" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="46" stroke-dashoffset="${r.toFixed(1)}"/>${e.label?X(0,54,18,e.label,gN,900):``}`},wN.bracketSync=function(e,t){let n=fO(t),r=e.labels||[`Seed A`,`Seed B`,`Winner`],i=K(n*1.4,0,1),a=(e,t,n,r)=>`<g transform="translate(${e} ${t})">${SN(96,40,r?`#dfeff6`:`#fff`)}${X(0,6,16,n,gN,900)}</g>`;return a(-96,-40,r[0],!0)+a(-96,40,r[1],!0)+`<path d="M-48 -40 H-20 V40 H-48 M-20 0 H48" fill="none" stroke="${_N}" stroke-width="3" stroke-dasharray="220" stroke-dashoffset="${(220*(1-n)).toFixed(1)}"/><g opacity="${i.toFixed(2)}">${a(96,0,r[2],!0)}</g>`},wN.lowerThird=function(e,t){let n=(1-fO(t))*-260,r=e.text||`Name`,i=e.label||``,a=Math.max(r.length,i.length)*13+90;return`<g transform="translate(${n.toFixed(1)} 0)" opacity="${K(t*1.4,0,1).toFixed(2)}"><rect x="${-a/2}" y="-30" width="${a}" height="60" rx="8" fill="#1b2432"/><rect x="${-a/2}" y="-30" width="7" height="60" fill="${_N}"/>`+X(-a/2+22,-2,24,r,`#fff`,900,800,`start`)+(i?X(-a/2+22,20,15,i,_N,800,800,`start`):``)+`</g>`},wN.annotationArrow=function(e,t){let n=fO(t),r=e.dir||`up`,i={up:[0,-96],down:[0,96],left:[-120,0],right:[120,0]}[r]||[0,-96],a=i[0]*.6+(r===`up`||r===`down`?40:0),o=i[1]*.6+(r===`left`||r===`right`?-34:0),s=2*(1-n)*n*a+n*n*i[0],c=2*(1-n)*n*o+n*n*i[1],l=``;if(n>.85){let e=Math.atan2(c-o,s-a);l=`<path d="M${s.toFixed(1)} ${c.toFixed(1)} L${(s+Math.cos(e+2.6)*16).toFixed(1)} ${(c+Math.sin(e+2.6)*16).toFixed(1)} M${s.toFixed(1)} ${c.toFixed(1)} L${(s+Math.cos(e-2.6)*16).toFixed(1)} ${(c+Math.sin(e-2.6)*16).toFixed(1)}" stroke="${vN}" stroke-width="5" stroke-linecap="round" fill="none"/>`}let u=e.text?`<g transform="translate(${(-i[0]*.1).toFixed(1)} ${(-i[1]*.1).toFixed(1)})">${SN(e.text.length*11+28,38,`#fff`)}${X(0,6,17,e.text,gN,900)}</g>`:``;return`<path d="M0 0 Q${a.toFixed(1)} ${o.toFixed(1)} ${s.toFixed(1)} ${c.toFixed(1)}" fill="none" stroke="${vN}" stroke-width="5" stroke-linecap="round"/>${l}${u}`},wN.circleHighlight=function(e,t,n){let r=fO(t),i=e.value==null?52:e.value,a=i*.74,o=300*(1-r);return`<g transform="rotate(-8) scale(${(1+.02*Math.sin((n||0)*4)).toFixed(3)})"><path d="M${i} -6 C${i} ${-a*1.1} ${-i*.4} ${-a*1.25} ${-i} ${-a*.3} C${-i*1.3} ${a*.7} ${-i*.3} ${a*1.25} ${i*.5} ${a} C${i*1.25} ${a*.75} ${i*1.05} ${-a*.2} ${i*.9} ${-a*.9}" fill="none" stroke="${e.tint||bN}" stroke-width="5" stroke-linecap="round" stroke-dasharray="300" stroke-dashoffset="${o.toFixed(1)}"/></g>${e.label?X(0,a+30,18,e.label,gN,900):``}`},wN.floorPlanBoard=function(e,t){let n=(1-fO(t))*28,r=`<g transform="translate(${e.px==null?0:e.px} ${((e.py==null?-30:e.py)-20-n).toFixed(1)})" opacity="${K(t*1.4,0,1).toFixed(2)}"><path d="M0 0 C-13 -17 -9 -32 0 -32 C9 -32 13 -17 0 0 Z" fill="${e.tint||vN}"/><circle cx="0" cy="-22" r="5" fill="#fff"/></g>`,i=e.label?`<g transform="translate(0 -110)">${SN(e.label.length*12+28,38)}${X(0,6,18,e.label,gN,900)}</g>`:``;return`<g opacity="${t.toFixed(2)}"><rect x="-140" y="-90" width="280" height="180" rx="10" fill="#f4f7f8" stroke="#c7d3d9" stroke-width="3"/><line x1="0" y1="-90" x2="0" y2="50" stroke="#c7d3d9" stroke-width="3"/><line x1="-140" y1="10" x2="0" y2="10" stroke="#c7d3d9" stroke-width="3"/><line x1="0" y1="-20" x2="140" y2="-20" stroke="#c7d3d9" stroke-width="3"/><rect x="-8" y="86" width="16" height="8" fill="#f4f7f8" stroke="none"/>${i}</g>${r}`},wN.titleCard=function(e,t){return`<g transform="translate(0 ${((1-fO(t))*22).toFixed(1)})" opacity="${K(t*1.3,0,1).toFixed(2)}"><line x1="-290" y1="-56" x2="290" y2="-56" stroke="${_N}" stroke-width="3"/>`+X(0,6,62,e.text||`Title`,gN,900)+(e.label?X(0,52,24,e.label,yN,800):``)+`<line x1="-290" y1="86" x2="290" y2="86" stroke="${_N}" stroke-width="3"/></g>`},wN.chapterCard=function(e,t){let n=fO(t),r=K(n*1.2,0,1),i=e.value==null?1:e.value;return`<g opacity="${t.toFixed(2)}"><rect x="-280" y="-58" width="${(560*r).toFixed(1)}" height="116" rx="12" fill="#1b2432"/>`+X(-234,18,68,``+i,_N,900,800,`start`)+(r>.6?X(-160,-6,20,`CHAPTER`,`#9fb0c4`,900,800,`start`)+X(-160,26,30,e.text||``,`#fff`,900,800,`start`):``)+`</g>`},wN.ctaCard=function(e,t,n){let r=fO(t),i=1+.03*Math.sin((n||0)*4),a=Math.max(320,(e.text||`Get started`).length*20+120);return`<g transform="scale(${(r*i).toFixed(3)})" opacity="${t.toFixed(2)}">`+(e.label?X(0,-58,24,e.label,gN,800):``)+`<rect x="${-a/2}" y="-34" width="${a}" height="68" rx="34" fill="${vN}"/>${X(0,9,28,e.text||`Get started`,`#fff`,900)}<path d="M${a/2-44} -8 l16 8 l-16 8" stroke="#fff" stroke-width="4" fill="none" stroke-linecap="round" stroke-linejoin="round"/></g>`},wN.endCard=function(e,t){let n=fO(t);return`<g opacity="${K(t*1.3,0,1).toFixed(2)}"><circle cx="0" cy="-64" r="${(30*n).toFixed(1)}" fill="${_N}"/>${n>.5?`<path d="M-11 -64 l7 8 l14 -16" stroke="#fff" stroke-width="5" fill="none" stroke-linecap="round" stroke-linejoin="round"/>`:``}`+X(0,8,52,e.text||`The End`,gN,900)+(e.label?X(0,48,22,e.label,yN,800):``)+`<line x1="-220" y1="76" x2="220" y2="76" stroke="#e7edf1" stroke-width="2"/></g>`},wN.recapCarousel=function(e,t){let n=e.labels||[`One`,`Two`,`Three`],r=Math.min(n.length,4),i=fO(t),a=r*150+(r-1)*18,o=e.label?X(0,-96,24,e.label,gN,900):``;for(let e=0;e<r;e++){let t=K(i*r-e,0,1),s=-a/2+75+e*168,c=(1-t)*16;o+=`<g transform="translate(${s.toFixed(1)} ${c.toFixed(1)})" opacity="${t.toFixed(2)}"><rect x="-75" y="-56" width="150" height="112" rx="12" fill="#fff" stroke="rgba(20,40,50,.1)"/><circle cx="0" cy="-22" r="16" fill="${[_N,bN,vN,xN][e%4]}"/>${X(0,-15,18,``+(e+1),`#fff`,900)}`+X(0,30,16,n[e],gN,800)+`</g>`}return o},TN=Object.keys(wN),EN=[`titleCard`,`chapterCard`,`ctaCard`,`endCard`,`recapCarousel`]}));function ON(e){return VN[(e||``).toLowerCase()]||VN.default}function kN(e,t){return{dx:Math.sin(e*.18+t)*26,dy:Math.sin(e*.9+t)*6}}function AN(e){let[t,n]=zN[e.size]||zN.M,r=e.depthScale==null?1:e.depthScale,i=t*r,a=n*r,o=e.tint||ON(e.label),s=e.silhouette==null?e.z!=null&&e.z>.72:e.silhouette,c=Math.min(16*r,a*.18),l=s?0:Math.min(12*r,a*.16),u=e.shadow===!1?``:`<ellipse cx="0" cy="4" rx="${(i*.56).toFixed(1)}" ry="${(9*r).toFixed(1)}" fill="#000" opacity="${s?.1:.16}"/>`,d=`<rect x="${(-i/2).toFixed(1)}" y="${(-a).toFixed(1)}" width="${i.toFixed(1)}" height="${a.toFixed(1)}" rx="${c.toFixed(1)}" fill="${s?sO(o,.42):o}"/>`,f=l?`<rect x="${(-i/2+3).toFixed(1)}" y="${(-a+2).toFixed(1)}" width="${(i-6).toFixed(1)}" height="${l.toFixed(1)}" rx="${(c*.5).toFixed(1)}" fill="${sO(o,1.24)}" opacity="0.85"/>`:``,p=s?``:`<rect x="${(-i/2).toFixed(1)}" y="${(-a*.28).toFixed(1)}" width="${i.toFixed(1)}" height="${(a*.28).toFixed(1)}" rx="${c.toFixed(1)}" fill="${sO(o,.78)}" opacity="0.5"/>`,m=K(Math.round(15*r),8,22);return`${u}${d}${p}${f}${s?``:`<text x="0" y="${(-a/2).toFixed(1)}" text-anchor="middle" dominant-baseline="central" font-family="Nunito,system-ui,sans-serif" font-weight="800" font-size="${m}" fill="#f2f5f8" opacity="0.92" letter-spacing="0.5">${(e.label||``).toString().slice(0,12).toUpperCase()}</text>`}`}function jN(e,t){let[n,r]=zN[e.size]||zN.M,i=e.depthScale==null?1:e.depthScale,a=n*i,o=r*i,s=e.silhouette==null?e.z!=null&&e.z>.72:e.silhouette,c=e.shadow===!1?``:`<ellipse cx="0" cy="4" rx="${(a*.56).toFixed(1)}" ry="${(9*i).toFixed(1)}" fill="#000" opacity="${s?.1:.16}"/>`,l=`0 0 ${t.w||100} ${t.h||100}`,u=s?` style="filter:brightness(0.28) saturate(0.4)"`:``;return`${c}${`<svg x="${(-a/2).toFixed(1)}" y="${(-o).toFixed(1)}" width="${a.toFixed(1)}" height="${o.toFixed(1)}" viewBox="${l}" preserveAspectRatio="xMidYMax meet" overflow="visible"${u}>${t.inner}</svg>`}`}function MN(e){let[t,n]=zN[e.size]||zN.M,r=e.depthScale==null?1:e.depthScale,i=t*r,a=n*r;return{muzzle:{dx:i*.5,dy:-a*.62},smoke:{dx:0,dy:-a},center:{dx:0,dy:-a*.5}}}function NN(e){let t=e.depthScale||1,n=(WN[e.size]||94)*t/2,r=e.tint||ON(e.label),i=e.silhouette,a=(e.label||``).toString().slice(0,5).toUpperCase();return qN(t,n*.9,e.shadow)+`<circle cx="0" cy="${-n}" r="${n.toFixed(1)}" fill="${i?sO(r,.45):r}"/><circle cx="0" cy="${-n}" r="${n.toFixed(1)}" fill="none" stroke="rgba(0,0,0,.16)"/>`+(i?``:`<text x="0" y="${(-n+KN(t)*.36).toFixed(1)}" text-anchor="middle" dominant-baseline="middle" font-family="Nunito,system-ui,sans-serif" font-weight="900" font-size="${KN(t,16)}" fill="#fff">${a}</text>`)}function PN(e){let t=e.depthScale||1,n=(WN[e.size]||94)*t/2,r=e.tint||`#8aa0b5`,i=e.silhouette,a=GN(e.label);return qN(t,n*.9,e.shadow)+`<circle cx="0" cy="${-n}" r="${(n+3*t).toFixed(1)}" fill="none" stroke="${i?sO(r,.5):r}" stroke-width="${(3.5*t).toFixed(1)}"/><circle cx="0" cy="${-n}" r="${n.toFixed(1)}" fill="${i?sO(`#c9b7a6`,.5):`#d9c7b6`}"/>`+(i?``:`<text x="0" y="${(-n+KN(t)*.36).toFixed(1)}" text-anchor="middle" dominant-baseline="middle" font-family="Nunito,system-ui,sans-serif" font-weight="900" font-size="${KN(t,18)}" fill="${r}">${a}</text>`)}function FN(e){let[t,n]=zN[e.size]||zN.M,r=e.depthScale||1,i=t*r,a=n*r,o=e.tint||`#7a8794`,s=e.silhouette,c=(e.label||`IMAGE`).toString().slice(0,12).toUpperCase(),l=`<rect x="${-i/2}" y="${-a}" width="${i.toFixed(1)}" height="${a.toFixed(1)}" rx="6" fill="${s?sO(o,.42):`#eef1f4`}" stroke="${s?sO(o,.3):o}" stroke-width="${(3*r).toFixed(1)}"/>`,u=s?``:`<line x1="${-i/2+6}" y1="-6" x2="${i/2-6}" y2="${-a+8}" stroke="${o}" stroke-width="1.5" opacity="0.5"/><line x1="${-i/2+6}" y1="${-a+8}" x2="${i/2-6}" y2="-6" stroke="${o}" stroke-width="1.5" opacity="0.5"/><rect x="${-i/2}" y="${-a*.26}" width="${i.toFixed(1)}" height="${(a*.26).toFixed(1)}" rx="0" fill="${o}" opacity="0.9"/><text x="0" y="${(-a*.1).toFixed(1)}" text-anchor="middle" font-family="Nunito,system-ui,sans-serif" font-weight="800" font-size="${KN(r,13)}" fill="#fff">${c}</text>`;return qN(r,i*.5,e.shadow)+l+u}function IN(e){let t=e.depthScale||1,n=(WN[e.size]||94)*.7*t,r=e.tint||ON(e.label),i=e.silhouette,a=GN(e.label).slice(0,1)||`A`;return qN(t,n*.6,e.shadow)+`<rect x="${-n/2}" y="${-n}" width="${n.toFixed(1)}" height="${n.toFixed(1)}" rx="${(n*.22).toFixed(1)}" fill="${i?sO(r,.45):r}"/>`+(i?``:`<text x="0" y="${(-n/2+KN(t)*.36).toFixed(1)}" text-anchor="middle" dominant-baseline="middle" font-family="Nunito,system-ui,sans-serif" font-weight="900" font-size="${KN(t,22)}" fill="#fff">${a}</text>`)}function LN(e){switch(e.face){case`flagRoundel`:return NN(e);case`portraitCircle`:return PN(e);case`imageFrame`:return FN(e);case`logoTile`:return IN(e);default:return AN(e)}}function RN(e){if(!e.face||e.face===`assetBox`)return MN(e);let t=e.depthScale==null?1:e.depthScale;if(e.face===`imageFrame`){let[n,r]=zN[e.size]||zN.M,i=n*t,a=r*t;return{muzzle:{dx:i*.5,dy:-a*.5},smoke:{dx:0,dy:-a},center:{dx:0,dy:-a*.5}}}let n=(WN[e.size]||94)*t,r=n/2;return{muzzle:{dx:r*.8,dy:-r},smoke:{dx:0,dy:-n},center:{dx:0,dy:-r}}}var zN,BN,VN,HN,UN,WN,GN,KN,qN,JN=o((()=>{pO(),zN={S:[78,54],M:[128,88],L:[198,134]},BN=[`ground`,`hover`,`mounted`],VN={default:`#4a5a6b`,tank:`#59636f`,jet:`#6b7686`,hq:`#6a5a72`,monument:`#7a6a54`,ship:`#496072`,arty:`#6b5a4a`,wall:`#5c5750`,truck:`#5a6a5a`},HN=[`assetBox`,`flagRoundel`,`portraitCircle`,`imageFrame`,`logoTile`],UN=e=>HN.includes(e),WN={S:64,M:94,L:132},GN=e=>(e||``).toString().trim().split(/\s+/).map(e=>e[0]||``).join(``).slice(0,3).toUpperCase()||(e||`?`).slice(0,2).toUpperCase(),KN=(e,t=15,n=8,r=22)=>K(Math.round(t*e),n,r),qN=(e,t,n)=>n===!1?``:`<ellipse cx="0" cy="4" rx="${t.toFixed(1)}" ry="${(8*e).toFixed(1)}" fill="#000" opacity="0.14"/>`}));function YN(e,t,n){let r=nP[e.type];return r?r(e,t,n):``}var XN,ZN,QN,$N,eP,tP,nP,rP=o((()=>{XN=[`flashImpact`,`smokeColumn`,`emberField`,`tracerArc`,`burst`,`speedLines`,`muzzleFlash`,`dustPuff`,`splash`,`ripple`,`glowPulse`,`shockwaveRing`,`confetti`,`sparkleGlint`,`coinBurst`,`heartsPuff`,`steamWisp`],ZN=[`burst`,`flashImpact`,`shockwaveRing`],QN={flashImpact:`screen`,speedLines:`screen`},$N={flashImpact:.16,muzzleFlash:.22,burst:.75,tracerArc:.7,smokeColumn:4,emberField:4,speedLines:1.5,dustPuff:.6,splash:.6,ripple:.9,glowPulse:2,shockwaveRing:.5,confetti:1.8,sparkleGlint:.7,coinBurst:.9,heartsPuff:1.6,steamWisp:3},eP=e=>QN[e]||`world`,tP=(e,t=.12,n=.25)=>Math.max(0,Math.min(1,e/t,(1-e)/n)),nP={smokeColumn(e,t,n){let r=e.tint||`#8b909a`,i=e.scale||1,a=tP(t,.15,.35),o=``;for(let e=0;e<6;e++){let t=(n*.4+e/6)%1,s=-t*160*i,c=(10+t*34)*i,l=a*(1-t)*.5;o+=`<circle cx="${(Math.sin(t*3+e)*10*i).toFixed(1)}" cy="${s.toFixed(1)}" r="${c.toFixed(1)}" fill="${r}" opacity="${l.toFixed(3)}"/>`}return o},emberField(e,t,n){let r=e.scale||1,i=tP(t,.2,.4),a=``;for(let e=0;e<14;e++){let t=(n*.6+e*.137)%1,o=(Math.sin(e*2.3)*40+Math.sin(n+e)*6)*r,s=-t*180*r,c=i*(1-t);a+=`<circle cx="${o.toFixed(1)}" cy="${s.toFixed(1)}" r="${((2+Math.sin(e)*1)*r).toFixed(1)}" fill="#ffb24a" opacity="${c.toFixed(3)}"/>`}return a},tracerArc(e,t){let n=e.bx==null?120:e.bx,r=e.by==null?-40:e.by,i=Math.min(1,t/.6),a=n*.5,o=Math.min(0,r)-70,s=2*(1-i)*i*a+i*i*n,c=2*(1-i)*i*o+i*i*r,l=1-Math.max(0,(t-.6)/.4);return`<path d="M 0 0 Q ${a.toFixed(1)} ${o.toFixed(1)} ${s.toFixed(1)} ${c.toFixed(1)}" stroke="#ffe07a" stroke-width="3" fill="none" opacity="${l.toFixed(3)}" stroke-linecap="round"/>`+(t>.6?`<circle cx="${n.toFixed(1)}" cy="${r.toFixed(1)}" r="${(6+(t-.6)*44).toFixed(1)}" fill="#fff6c8" opacity="${(1-(t-.6)/.4).toFixed(3)}"/>`:``)},burst(e,t){let n=1-t,r=e.scale||1,i=`<circle r="${((6+t*70)*r).toFixed(1)}" fill="none" stroke="#ffcaa0" stroke-width="${(4*n).toFixed(1)}" opacity="${(n*.8).toFixed(3)}"/>`;for(let e=0;e<10;e++){let a=e/10*6.283,o=(20+t*90)*r;i+=`<line x1="${(Math.cos(a)*10*r).toFixed(1)}" y1="${(Math.sin(a)*10*r).toFixed(1)}" x2="${(Math.cos(a)*o).toFixed(1)}" y2="${(Math.sin(a)*o).toFixed(1)}" stroke="#ffd85e" stroke-width="${(3*n).toFixed(1)}" opacity="${n.toFixed(3)}"/>`}return i},muzzleFlash(e,t){let n=Math.max(0,1-t*3),r=e.scale||1;return n<=0?``:`<circle r="${((10+t*6)*r).toFixed(1)}" fill="#fff2b0" opacity="${n.toFixed(3)}"/><path d="M0 0 L ${(28*r).toFixed(1)} ${(-4*r).toFixed(1)} L ${(30*r).toFixed(1)} ${(4*r).toFixed(1)} Z" fill="#ffd85e" opacity="${n.toFixed(3)}"/>`},flashImpact(e,t){let n=Math.max(0,1-t*1.4);return`<rect x="-80" y="-80" width="${(e.VBW||1138)+160}" height="800" fill="${e.tint||`#ffffff`}" opacity="${(n*(e.intensity||.9)).toFixed(3)}"/>`},speedLines(e,t,n){let r=tP(t,.1,.3),i=e.VBW||1138,a=``;for(let e=0;e<9;e++){let t=e/9*640+20,o=(n*320+e*61)%(i+200);a+=`<line x1="${(o-180).toFixed(1)}" y1="${t.toFixed(1)}" x2="${o.toFixed(1)}" y2="${t.toFixed(1)}" stroke="#ffffff" stroke-width="2" opacity="${(r*.32).toFixed(3)}"/>`}return a}},Object.assign(nP,{dustPuff(e,t){let n=1-t,r=e.scale||1,i=``;for(let e=0;e<5;e++){let a=e/5*6.283,o=(10+t*46)*r;i+=`<circle cx="${(Math.cos(a)*o).toFixed(1)}" cy="${(-Math.sin(a)*o*.5).toFixed(1)}" r="${((10+t*16)*r).toFixed(1)}" fill="#b9ad97" opacity="${(n*.5).toFixed(2)}"/>`}return i},splash(e,t){let n=e.scale||1,r=1-t,i=`<path d="M ${(-24*n).toFixed(1)} 0 Q 0 ${(-30*(1-Math.abs(t-.4))*n).toFixed(1)} ${(24*n).toFixed(1)} 0" fill="none" stroke="#8fd0e0" stroke-width="${(3*r).toFixed(1)}" opacity="${r.toFixed(2)}"/>`;for(let e=0;e<6;e++){let a=e/6*Math.PI,o=(14+t*40)*n;i+=`<circle cx="${(Math.cos(a)*o).toFixed(1)}" cy="${(-Math.sin(a)*o).toFixed(1)}" r="${(3*r).toFixed(1)}" fill="#7fb2e0" opacity="${r.toFixed(2)}"/>`}return i},ripple(e,t){let n=e.scale||1,r=``;for(let e=0;e<3;e++){let i=t-e*.18;i<=0||(r+=`<ellipse cx="0" cy="0" rx="${(i*70*n).toFixed(1)}" ry="${(i*24*n).toFixed(1)}" fill="none" stroke="#9fd0e8" stroke-width="2" opacity="${((1-i)*.7).toFixed(2)}"/>`)}return r},glowPulse(e,t){let n=.5+.5*Math.sin(t*Math.PI*4),r=(26+n*14)*(e.scale||1),i=e.tint||`#ffe07a`;return`<circle r="${r.toFixed(1)}" fill="${i}" opacity="${(.18+n*.16).toFixed(2)}"/><circle r="${(r*.5).toFixed(1)}" fill="${i}" opacity="${(.2+n*.2).toFixed(2)}"/>`},shockwaveRing(e,t){let n=e.scale||1,r=1-t;return`<circle r="${(t*130*n).toFixed(1)}" fill="none" stroke="#ffffff" stroke-width="${(8*r).toFixed(1)}" opacity="${(r*.8).toFixed(2)}"/>`},confetti(e,t,n){let r=e.scale||1,i=[`#ff6b5e`,`#2bb3a3`,`#f2b134`,`#5b6ce0`,`#ff7ab0`],a=``;for(let e=0;e<16;e++){let o=(e*37%100-50)*r,s=(-40+t*120+e%5*8)*r,c=(n*6+e)%6.283;a+=`<rect x="${o.toFixed(1)}" y="${s.toFixed(1)}" width="${(7*r).toFixed(1)}" height="${(11*r).toFixed(1)}" fill="${i[e%5]}" transform="rotate(${(c*57).toFixed(0)} ${o.toFixed(1)} ${s.toFixed(1)})" opacity="${(1-t*.6).toFixed(2)}"/>`}return a},sparkleGlint(e,t,n){let r=e.scale||1,i=``;for(let e=0;e<4;e++){let a=e/4*6.283,o=22*r,s=.5+.5*Math.sin(n*8+e*2),c=(5+s*5)*r,l=Math.cos(a)*o,u=Math.sin(a)*o;i+=`<path transform="translate(${l.toFixed(1)} ${u.toFixed(1)})" d="M0 ${-c} L ${c*.3} ${-c*.3} L ${c} 0 L ${c*.3} ${c*.3} L 0 ${c} L ${-c*.3} ${c*.3} L ${-c} 0 L ${-c*.3} ${-c*.3} Z" fill="#fff2b0" opacity="${(s*(1-t)).toFixed(2)}"/>`}return i},coinBurst(e,t,n){let r=e.scale||1,i=``;for(let e=0;e<8;e++){let a=e/8*6.283,o=Math.sin(t*Math.PI),s=Math.cos(a)*t*60*r,c=(-o*70+t*40)*r;i+=`<ellipse cx="${s.toFixed(1)}" cy="${c.toFixed(1)}" rx="${((7+3*Math.sin(n*8+e))*r).toFixed(1)}" ry="${(9*r).toFixed(1)}" fill="#f2b134" stroke="#c98a3a" stroke-width="1" opacity="${(1-t*.7).toFixed(2)}"/>`}return i},heartsPuff(e,t,n){let r=e.scale||1,i=``;for(let e=0;e<5;e++){let a=(t+e*.18)%1,o=(Math.sin(n+e*2)*20+(e-2)*12)*r,s=-a*90*r;i+=`<path transform="translate(${o.toFixed(1)} ${s.toFixed(1)}) scale(${((.5+(1-a)*.5)*r).toFixed(2)})" d="M0 3 C -7 -8 -20 0 0 14 C 20 0 7 -8 0 3 Z" fill="#ff6b8a" opacity="${(1-a).toFixed(2)}"/>`}return i},steamWisp(e,t,n){let r=e.scale||1,i=tP(t,.2,.4),a=``;for(let e=0;e<2;e++){let t=(e?12:-12)*r;a+=`<path d="M ${t} 0 ${[0,1,2,3].map(i=>`Q ${(t+Math.sin(n*1.2+i+e)*14*r).toFixed(1)} ${(-20*(i+.5)*r).toFixed(1)} ${(t+Math.sin(n*1.2+i+1+e)*10*r).toFixed(1)} ${(-20*(i+1)*r).toFixed(1)}`).join(` `)}" fill="none" stroke="#dfeaf2" stroke-width="${(6*r).toFixed(1)}" stroke-linecap="round" opacity="${(i*.4).toFixed(2)}"/>`}return a}})}));function iP(e,t){let n=[],r=Math.max(1,t|0);if(e===`column`){for(let e=0;e<r;e++)n.push({nx:e%2?.16:-.16,row:e,depthRank:r>1?e/(r-1):0});return n}if(e===`line`){for(let e=0;e<r;e++)n.push({nx:r>1?e/(r-1)*2-1:0,row:0,depthRank:0});return n}if(e===`wedge`){let e=0,t=0;for(;e<r;){let i=t*2+1;for(let a=0;a<i&&e<r;a++)n.push({nx:i>1?a/(i-1)*2-1:0,row:t,depthRank:0}),e++;t++}let i=t-1;return n.forEach(e=>e.depthRank=i>0?e.row/i:0),n}let i=Math.ceil(Math.sqrt(r)),a=Math.ceil(r/i);for(let e=0;e<r;e++){let t=e%i,r=Math.floor(e/i);n.push({nx:i>1?t/(i-1)*2-1:0,row:r,depthRank:a>1?r/(a-1):0})}return n}function aP(e,t){let n=e.depthScale||1,r=e.tier===`far`,i=e.cycle||`march`,a=t*(i===`run`||i===`flee`?8:i===`idle`?1.5:5)+(e.phase||0),o=i===`idle`?2:i===`cheer`?1:i===`run`||i===`flee`?20:13,s=Math.sin(a)*o,c=Math.sin(a+Math.PI)*o,l=i===`cheer`,u=i===`flee`?22:i===`idle`?3:9,d=Math.sin(a+Math.PI)*u,f=Math.sin(a)*u,p=i===`run`||i===`flee`?6:0,m=i===`flee`?-3*n:0,h=108*n,g=-h*.42,_=-h*.72,v=-h*.86,y=6*n,b=r?`#2b333f`:oP(`#5c6b52`,e.tone||0),x=r?b:oP(`#c99a6a`,(e.tone||0)*.5),S=Math.max(2,7*n),C=Math.max(2,5.5*n),w=(e,t)=>`<line x1="${e.toFixed(1)}" y1="${g.toFixed(1)}" x2="${(e+t*n+p*n).toFixed(1)}" y2="0" stroke="${b}" stroke-width="${S.toFixed(1)}" stroke-linecap="round"/>`,T=(e,t)=>l?`<line x1="${e.toFixed(1)}" y1="${(_+3*n).toFixed(1)}" x2="${(e+Math.sign(e)*10*n).toFixed(1)}" y2="${(_-20*n).toFixed(1)}" stroke="${b}" stroke-width="${C.toFixed(1)}" stroke-linecap="round"/>`:`<line x1="${e.toFixed(1)}" y1="${(_+3*n).toFixed(1)}" x2="${(e+t*n).toFixed(1)}" y2="${(_+24*n).toFixed(1)}" stroke="${b}" stroke-width="${C.toFixed(1)}" stroke-linecap="round"/>`,E=`<ellipse cx="0" cy="2" rx="${(15*n).toFixed(1)}" ry="${(4*n).toFixed(1)}" fill="#000" opacity="0.12"/>`,D=`<rect x="${(-9*n).toFixed(1)}" y="${_.toFixed(1)}" width="${(18*n).toFixed(1)}" height="${(g-_+4*n).toFixed(1)}" rx="${(6*n).toFixed(1)}" fill="${b}"/>`,O=`<circle cx="${m.toFixed(1)}" cy="${v.toFixed(1)}" r="${(9*n).toFixed(1)}" fill="${x}"/>`+(r?``:`<path d="M ${(m-10*n).toFixed(1)} ${(v-3*n).toFixed(1)} q ${(10*n).toFixed(1)} ${(-12*n).toFixed(1)} ${(20*n).toFixed(1)} 0 z" fill="${b}"/>`);return`<g opacity="${(e.opacity==null?1:e.opacity).toFixed(3)}">${E}${w(-y,s)}${w(y,c)}${D}${T(-10*n,d)}${T(10*n,f)}${O}</g>`}var oP,sP=o((()=>{pO(),oP=(e,t)=>sO(e,1+t)}));function cP(e,t){return(e||[]).map(e=>mP[e]?mP[e](t):``).join(``)}var lP,uP,dP,fP,pP,mP,hP=o((()=>{lP=[`wet`,`cold`,`hot`,`dirty`,`sleepy`,`inLove`,`confused`,`injured`],uP=(e,t=1)=>e.toFixed(t),dP=(e,t,n,r,i=`#ff6b8a`)=>`<path transform="translate(${uP(e)} ${uP(t)}) scale(${uP(n,3)})" d="M0 3 C -7 -8 -20 0 0 14 C 20 0 7 -8 0 3 Z" fill="${i}" opacity="${uP(r,2)}"/>`,fP=(e,t,n,r,i)=>`<line x1="${uP(e)}" y1="${uP(t)}" x2="${uP(e)}" y2="${uP(t+n)}" stroke="${r}" stroke-width="3" stroke-linecap="round" opacity="${uP(i,2)}"/>`,pP=(e,t,n,r,i,a=1)=>`<text x="${uP(e)}" y="${uP(t)}" font-family="Nunito,system-ui,sans-serif" font-weight="900" font-size="${uP(n)}" text-anchor="middle" fill="${i}" opacity="${uP(a,2)}">${r}</text>`,mP={wet:e=>{let t=``;for(let n=0;n<5;n++){let r=(e*.8+n*.2)%1,i=-34+n*17;t+=fP(i,30+r*70,8,`#7fb2e0`,1-r)}return t},cold:e=>{let t=e*.55%1;return`<ellipse cx="20" cy="6" rx="${uP(5+t*12)}" ry="${uP(3+t*7)}" fill="#e6eef4" opacity="${uP(.55*(1-t),2)}"/>`+fP(-24,-34,6,`#bcd7e4`,.8)+fP(24,-30,6,`#bcd7e4`,.8)},hot:e=>{let t=``;for(let n=0;n<2;n++){let r=(e*.7+n*.5)%1;t+=`<path transform="translate(${uP(n?26:-26)} ${uP(-24+r*30)})" d="M0 -6 C 5 0 5 8 0 8 C -5 8 -5 0 0 -6 Z" fill="#8fd0e0" opacity="${uP(1-r,2)}"/>`}return t},dirty:()=>{let e=``;return[[-20,34,10],[16,46,8],[-6,60,7],[24,30,6]].forEach(([t,n,r])=>e+=`<circle cx="${t}" cy="${n}" r="${r}" fill="#6b5a45" opacity="0.5"/>`),e},sleepy:e=>{let t=``;for(let n=0;n<3;n++){let r=(e*.5+n*.33)%1;t+=pP(18+r*30,-30-r*40,12+r*10,`Z`,`#5b6ce0`,1-r)}return t},inLove:e=>{let t=``;for(let n=0;n<3;n++){let r=(e*.6+n*.34)%1;t+=dP(-14+n*16+Math.sin(e*2+n)*6,-26-r*50,.7+(1-r)*.5,1-r)}return t},confused:e=>pP(0,-38+Math.sin(e*2.5)*4,30,`?`,`#c98a3a`)+`<circle cx="14" cy="-14" r="3" fill="#c98a3a" opacity="${uP(.5+.5*Math.sin(e*4),2)}"/>`,injured:()=>`<rect x="-18" y="-16" width="36" height="12" rx="3" fill="#e8dcc0" transform="rotate(-16)"/><rect x="-3" y="-22" width="6" height="12" fill="#c05050" transform="rotate(-16)"/><rect x="-9" y="-16" width="12" height="4" fill="#c05050" transform="rotate(-16)"/>`}}));function gP(e,t,n,r){let i=e.enter;if(!i||i.type===`carryOver`)return{};let a=i.type,o=i.atPhrase==null?n:t[i.atPhrase].t,s=o+IP,c=e.pos&&e.pos.x||.5,l=a===`walkIn`||a===`runIn`;if(r<o)return l?{opacity:1,xOverride:LP(i.from),forceWalk:a===`walkIn`,forceRun:a===`runIn`}:a===`dropIn`?{opacity:0,yOverride:-280}:a===`riseFrom`?{opacity:0,yOverride:220}:{opacity:0};if(r>=s)return{};let u=dO((r-o)/IP);if(l)return{opacity:1,xOverride:lO(LP(i.from),c,u),forceWalk:a===`walkIn`,forceRun:a===`runIn`};if(a===`popIn`){let e=dO(K((r-o)/.3,0,1));return{opacity:e,scaleMul:.55+.45*e+Math.max(0,Math.sin(e*Math.PI))*.15}}return a===`dropIn`?{opacity:K(u*2,0,1),yOverride:lO(-280,0,u)}:a===`riseFrom`?{opacity:K(u*2,0,1),yOverride:lO(220,0,u)}:{opacity:u}}function _P(e,t){let n=aO(e||`x`),r=7+n%5,i=.5+.5*Math.sin(t*(2.3+n%3)),a=K(i*(.55+.45*Math.sin(t*r))*(Math.sin(t*1.9+n%7)>-.4?1:.15),0,1);return{mOpen:1+a*14,mWidth:12+a*16,mCurve:2+Math.sin(t*4.6)*5}}function vP(e){if(!e||!Array.isArray(e.phrases))throw new UP(`audio.phrases must be an array`);let t=e.phrases.map((e,t)=>{if(typeof e==`string`){let n=e.match(/^(\d+):(\d+(?:\.\d+)?)\s+(.*)$/);if(!n)throw new UP(`phrase ${t} is not "M:SS.d text": ${JSON.stringify(e)}`);return{t:n[1]*60+parseFloat(n[2]),text:n[3]}}if(e&&typeof e==`object`&&typeof e.t==`number`&&typeof e.text==`string`)return{t:e.t,text:e.text};throw new UP(`phrase ${t} must be "M:SS.d text" or {t:Number,text:String}`)});if(t.sort((e,t)=>e.t-t.t),!t.length)throw new UP(`audio.phrases is empty`);return t}function yP(e,t){return e.meta&&typeof e.meta.durationMs==`number`?e.meta.durationMs/1e3:t[t.length-1].t+HP}function bP(e,t){let n=0;for(let r=0;r<e.length;r++)e[r].t<=t+1e-9&&(n=r);return n}function xP(e,t,n){let r=e.map((e,t)=>({s:e,i:t})).sort((e,t)=>e.s.startPhrase-t.s.startPhrase);return r.map((e,i)=>{let a=t[e.s.startPhrase].t,o=i+1<r.length?t[r[i+1].s.startPhrase].t:n;return{scene:e.s,t0:a,t1:o}})}function SP(e,t){let n=oO(e),r=1.2+n()*2;for(;r<=t+.14;){if(t>=r&&t<r+.14)return Math.sin(Math.PI*(t-r)/.14);r+=2.64+n()*3}return 0}function CP(e,t,n,r){let i=`idle`,a=r,o=`idle`,s=r,c=null,l=(e.track||[]).filter(e=>e.action).sort((e,t)=>e.atPhrase-t.atPhrase);for(let e of l)e.atPhrase<=n&&(o=i,s=a,i=e.action,a=t[e.atPhrase].t,c=e);let u={};return c&&(c.speed&&(u.speed=c.speed),c.intensity&&(u.intensity=c.intensity),c.target!=null&&(u.target=c.target)),{action:i,start:a,prevAction:o,prevStart:s,opts:u}}function wP(e,t,n,r){let i=e.facing||`front`,a=-99,o=(e.track||[]).slice().sort((e,t)=>e.atPhrase-t.atPhrase);for(let e of o)if(e.atPhrase<=n&&(e.facing||e.action===`turn`)){let n=e.facing||i;(n!==i||e.action===`turn`)&&(n!==i&&(i=n),a=t[e.atPhrase].t)}let s=Math.abs(r-a),c=a>=0&&s<zP?.15+s/zP*.85:1;return{facing:i,squash:c}}function TP(e,t,n,r,i){let a=UN(e.face)?e.face:`assetBox`,o=e.plane==null?.5:e.plane,s=GM(o,r),c=e.x==null?.5:e.x,l=BN.includes(e.placement)?e.placement:`ground`,u=c*n,d;if(l===`hover`){let n=kN(t,aO(e.label||`x`)%20*.31);u+=n.dx,d=205+s.yShift*.35+n.dy}else d=l===`mounted`?480+s.yShift:MP+s.yShift;let f={kind:`placeholder`,face:a,id:e.id||null,label:e.label||``,size:e.size||`M`,placement:l,source:e.source||`placeholder`,z:o,x:u,y:d,depthScale:s.scale,opacity:s.opacity,blur:s.blur,tint:e.tint||(a===`assetBox`||a===`flagRoundel`||a===`logoTile`?ON(e.label):null),silhouette:o>.72},p=RN({face:a,size:f.size,depthScale:f.depthScale});return f.anchors={muzzle:{x:u+p.muzzle.dx,y:d+p.muzzle.dy},smoke:{x:u+p.smoke.dx,y:d+p.smoke.dy},center:{x:u+p.center.dx,y:d+p.center.dy}},f.emits=e.emits||[],f}function EP(e,t,n,r,i){let a=K(e.count|0,1,60),o=NP.includes(e.shape)?e.shape:`grid`,s=PP.includes(e.cycle)?e.cycle:`march`,c=e.plane==null?.6:e.plane,l=e.x==null?.5:e.x,u=(e.width==null?.55:e.width)*n,d=oO(i+`:form:`+(e.id||e.ref||`s`)),f=iP(o,a).map(e=>{let t=K(c+e.depthRank*.16,0,.98),i=GM(t,r),a=1+(d()-.5)*.08,o=(d()-.5)*.16,f=l*n+e.nx*u*.5*(1-e.depthRank*.14)+(d()-.5)*12,p=MP+i.yShift-e.depthRank*6,m=t>.72?`far`:t>.52?`mid`:`near`;return{x:f,y:p,z:t,depthScale:i.scale*a,opacity:i.opacity,phase:d()*6.283,cycle:s,tone:o,tier:m}}).sort((e,t)=>t.z-e.z);return{kind:`formation`,z:f.reduce((e,t)=>e+t.z,0)/Math.max(1,f.length),id:e.id||null,count:f.length,cycle:s,units:f}}function DP(e,t,n,r,i){let a=K(e.count|0,1,50),o=e.plane==null?.62:e.plane,s=e.dir===`left`?-1:1,c=(e.speed||1)*42,l=n*1.3,u=-n*.15,d=PP.includes(e.cycle)?e.cycle:`march`,f=oO(i+`:flow:`+(e.id||e.ref||`f`)),p=[];for(let e=0;e<a;e++){let e=((f()*l+t*c*s)%l+l)%l,n=u+e,i=K(Math.min(e/(l*.08),(l-e)/(l*.08),1),0,1),a=K(o+(f()-.5)*.08,0,.98),m=GM(a,r);p.push({x:n,y:MP+m.yShift,z:a,depthScale:m.scale*(1+(f()-.5)*.06),opacity:m.opacity*i,phase:f()*6.283,cycle:d,tone:(f()-.5)*.16,tier:a>.72?`far`:a>.52?`mid`:`near`})}return p.sort((e,t)=>t.z-e.z),{kind:`formation`,z:o,id:e.id||null,count:a,cycle:d,units:p}}function OP(e,t,n,r){let i=e.pos&&typeof e.pos.x==`number`?e.pos.x:.5,a=(e.track||[]).filter(e=>e.action===`walk`&&e.to&&typeof e.to.x==`number`).sort((e,t)=>e.atPhrase-t.atPhrase);for(let e=0;e<a.length;e++){let o=a[e],s=t[o.atPhrase].t,c=a[e+1]?t[a[e+1].atPhrase].t:Math.min(s+2.2,n),l=o.to.x;if(r>=c)i=l;else if(r>=s){i=lO(i,l,dO((r-s)/Math.max(.001,c-s)));break}else break}return i}function kP(e,t){let n=vP(e.audio),r=yP(e,n),i=K(t,0,r),a=e.meta&&e.meta.aspect||`16:9`,o=mO(a),s=e.meta&&e.meta.seed||42,c=e.meta&&e.meta.style||{},l=c.bob!==!1,u=c.shadow!==!1,d=bP(n,i),f=xP(e.scenes,n,r),p=f[0];for(let e of f)i>=e.t0-1e-9&&(p=e);let m=null,h=1;if(i<p.t0+VP){let e=f[f.indexOf(p)-1];e&&(m=AP(e.scene),h=K((i-p.t0)/VP,0,1))}let g=AP(p.scene),_=e.meta&&e.meta.palette||`auto`,v={};e.cast.forEach(e=>v[e.id]=Yk(e.params||{},_));let y=p.scene,b={},x=[],S=[],C=jj(y.setup.name)?QA[y.setup.palette||`day`]||`light`:Pj[y.setup.name]||`light`;(y.dialogue||[]).forEach(e=>{e.phrase===d&&(e.style===`narrationCard`?S.push({text:e.text||n[e.phrase].text,anchor:e.anchor||`skyBand`,tone:C}):e.style===`fullCard`?S.push({text:e.text||n[e.phrase].text,tone:C,full:!0}):(b[e.speaker]=!0,x.push({ref:e.speaker,text:e.text||n[e.phrase].text,tStart:n[e.phrase].t})))});let w=y.cast||[],T={};w.forEach(e=>{let t=gP(e,n,p.t0,i),a=t.xOverride==null?OP(e,n,r,i):t.xOverride,s=e.pos&&typeof e.pos.z==`number`?e.pos.z:.5,{facing:c,squash:l}=wP(e,n,d,i);T[e.ref]={xn:a,rigX:a*o,z:s,facing:c,squash:l,enterOpacity:t.opacity,forceWalk:t.forceWalk,forceRun:t.forceRun,yOverride:t.yOverride,scaleMul:t.scaleMul}});let E=(e,t)=>{let n=T[e];if(!n)return{aimDX:0,aimDY:0};let r=n.rigX,i=n.z;if(t&&typeof t==`object`&&typeof t.x==`number`)r=t.x*o,typeof t.z==`number`&&(i=t.z);else if(typeof t==`string`){let e=T[t.replace(/^cast:/,``)];e&&(r=e.rigX,i=e.z)}return{aimDX:K((r-n.rigX)/(o*.35),-1,1),aimDY:K((n.z-i)*1.4,-1,1)}},D=w.map(e=>{let t=T[e.ref],r=CP(e,n,d,p.t0),a=t.forceRun?`run`:t.forceWalk?`walk`:r.action,o=t.forceWalk||t.forceRun?{speed:t.forceRun?1.5:1.15}:r.opts,u=t.forceWalk||t.forceRun?p.t0:r.start,f={...o};if(HO.includes(a)&&o.target!=null){let t=E(e.ref,o.target);f.aimDX=t.aimDX,f.aimDY=t.aimDY}let m=jP(MO(a,i,f)),h=jP(MO(r.prevAction,r.prevStart,r.opts)),g=dO(K((i-u)/BP,0,1)),_={};for(let e of Object.keys(xO))_[e]=lO(h[e],m[e],g);_.blink=SP(s+`:`+e.ref,i);let S=!!b[e.ref];if(S){_=FO(_,PO(i));let t=x.find(t=>t.ref===e.ref);Object.assign(_,c.mouth===`amplitude`&&t?_P(t.text,i-t.tStart):NO(i))}!l&&RP.includes(a)&&(_.bob=0);let C=GM(t.z,y.setup.mode);return{ref:e.ref,params:v[e.ref]||{},pose:_,states:e.state||[],xNorm:t.xn,rigX:t.rigX,z:t.z,facing:t.facing,squash:t.squash,depthScale:C.scale*(t.scaleMul||1),yShift:C.yShift+(t.yOverride||0),opacity:C.opacity*(t.enterOpacity==null?1:t.enterOpacity),blur:C.blur,action:a,speaking:S}}).sort((e,t)=>t.z-e.z);x.forEach(e=>{let t=T[e.ref];e.z=t?t.z:.5,e.facing=t?t.facing:`front`});let O={};(e.props||[]).forEach(e=>O[e.id]=e);let k=(y.setup&&y.setup.dress||[]).map(e=>{let t=O[e.ref]||{id:e.ref,source:`coded`,ref:e.ref},n=e.presentation||`onSurface`,r,i,a;if(n===`heldBy`){let t=(e.slot||``).replace(/^(cast:|hand:)/,``),n=T[t];if(n)r=n.rigX+(n.facing===`left`?-46:46),i=344,a=n.z;else{let t=IA(e.slot,o);r=t.x,i=t.y,a=t.z}}else{let t=IA(e.slot,o);r=t.x,i=t.y,a=t.z}return{id:e.ref,spec:t,slot:e.slot,x:r,y:i,z:a,presentation:n,depthScale:GM(a,y.setup.mode).scale}}),A=[];(y.entities||[]).forEach(e=>{e.type===`assetBox`?A.push(TP({...e,face:`assetBox`},i,o,y.setup.mode,s)):e.type===`placeholder`?A.push(TP(e,i,o,y.setup.mode,s)):e.type===`formation`?A.push(EP(e,i,o,y.setup.mode,s)):e.type===`crowdFlow`&&A.push(DP(e,i,o,y.setup.mode,s))});let j=e=>{if(e&&typeof e==`object`&&typeof e.x==`number`)return{x:e.x*o,y:e.y==null?300:e.y};if(typeof e==`string`){if(e.startsWith(`region:`)){let t=lA(e.slice(7),o);return{x:t.x,y:t.y,tint:t.tint}}if(e.startsWith(`prop:`)){let t=k.find(t=>t.id===e.slice(5));if(t)return{x:t.x,y:t.y-40}}if(e.includes(`.`)){let t=IA(e,o);return{x:t.x,y:t.y}}let t=T[e.replace(/^cast:/,``)];if(t)return{x:t.rigX,y:240};let n=IA(e,o);return{x:n.x,y:n.y}}return{x:o/2,y:300}},M=(y.overlays||[]).map(e=>{let t=e.atMs==null?n[e.atPhrase==null?d:e.atPhrase].t:e.atMs/1e3,r=(e.hold==null?4:e.hold/1e3)+.6;if(i<t||i>t+r)return null;let a,s={};if(e.region){let t=lA(e.region,o);a={x:t.x,y:t.y},s.tint=e.tint||t.tint}else a=j(e.anchor||`skyBand`);if(e.from&&e.to){let t=j(e.from),n=j(e.to);a=t,s.bx=n.x-t.x,s.by=n.y-t.y,s.tint=e.tint||t.tint||n.tint}return{...e,...s,p:K((i-t)/.5,0,1),x:a.x,y:a.y}}).filter(Boolean),N=(y.sfx||[]).map(e=>{let t=e.atMs==null?n[e.atPhrase==null?d:e.atPhrase].t:e.atMs/1e3;return{name:e.name,t0:t,gain:e.gain==null?1:e.gain,firing:i>=t&&i<t+.12}}),P=(y.extras||[]).map((e,t)=>{let n=e.z==null?.78:e.z,r=GM(n,y.setup.mode);return{x:(e.x==null?.5:e.x)*o,z:n,depthScale:r.scale,yShift:r.yShift,opacity:r.opacity,shirt:e.shirt||`#98a4b0`,phase:t*1.7%6.28}}),F=null;{let e=f[f.indexOf(p)-1],t=e&&e.scene.transitionOut,n=e=>{let t=XA[e.setup&&e.setup.palette||`day`];return t&&t.ground||`#3a4657`};if(t&&t.type===`flash`)i<p.t0+FP&&(F={type:`flash`,p:K((i-p.t0)/FP,0,1),tint:t.tint||`#ffffff`});else if(t&&NM(t.type)&&t.type!==`fade`){let r=Math.max(.3,(t.durationMs||1200)/1e3),a=K((i-p.t0)/r,0,1);if(i<p.t0+r){let r=t.carrySubject?T[t.carrySubject]:null;F={harness:!0,spec:t,p:a,bridge:[n(e.scene),n(p.scene)],subjectFrom:r?{x:r.rigX,y:400}:{x:o*.3,y:420},subjectTo:r?{x:r.rigX,y:400}:{x:o*.7,y:420}}}}else m&&t&&t.type!==`carry`&&(F={type:t.type||`fade`,bands:t.bands||4,direction:t.direction||`left`,p:K((i-p.t0)/VP,0,1)})}let I=[];(y.effects||[]).forEach(e=>{let t=e.atMs==null?n[e.atPhrase==null?d:e.atPhrase].t:e.atMs/1e3,r=e.hold==null?$N[e.type]||1:e.hold/1e3;if(i<t||i>t+r)return;let a=K((i-t)/r,0,1),s=e.at?j(e.at):{x:o/2,y:300},c={type:e.type,space:eP(e.type),p:a,t0:t,tint:e.tint,intensity:e.intensity,scale:e.scale,shake:e.shake,VBW:o};if(e.type===`tracerArc`){let t=e.from?j(e.from):s,n=e.to?j(e.to):{x:t.x+120,y:t.y-40};I.push({...c,x:t.x,y:t.y,bx:n.x-t.x,by:n.y-t.y})}else I.push({...c,x:s.x,y:s.y})}),A.forEach(e=>{e.kind===`placeholder`&&(e.emits||[]).forEach(t=>{let n=e.anchors[t.anchor||(t.type===`muzzleFlash`?`muzzle`:`smoke`)]||e.anchors.center;if(t.type===`muzzleFlash`){let r=1.6,a=i%r/r;a<.14&&I.push({type:`muzzleFlash`,space:`world`,x:n.x,y:n.y,p:a/.14,t0:i-a,tint:t.tint,scale:e.depthScale,VBW:o})}else I.push({type:t.type,space:eP(t.type),x:n.x,y:n.y,p:.5,t0:0,tint:t.tint,scale:e.depthScale,VBW:o})})});let ee=0,te=I.filter(e=>!ZN.includes(e.type)||++ee<=2),ne=0,re=0;te.forEach(e=>{if(!(e.shake===!0||e.shake!==!1&&e.type===`flashImpact`))return;let t=14*(1-K((i-e.t0)/.3,0,1)),n=aO(`shk`+e.t0.toFixed(3))%100;ne+=Math.sin(i*90+n)*t,re+=Math.cos(i*84+n)*t*.7});let ie={VBW:o,sceneT0:p.t0,sceneT1:p.t1,phrases:n,resolveTarget:j,seed:s,cast:D.map(e=>({rigX:e.rigX}))},ae=MA(y.setup.name)?wA(y.setup.name,y.setup.seed==null?0:y.setup.seed,y.setup.elements||{}):null,oe=y.camera&&!Array.isArray(y.camera)?y.camera:null,se=!!(oe||ae),ce,le=null,ue=null;if(se){let e=ae?{worldW:ae.worldW,worldH:ae.worldH,viewW:ae.viewW,viewH:ae.viewH}:{worldW:o,worldH:640,viewW:o,viewH:640},t=oe&&oe.subjects||(ae?ae.subjects:[]),n=oe||{mode:`generated`,seed:y.setup.seed||1,style:`editorial`},r=nM(oM(n,{duration:p.t1-p.t0,...e,subjects:t}),i-p.t0);if(n.safeZone&&n.safeZone.enabled!==!1){let t=(n.safeZone.x==null?.22:n.safeZone.x)*e.viewW/r.scale,i=(n.safeZone.y==null?.2:n.safeZone.y)*e.viewH/r.scale;r={...r,x:K(r.x,t,e.worldW-t),y:K(r.y,i,e.worldH-i)}}if(le=r,ce={cx:r.x,cy:r.y,zoom:r.scale,rotation:r.rotation,pan:!0,subjectId:r.subjectId,worldW:e.worldW,worldH:e.worldH,viewW:e.viewW,viewH:e.viewH},ae&&ae.focusRing){let e=t.find(e=>e.id===r.subjectId)||t[0];e&&(ue={x:e.x,y:e.y})}(ne||re)&&(ce.cx+=ne,ce.cy+=re)}else{ce=iN(y,i,ie);let e=f[f.indexOf(p)-1],t=e&&(!Array.isArray(e.scene.camera)&&e.scene.camera||MA(e.scene.setup.name));if(m&&i<p.t0+VP&&e&&!t){let t=iN(e.scene,e.t1-.001,{...ie,sceneT0:e.t0,sceneT1:e.t1}),n=K((i-p.t0)/VP,0,1);ce.cx=lO(t.cx,ce.cx,n),ce.cy=lO(t.cy,ce.cy,n),ce.zoom=lO(t.zoom,ce.zoom,n)}(ne||re)&&(ce.cx+=ne,ce.cy+=re)}let de=y.setup.weather?typeof y.setup.weather==`string`?{type:y.setup.weather}:{...y.setup.weather}:null,fe=null,pe=y.setup.timeRamp;if(pe){let e=pe.overPhrases||2,t=n[Math.min(n.length-1,(y.startPhrase||0)+e)].t,r=K((i-p.t0)/Math.max(.1,t-p.t0),0,1),a=XA[pe.from]||XA.day,s=XA[pe.to]||XA.night;fe={k:r,top:cO(a.skyTop,s.skyTop,r),bot:cO(a.skyBot,s.skyBot,r),alpha:.55*r,sun:{x:o*(.2+.6*r),y:130+r*r*380,a:K(1-r*1.25,0,1)},moon:{x:o*(.78-.5*r),y:430-r*300,a:K((r-.4)/.45,0,1)}}}let me=y.mode===`wordReveal`?`wordReveal`:`normal`,he=null;if(me===`wordReveal`){let e=y.wordReveal||{},t={...Sd,...e},n=hd(y.words||[],(i-p.t0)*1e3,t,180),r=gd(t.swapAnim,n.enterP);if(he={word:!n.cleared&&n.word?t.allCaps?n.word.toUpperCase():n.word:``,...r,emphasized:n.emphasized,background:t.background,accent:t.accentColor},Math.round(Number(e.trailCount==null?e.ghostWords:e.trailCount)||0)>0){let e=bd(y.words||[],(i-p.t0)*1e3,t,180);he.trail={entries:e.entries.map(e=>({...e,text:t.allCaps?e.text.toUpperCase():e.text,transform:e.role===`current`?gd(t.swapAnim,e.enterP):null})),layout:t.trailLayout,muteColor:t.trailMuteColor,exit:t.trailExit}}}let ge=me===`wordReveal`;return{t:i,dur:r,aspect:a,VBW:o,seed:s,phraseIndex:d,mode:me,wordReveal:he,background:{to:g,from:m,mix:h},cast:D,extras:P,entities:A,effects:te,bubbles:ge?[]:x,cards:ge?[]:S,props:k,overlays:M,transition:F,weather:de,timeGrade:fe,sfx:N,style:{bob:l,shadow:u},board:ae?{name:y.setup.name,planes:ae.planes,worldW:ae.worldW,worldH:ae.worldH,viewW:ae.viewW,viewH:ae.viewH,focusRing:ae.focusRing,ring:ue,panels:ae.panels}:null,camera:{view:ce,pan:le,bgCam:se?{pan:0,scale:0}:sN(ce,o),coverage:se?1:cN(y,ie),richness:se?1:aN(y,ie),traveling:ce.directive===`travel`,shake:{x:ne,y:re}}}}function AP(e){return{name:e.setup.name,seed:e.setup.seed==null?7:e.setup.seed,mode:e.setup.mode||`2.5d`,palette:e.setup.palette||`day`}}function jP(e){return{...xO,...e}}var MP,NP,PP,FP,IP,LP,RP,zP,BP,VP,HP,UP,WP=o((()=>{pO(),jO(),UO(),cA(),Bj(),NA(),fM(),UM(),QM(),mN(),DN(),JN(),rP(),sP(),hA(),kd(),MP=590,NP=[`grid`,`wedge`,`column`,`line`],PP=[`march`,`run`,`flee`,`idle`,`cheer`],FP=.18,IP=1,LP=e=>e===`right`?1.16:-.16,RP=[`idle`,`stand`,`look`,`lookAround`,`turn`,`talkGesture`,`talk`],zP=.06,BP=.25,VP=.5,HP=3.5,UP=class extends Error{constructor(e){super(e),this.name=`SchemaError`}}}));function GP(e,t){let n=Math.round(K(15*e,12,27));return{fontPx:n,padY:Math.round(n*.5),padX:Math.round(n*.72),maxWidth:Math.min(t*.72,Math.round(250*e)),radius:Math.round(n*1.05),gap:Math.round(9+n*.4)}}function KP(e,t,n,r,i,a){let o=a.radius,s=a.gap,c=e.h*.5+r*.5+s,l=e.h*.5+i*.5+s,u=e.cx+n.x*c-r/2,d=e.midY+n.y*l-i/2;u=K(u,10,t.w-10-r),d=K(d,10,t.h-10-i);let f=u+r/2,p=d+i/2,m=e.cx-f,h=e.midY-p,g;return g=Math.abs(h)>=Math.abs(m)?{side:h>0?`down`:`up`,left:Math.round(K(e.cx,u+o+4,u+r-o-4)-u-9),top:null}:{side:m>0?`right`:`left`,left:null,top:Math.round(K(e.midY,d+o+4,d+i-o-4)-d-8)},{left:Math.round(u),top:Math.round(d),tail:g}}function qP(e,t,n=34){return Math.max(0,Math.min(e.length,Math.floor(t*n)))}var JP=o((()=>{pO()}));function YP(e){let t=`gen:`+e;if(eF.has(t))return eF.get(t);let n=aO(e);oO(e);let r=n%360,i=`hsl(${r} 62% 58%)`,a=`hsl(${r} 55% 38%)`,o=`generic`;for(let[t,n]of $P)if(n.test(e)){o=t;break}let s={svg:`<g data-prop>${QP[o]({c:i,d:a})}</g>`,w:80,h:80,icon:o,cached:!1};return eF.set(t,{...s,cached:!0}),s}function XP(e){return e?e.source===`coded`?{svg:`<g data-prop>${(tF[e.ref]||tF.box)()}</g>`,w:90,h:100}:YP(e.prompt||e.ref||`object`):null}function ZP(e,t,n,r=1){let i=r;if(e===`hoverIdle`){let e=Math.sin(n*1.6)*6;return{x:t.x,y:t.y+e,scale:i,shadow:`breathe`,floatY:e}}return e===`pinned`?{x:t.x,y:t.y,scale:i,shadow:`none`}:e===`planeAt`?{x:t.x,y:t.y,scale:i,shadow:`soft`}:{x:t.x,y:t.y,scale:i,shadow:`contact`}}var QP,$P,eF,tF,nF=o((()=>{pO(),QP={coin:e=>`<g><ellipse cx="0" cy="-30" rx="30" ry="30" fill="${e.c}"/><ellipse cx="0" cy="-30" rx="22" ry="22" fill="none" stroke="${e.d}" stroke-width="3"/><text x="0" y="-22" font-size="26" font-weight="800" text-anchor="middle" fill="${e.d}">$</text></g>`,card:e=>`<g><rect x="-38" y="-52" width="76" height="48" rx="7" fill="${e.c}"/><rect x="-38" y="-40" width="76" height="10" fill="${e.d}"/><rect x="-30" y="-18" width="30" height="6" rx="3" fill="#fff" opacity=".85"/></g>`,house:e=>`<g><rect x="-26" y="-42" width="52" height="42" rx="3" fill="${e.c}"/><path d="M-34 -42 L0 -70 L34 -42 Z" fill="${e.d}"/><rect x="-8" y="-24" width="16" height="24" fill="${e.d}"/></g>`,phone:e=>`<g><rect x="-20" y="-64" width="40" height="64" rx="8" fill="${e.c}"/><rect x="-15" y="-58" width="30" height="46" rx="2" fill="#dfe7ee"/><circle cx="0" cy="-7" r="3" fill="#dfe7ee"/></g>`,key:e=>`<g><circle cx="-16" cy="-46" r="14" fill="none" stroke="${e.c}" stroke-width="8"/><rect x="-6" y="-50" width="42" height="8" rx="3" fill="${e.c}"/><rect x="24" y="-42" width="8" height="12" fill="${e.c}"/></g>`,chart:e=>`<g><rect x="-34" y="-8" width="16" height="30" fill="${e.c}"/><rect x="-8" y="-40" width="16" height="62" fill="${e.d}"/><rect x="18" y="-24" width="16" height="46" fill="${e.c}"/></g>`,clock:e=>`<g><circle cx="0" cy="-34" r="30" fill="${e.c}"/><circle cx="0" cy="-34" r="24" fill="#fff" opacity=".9"/><line x1="0" y1="-34" x2="0" y2="-52" stroke="${e.d}" stroke-width="3"/><line x1="0" y1="-34" x2="14" y2="-34" stroke="${e.d}" stroke-width="3"/></g>`,bag:e=>`<g><path d="M-28 -48 Q-28 -60 0 -60 Q28 -60 28 -48 L34 -4 Q34 2 26 2 L-26 2 Q-34 2 -34 -4 Z" fill="${e.c}"/><path d="M-14 -50 Q-14 -66 0 -66 Q14 -66 14 -50" fill="none" stroke="${e.d}" stroke-width="4"/></g>`,generic:e=>`<g><rect x="-30" y="-58" width="60" height="56" rx="12" fill="${e.c}"/><circle cx="0" cy="-30" r="15" fill="${e.d}"/><rect x="-18" y="-14" width="36" height="7" rx="3.5" fill="${e.d}" opacity=".7"/></g>`},$P=[[`coin`,/coin|gold|money|cash/i],[`card`,/card|credit|debit/i],[`house`,/house|home|mortgage|building/i],[`phone`,/phone|mobile|cell/i],[`key`,/key|lock|access/i],[`chart`,/chart|graph|bar|stat/i],[`clock`,/clock|time|watch|hour/i],[`bag`,/bag|shop|purse|wallet/i]],eF=new Map,tF={bookshelf:()=>`<g><rect x="-40" y="-96" width="80" height="96" rx="3" fill="#8a6a45"/><rect x="-34" y="-90" width="68" height="26" fill="#a9855c"/><rect x="-34" y="-60" width="68" height="26" fill="#a9855c"/><rect x="-34" y="-30" width="68" height="26" fill="#a9855c"/>${[-30,-20,-10,2,12,22].map((e,t)=>`<rect x="${e}" y="${-86-t%2*0}" width="7" height="20" fill="${[`#c0563f`,`#3f7fc0`,`#3fae6b`,`#c9a13a`,`#8b5cf6`,`#e08a3a`][t]}"/>`).join(``)}</g>`,table:()=>`<g><rect x="-44" y="-30" width="88" height="10" rx="3" fill="#a9855c"/><rect x="-40" y="-20" width="8" height="20" fill="#8a6a45"/><rect x="32" y="-20" width="8" height="20" fill="#8a6a45"/></g>`,plant:()=>`<g><path d="M-12 0 L-8 -30 L8 -30 L12 0 Z" fill="#c98a3a"/><circle cx="0" cy="-44" r="20" fill="#3f8f63"/><circle cx="-14" cy="-38" r="13" fill="#4fa576"/><circle cx="14" cy="-40" r="12" fill="#357a53"/></g>`,sign:()=>`<g><rect x="-3" y="-40" width="6" height="40" fill="#8a6a45"/><rect x="-30" y="-72" width="60" height="34" rx="4" fill="#eef2f4" stroke="#c7d0d6" stroke-width="2"/></g>`,box:()=>`<g><rect x="-26" y="-48" width="52" height="48" rx="3" fill="#c39a5f"/><path d="M-26 -34 L26 -34" stroke="#9a7440" stroke-width="3"/><path d="M0 -48 L0 0" stroke="#9a7440" stroke-width="2"/></g>`,lamp:()=>`<g><rect x="-2" y="-58" width="4" height="58" fill="#5b636b"/><path d="M-18 -58 L18 -58 L10 -78 L-10 -78 Z" fill="#f2c14e"/></g>`,window:()=>`<g><rect x="-34" y="-64" width="68" height="64" rx="3" fill="#bfe3f2" stroke="#9fb3c0" stroke-width="4"/><path d="M0 -64 L0 0 M-34 -32 L34 -32" stroke="#9fb3c0" stroke-width="3"/></g>`,coin:()=>`<g><ellipse cx="0" cy="-16" rx="16" ry="16" fill="#e6b83a"/><ellipse cx="0" cy="-16" rx="11" ry="11" fill="none" stroke="#b5892a" stroke-width="2"/></g>`}}));function rF(e){let t=e.w||100,n=e.h||100,r=96/Math.max(t,n);return{svg:`<svg x="${(-t*r/2).toFixed(1)}" y="${(-n*r).toFixed(1)}" width="${(t*r).toFixed(1)}" height="${(n*r).toFixed(1)}" viewBox="0 0 ${t} ${n}" preserveAspectRatio="xMidYMax meet" overflow="visible">${e.inner}</svg>`,w:t*r,h:n*r}}var iF,aF,oF,sF=o((()=>{jO(),cA(),Bj(),JP(),mN(),fM(),NA(),UM(),nF(),DN(),JN(),sP(),rP(),hP(),Xj(),pO(),kd(),iF=`http://www.w3.org/2000/svg`,aF=()=>document.createElementNS(iF,`g`),oF=class{constructor(e){this.stage=e,this.canvas=document.createElement(`canvas`),this.canvas.className=`v2-bg`,this.svg=document.createElementNS(iF,`svg`),this.svg.setAttribute(`class`,`v2-hero`),this.svg.setAttribute(`preserveAspectRatio`,`xMidYMid meet`),this.boardG=aF(),this.world=aF(),this.extrasG=aF(),this.entitiesG=aF(),this.propsG=aF(),this.wfxG=aF(),this.world.append(this.extrasG,this.entitiesG,this.propsG,this.wfxG),this.stateG=aF(),this.world.appendChild(this.stateG),this.timeG=aF(),this.occG=aF(),this.weatherG=aF(),this.fx=aF(),this.sfxG=aF(),this.transG=aF(),this.wrG=aF(),this.svg.append(this.boardG,this.world,this.timeG,this.occG,this.weatherG,this.fx,this.sfxG,this.transG,this.wrG),this.overlay=document.createElement(`div`),this.overlay.className=`v2-overlay`,e.append(this.canvas,this.svg,this.overlay),this.ctx=this.canvas.getContext(`2d`),this.rigs=new Map,this.bubbleEls=new Map,this.cardEl=null,this._setupCache=new Map,this.assets=null,this._resize=()=>this._sizeCanvas(),window.addEventListener(`resize`,this._resize)}destroy(){window.removeEventListener(`resize`,this._resize),this.stage.innerHTML=``}setAspect(e){this._vbw=mO(e),this.svg.setAttribute(`viewBox`,`0 0 ${this._vbw} 640`),this._sizeCanvas()}setAssets(e){return this.assets=e||null,this}_sizeCanvas(){let e=this.stage.getBoundingClientRect(),t=Math.min(2,window.devicePixelRatio||1);this.canvas.width=Math.max(1,Math.round(e.width*t)),this.canvas.height=Math.max(1,Math.round(e.height*t))}_setup(e){let t=e.name+`:`+e.seed+`:`+e.mode+`:`+(e.palette||`day`);return this._setupCache.has(t)||this._setupCache.set(t,BA(e.name,e.seed,e.mode,e.palette)),this._setupCache.get(t)}_rig(e,t,n){let r=kO(n)?`profile`:`flat`,i=this.rigs.get(e);if(i&&i.family!==r&&(i.rig.remove(),i=null),!i){let t=hO(r===`profile`?`right`:`front`);this.world.appendChild(t),i={rig:t,paintKey:null,family:r},this.rigs.set(e,i)}let a=JSON.stringify(t);return a!==i.paintKey&&(Qk(i.rig,t),i.paintKey=a),i.rig}_groundY(){let e=this.svg.getScreenCTM();if(!e)return this.canvas.height*.9;let t=this.svg.createSVGPoint();t.x=0,t.y=592;let n=this.stage.getBoundingClientRect(),r=this.canvas.height/Math.max(1,n.height);return K((t.matrixTransform(e).y-n.top)*r,this.canvas.height*.5,this.canvas.height*.98)}render(e){this._aspect!==e.aspect&&(this._aspect=e.aspect,this.setAspect(e.aspect)),this.canvas.width<2&&this._sizeCanvas(),this._t=e.t,this.world.setAttribute(`transform`,oN(e.camera.view,this._vbw));let t=e.camera.view.whip||0;this.world.style.filter=t>.05?`blur(${(t*4).toFixed(1)}px)`:``;let n=this.canvas.width,r=this.canvas.height,i=this._groundY();this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,n,r),e.board?this._board(e):(this.boardG.innerHTML=``,e.background.from&&(this.ctx.globalAlpha=1,VA(this.ctx,this._setup(e.background.from),n,r,i,e.camera.bgCam,e.t)),this.ctx.globalAlpha=e.background.from?e.background.mix:1,VA(this.ctx,this._setup(e.background.to),n,r,i,e.camera.bgCam,e.t),this.ctx.globalAlpha=1),this.extrasG.innerHTML=(e.extras||[]).map(t=>{let n=t.depthScale*.82,r=512+(t.yShift||0),i=Math.sin(e.t*.9+t.phase)*3;return`<g transform="translate(${(t.x+i).toFixed(1)} ${r.toFixed(1)}) scale(${n.toFixed(3)})" opacity="${(t.opacity*.85).toFixed(3)}"><ellipse cx="0" cy="6" rx="42" ry="10" fill="#000" opacity="0.06"/><rect x="-32" y="-150" width="64" height="150" rx="30" fill="${t.shirt}"/><circle cx="0" cy="-178" r="31" fill="#d9ac88"/></g>`}).join(``),this.entitiesG.innerHTML=(e.entities||[]).slice().sort((e,t)=>t.z-e.z).map(e=>{if(e.kind===`placeholder`){let t=this.assets&&e.source?this.assets[e.source]:null,n=t?jN(e,t):LN(e);return`<g transform="translate(${e.x.toFixed(1)} ${e.y.toFixed(1)})" opacity="${e.opacity.toFixed(3)}"${e.blur>.3?` style="filter:blur(${e.blur.toFixed(1)}px)"`:``}>${n}</g>`}return e.kind===`formation`?this._formationSvg(e):``}).join(``),this.propsG.innerHTML=(e.props||[]).map(t=>{let n=t.spec&&t.spec.cache&&this.assets?this.assets[t.spec.cache]:null,r=n?rF(n):XP(t.spec);if(!r)return``;let i=ZP(t.presentation,{x:t.x,y:t.y},e.t,t.depthScale||1),a=i.shadow===`none`?``:`<ellipse cx="0" cy="2" rx="34" ry="8" fill="#000" opacity="${i.shadow===`breathe`?(.12+.04*Math.sin(e.t*1.6)).toFixed(3):`0.12`}"/>`;return`<g transform="translate(${t.x.toFixed(1)} ${i.y.toFixed(1)}) scale(${i.scale.toFixed(3)})">${a}${r.svg}</g>`}).join(``);let a=new Set(e.cast.map(e=>e.ref)),o=!(e.style&&e.style.shadow===!1);this.rigs.forEach((e,t)=>{a.has(t)||e.rig.setAttribute(`opacity`,`0`)}),e.cast.forEach(e=>{let t=this._rig(e.ref,e.params,e.facing);t.setAttribute(`opacity`,String(e.opacity==null?1:e.opacity)),t.style.filter=e.blur>.3?`blur(${e.blur.toFixed(1)}px)`:``,gO(t,e.pose,rA(e.params,e.rigX,{facing:e.facing,squash:e.squash,depthScale:e.depthScale,yShift:e.yShift}));let n=AO(t,`shadow`);n&&n.setAttribute(`opacity`,o?`0.10`:`0`),this.world.appendChild(t)}),this.stateG.innerHTML=(e.cast||[]).filter(e=>e.states&&e.states.length).map(t=>{let n=592-458*t.depthScale+t.yShift;return`<g transform="translate(${t.rigX.toFixed(1)} ${n.toFixed(1)}) scale(${t.depthScale.toFixed(3)})" opacity="${(t.opacity==null?1:t.opacity).toFixed(2)}">${cP(t.states,e.t)}</g>`}).join(``),this.world.appendChild(this.stateG),this.wfxG.innerHTML=(e.effects||[]).filter(e=>e.space===`world`).map(t=>`<g transform="translate(${t.x.toFixed(1)} ${t.y.toFixed(1)})">${YN(t,t.p,e.t)}</g>`).join(``),this.world.appendChild(this.wfxG),this.sfxG.innerHTML=(e.effects||[]).filter(e=>e.space===`screen`).map(t=>YN(t,t.p,e.t)).join(``),this.fx.innerHTML=(e.overlays||[]).map(t=>`<g transform="translate(${t.x.toFixed(1)} ${t.y.toFixed(1)})">${hN(t,t.p,e.t)}</g>`).join(``),this._timeGrade(e),this._weather(e),this._occluders(e),this._transition(e.transition),this._wordReveal(e);let s=new Set(e.bubbles.map(e=>e.ref));this.bubbleEls.forEach((e,t)=>{s.has(t)||(e.style.display=`none`)}),e.bubbles.forEach(t=>this._bubble(t,e)),this._card(e.cards[0],e)}_board(e){let t=e.board,n=e.camera.pan||{x:t.worldW/2,y:t.worldH/2,scale:1,rotation:0},r=this._vbw/t.viewW,i=640/t.viewH;this.boardG.setAttribute(`transform`,`scale(${r.toFixed(4)} ${i.toFixed(4)})`),this.boardG.innerHTML=t.planes.map(r=>{let i=r.depth===1&&t.focusRing&&t.ring?TA(t.ring.x,t.ring.y,e.t):``;return`<g transform="${rM(n,r.depth,t.viewW,t.viewH)}">${r.svg}${i}</g>`}).join(``)}_timeGrade(e){let t=e.timeGrade;if(!t){this.timeG.innerHTML=``;return}let n=e.VBW,r=t.sun.a>.01?`<circle cx="${t.sun.x.toFixed(1)}" cy="${t.sun.y.toFixed(1)}" r="58" fill="#ffe08a" opacity="${(t.sun.a*.18).toFixed(2)}"/><circle cx="${t.sun.x.toFixed(1)}" cy="${t.sun.y.toFixed(1)}" r="34" fill="#ffe79a" opacity="${t.sun.a.toFixed(2)}"/>`:``,i=t.moon.a>.01?`<circle cx="${t.moon.x.toFixed(1)}" cy="${t.moon.y.toFixed(1)}" r="24" fill="#eef2f8" opacity="${t.moon.a.toFixed(2)}"/>`:``;this.timeG.innerHTML=`<defs><linearGradient id="v2tg" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="${t.top}"/><stop offset="1" stop-color="${t.bot}"/></linearGradient></defs><rect x="0" y="0" width="${n}" height="640" fill="url(#v2tg)" opacity="${t.alpha.toFixed(3)}"/>${r}${i}`}_weather(e){this.weatherG.innerHTML=e.weather?Vj(e.weather,e.t,e.VBW):``}_occluders(e){if(!e.camera||!e.camera.traveling){this.occG.innerHTML=``;return}let t=this._vbw,n=(1.2-e.t/.9%1*1.4)*t;this.occG.innerHTML=`<defs><linearGradient id="occEdgeL" x1="0" y1="0" x2="1" y2="0"><stop offset="0" stop-color="#0e1622" stop-opacity="0.26"/><stop offset="1" stop-color="#0e1622" stop-opacity="0"/></linearGradient><linearGradient id="occEdgeR" x1="1" y1="0" x2="0" y2="0"><stop offset="0" stop-color="#0e1622" stop-opacity="0.26"/><stop offset="1" stop-color="#0e1622" stop-opacity="0"/></linearGradient><filter id="occBlur" x="-40%" y="-40%" width="180%" height="180%"><feGaussianBlur stdDeviation="7"/></filter></defs><rect x="0" y="0" width="${(t*.17).toFixed(0)}" height="640" fill="url(#occEdgeL)"/><rect x="${(t*.83).toFixed(0)}" y="0" width="${(t*.17).toFixed(0)}" height="640" fill="url(#occEdgeR)"/><rect x="${n.toFixed(1)}" y="0" width="30" height="640" rx="10" fill="#0e1622" opacity="0.13" filter="url(#occBlur)"/>`}_wordReveal(e){if(e.mode!==`wordReveal`){this.wrG.innerHTML&&(this.wrG.innerHTML=``);return}let t=e.wordReveal||{},n=this._vbw,r=n/2,i=t.background||`#12151a`,a=e=>String(e).replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`),o=``;if(t.trail&&t.trail.entries?.length){let e=t.trail.entries.find(e=>e.role===`current`),i=Math.max(40,Math.min(132,n*.9/Math.max(3,(e?.text||``).length*.62))),s=null;t.trail.layout===`inline`&&(s=xd({entries:t.trail.entries},e=>String(e).length*i*.62,{maxWidth:n*.9,spaceW:i*.28,lineH:i*1.15,trailExit:t.trail.exit}));let c=t.trail.muteColor||`#8e8a80`;o=[...t.trail.entries].sort((e,t)=>t.slot-e.slot).map(e=>{let n=e.role===`current`,o=n?e.transform:null,l=s?s.get(e.wordIndex)||{x:0,y:0}:{x:e.dx*i,y:e.dy*i},u=e.scale*(o?o.scale:1)*(n&&e.emphasized?1.28:1),d=o&&o.ty?o.ty*640:0,f=e.emphasized?t.accent||`#ffd400`:_d(`#f4f6f8`,c,e.muteP),p=Math.max(0,Math.min(1,e.opacity*(o?o.opacity:1)));return`<g transform="translate(${(r+l.x).toFixed(1)} ${(300+l.y+d).toFixed(1)}) scale(${u.toFixed(3)}) rotate(${(o&&o.rot||0).toFixed(1)})" opacity="${p.toFixed(2)}"><text x="0" y="0" text-anchor="middle" dominant-baseline="central" font-family="Nunito,system-ui,sans-serif" font-weight="900" font-size="${i.toFixed(1)}" fill="${f}">${a(e.text)}</text></g>`}).join(``)}else if(t.word){let e=t.word,i=Math.max(40,Math.min(132,n*.9/Math.max(3,e.length*.62))),s=t.emphasized?1.28:1,c=t.emphasized?t.accent||`#ffd400`:`#f4f6f8`;o=`<g transform="translate(${r.toFixed(1)} ${(300+(t.ty||0)*640).toFixed(1)}) scale(${((t.scale==null?1:t.scale)*s).toFixed(3)}) rotate(${(t.rot||0).toFixed(1)})" opacity="${(t.opacity==null?1:t.opacity).toFixed(2)}"><text x="0" y="0" text-anchor="middle" dominant-baseline="central" font-family="Nunito,system-ui,sans-serif" font-weight="900" font-size="${i.toFixed(1)}" fill="${c}">${a(e)}</text></g>`}this.wrG.innerHTML=`<rect x="0" y="0" width="${n}" height="640" fill="${i}"/>${o}`}_transition(e){if(!e){this.transG.innerHTML=``;return}if(e.harness){let t=vM(e.spec,e.p,{VBW:this._vbw,bridge:e.bridge,subjectFrom:e.subjectFrom,subjectTo:e.subjectTo,subject:e.subjectFrom});this.transG.innerHTML=t.cover;return}let t=this._vbw,n=`#0d1220`,r=e.direction===`right`?1:-1,i=e.p,a=``;if(e.type===`flash`){let n=Math.max(0,1-i*1.1),r=e.tint||`#ffffff`,o=(i*1.5-.25)*t;a=`<rect x="0" y="0" width="${t}" height="640" fill="${r}" opacity="${n.toFixed(3)}"/><path d="M ${o.toFixed(1)} -20 l ${120 .toFixed(1)} 0 l ${(-80).toFixed(1)} ${680 .toFixed(1)} l ${(-120).toFixed(1)} 0 z" fill="${r}" opacity="${(n*.85).toFixed(3)}"/>`}else if(e.type===`fade`)a=`<rect x="0" y="0" width="${t}" height="640" fill="${n}" opacity="${(.55*(1-i)).toFixed(3)}"/>`;else if(e.type===`slide`)a=`<rect x="${(r*i*t).toFixed(1)}" y="0" width="${t}" height="640" fill="${n}" opacity="0.92"/>`;else if(e.type===`irisWipe`){let e=i*Math.hypot(t,640)*.62;a=`<path fill-rule="evenodd" d="M0 0 H ${t} V 640 H 0 Z M ${t/2} 320 m ${(-e).toFixed(1)} 0 a ${e.toFixed(1)} ${e.toFixed(1)} 0 1 0 ${(2*e).toFixed(1)} 0 a ${e.toFixed(1)} ${e.toFixed(1)} 0 1 0 ${(-2*e).toFixed(1)} 0" fill="${n}"/>`}else if(e.type===`whipPan`){let e=Math.sin(i*Math.PI);for(let r=0;r<8;r++){let o=r/8*640,s=(i*1.6-.3)*t+(r%2?20:-20);a+=`<rect x="${s.toFixed(1)}" y="${o.toFixed(1)}" width="${(t*.5).toFixed(1)}" height="${81 .toFixed(1)}" fill="${n}" opacity="${(e*.5).toFixed(2)}"/>`}}else if(e.type===`doorPass`){let e=t/2*i;a=`<rect x="${(-e).toFixed(1)}" y="0" width="${(t/2).toFixed(1)}" height="640" fill="${n}"/><rect x="${(t/2+e).toFixed(1)}" y="0" width="${(t/2).toFixed(1)}" height="640" fill="${n}"/>`}else if(e.type===`objectWipe`){let e=t*.45;a=`<rect x="${(-e+i*(t+2*e)).toFixed(1)}" y="-20" width="${e.toFixed(1)}" height="${680 .toFixed(1)}" rx="18" fill="${n}"/>`}else if(e.type===`matchDissolve`)a=`<rect x="0" y="0" width="${t}" height="640" fill="${n}" opacity="${(Math.sin(i*Math.PI)*.5).toFixed(3)}"/>`;else{let o=Math.max(2,e.bands||4),s=t/o;for(let e=0;e<o;e++){let o=r*K((i-e*.12)/.6,0,1)*t;a+=`<rect x="${(e*s+o).toFixed(1)}" y="0" width="${(s+1).toFixed(1)}" height="640" fill="${n}"/>`}}this.transG.innerHTML=a}_formationSvg(e){let t=this._t||0;return(e.units||[]).map(e=>`<g transform="translate(${e.x.toFixed(1)} ${e.y.toFixed(1)})">${aP(e,t)}</g>`).join(``)}_bubble(e,t){let n=this.bubbleEls.get(e.ref);n||(n=document.createElement(`div`),n.className=`v2-bubble`,n.innerHTML=`<span class="txt"></span><i class="tail"></i>`,this.overlay.appendChild(n),this.bubbleEls.set(e.ref,n));let r=this.rigs.get(e.ref);if(!r){n.style.display=`none`;return}let i=AO(r.rig,`head`).getBoundingClientRect(),a=this.stage.getBoundingClientRect();if(!i.width){n.style.display=`none`;return}let o={cx:i.left+i.width/2-a.left,midY:i.top+i.height/2-a.top,h:i.height},s=GP(K(o.h/135,.6,2),a.width);n.querySelector(`.txt`).textContent=e.text.slice(0,qP(e.text,t.t-e.tStart))||` `,Object.assign(n.style,{display:`inline-block`,fontSize:s.fontPx+`px`,padding:s.padY+`px `+s.padX+`px`,maxWidth:s.maxWidth+`px`,borderRadius:s.radius+`px`,zIndex:String(20+Math.round((1-(e.z==null?.5:e.z))*40))});let c=n.offsetWidth,l=n.offsetHeight,u=KP(o,{w:a.width,h:a.height},{x:0,y:-.9},c,l,s);n.style.left=u.left+`px`,n.style.top=u.top+`px`;let d=n.querySelector(`.tail`);d.className=`tail `+u.tail.side,d.style.left=u.tail.left==null?``:u.tail.left+`px`,d.style.top=u.tail.top==null?``:u.tail.top+`px`}_card(e,t){if(!e){this.cardEl&&(this.cardEl.style.display=`none`);return}this.cardEl||(this.cardEl=document.createElement(`div`),this.overlay.appendChild(this.cardEl));let n=!!e.full;this.cardEl.className=(n?`v2-card-full `:`v2-card `)+(e.tone===`dark`?`v2-card-dark`:`v2-card-light`),this.cardEl.textContent=e.text,this.cardEl.style.display=n?`flex`:`block`}}})),cF,lF,uF,dF,fF,pF=o((()=>{cF={flat:{amb:1,dir:0,len:1},soft:{amb:.85,dir:.4,len:1.4},dramatic:{amb:.5,dir:.9,len:2.6},night:{amb:.35,dir:.6,len:2.2},screenlit:{amb:.6,dir:.5,len:1.2}},lF=[`phone`,`laptop`,`monitor`,`tablet`],uF={condition:[`new`,`worn`,`rusted`,`broken`],fill:[`empty`,`full`],growth:[`seed`,`sprout`,`tree`],temperature:[`cold`,`hot`],damage:[`whole`,`cracked`,`shattered`],life:[`fresh`,`wilted`],size:[`small`,`large`],power:[`dark`,`lit`]},dF=[`stream`,`emitToTarget`,`flowField`,`converge`,`disperse`,`counted`],fF={V1_lighting:{renderers:[`lightShadow`,`glowSvg`,`rimSvg`,`shaftsSvg`,`ambientOcclusion`],looks:Object.keys(cF)},V2_liquids:{renderers:[`fillSvg`,`pourSvg`,`waveSvg`,`dripSvg`,`glassSvg`,`metalSvg`,`wetSvg`]},V3_fire:{renderers:[`flameSvg`,`smokeSvg`,`sparkSvg`,`explosionSvg`,`steamSvg`]},V4_dataviz:{renderers:[`plotOverTime`,`barRace`,`pieGrow`,`sankeySvg`,`scatterSvg`,`networkSvg`,`mapChoropleth`]},V5_type:{renderers:[`wordPop`,`numberMorph`,`kineticHeadline`,`typewriter`,`highlightSweep`,`maskReveal`,`textPath`]},V6_ui:{renderers:[`deviceFrame`,`fakeUI`,`chatThread`,`codeType`,`browserBar`,`notification`],frames:lF},V7_state:{renderers:[`stateChange`],stateSets:Object.keys(uF)},V8_weather:{renderers:[`wetGroundSvg`,`snowAccumulationSvg`,`windEffect`,`fogBankSvg`,`wetCharacterTint`]},V9_continuity:{renderers:[`carryObject`,`motionCarry`,`thematicReprise`]},V10_particles:{renderers:[`particleFlow`,`trailRibbon`],modes:dF}},Object.keys(fF)})),mF,hF,gF,_F,vF,yF,bF,xF,SF,CF,wF,TF,EF,DF=o((()=>{({sin:mF,cos:hF,PI:gF,pow:_F,abs:vF,min:yF,max:bF,exp:xF}=Math),SF=[`anticipate`,`overshootSettle`,`snap`,`punch`,`drift`,`cushion`,`elastic`,`linearIntentional`,`flat`],CF={primary:{durS:.65,feel:`overshootSettle`,hold:!0},secondary:{durS:.3,feel:`snap`,hold:!1},ambient:{durS:1.1,feel:`drift`,hold:!1},emphasis:{durS:.18,feel:`punch`,hold:!0}},wF=Object.keys(CF),TF={polished:{tierFeel:{primary:`overshootSettle`,secondary:`snap`,ambient:`drift`,emphasis:`punch`},staggerMs:75,secondaryMotion:!0,rhythm:1},calm:{tierFeel:{primary:`cushion`,secondary:`drift`,ambient:`drift`,emphasis:`overshootSettle`},staggerMs:110,secondaryMotion:!0,rhythm:.4},energetic:{tierFeel:{primary:`punch`,secondary:`snap`,ambient:`snap`,emphasis:`punch`},staggerMs:50,secondaryMotion:!0,rhythm:1.6},flat:{tierFeel:{primary:`flat`,secondary:`flat`,ambient:`flat`,emphasis:`flat`},staggerMs:0,secondaryMotion:!1,rhythm:0}},EF=Object.keys(TF)})),OF,kF,AF,jF=o((()=>{OF=[`number`,`process`,`comparison`,`thing`,`place`,`person`,`changeOverTime`,`causeEffect`,`concept`,`emphasis`,`list`,`warning`],kF={number:[{id:`counter`,uses:`V4 counter`,note:`the value counts up`},{id:`proportionFill`,uses:`V2 fill / pie`,note:`a proportion filled truthfully`},{id:`oneBigNumber`,uses:`V5 numberMorph`,note:`one big number, held`}],process:[{id:`stepPath`,uses:`method stepPath`,note:`literal ordered sequence`},{id:`causeArrowChain`,uses:`device causeArrowChain`,note:`A→B→C arrows`},{id:`explodedCutaway`,uses:`method explodedView`,note:`exploded / cutaway`}],comparison:[{id:`splitScreen`,uses:`setup split`,note:`both, side by side`},{id:`sideBySideScaled`,uses:`prominence rule`,note:`sized truthfully`},{id:`barCompare`,uses:`V4 barRace`,note:`bars compared`}],thing:[{id:`heroShot`,uses:`placeholder / prop focal`,note:`one clear hero shot`},{id:`labeledObject`,uses:`device connectorLine`,note:`the object, labeled`}],place:[{id:`establishSetup`,uses:`scenes setup`,note:`the place, established`}],person:[{id:`castInRole`,uses:`wardrobe + action`,note:`right wardrobe, relevant action`}],changeOverTime:[{id:`timeline`,uses:`device timelineTicker`,note:`the timeline`},{id:`beforeAfter`,uses:`V7 stateChange`,note:`before / after`},{id:`timeLapse`,uses:`timeRamp`,note:`time-lapse the delta`}],causeEffect:[{id:`arrowAtoB`,uses:`overlay arrow`,note:`A → B`},{id:`domino`,uses:`V10 stream`,note:`domino / chain`},{id:`effectResults`,uses:`V7 stateChange`,note:`the effect visibly resulting`}],concept:[{id:`lightMetaphor`,uses:`ONE metaphor slot`,note:`⚠ only if no literal image exists — instantly readable`},{id:`literalExemplar`,uses:`a concrete example`,note:`show one concrete instance instead`}],emphasis:[{id:`justType`,uses:`V5 + punch feel`,note:`big text + punch + hold — sometimes JUST type`},{id:`bigNumberHold`,uses:`V5 numberMorph`,note:`the number, held`}],list:[{id:`sequentialReveal`,uses:`stagger + numbered`,note:`items reveal in order, numbered`}],warning:[{id:`alertTreatment`,uses:`device alert + red accent`,note:`red accent, consequence shown`},{id:`consequenceShown`,uses:`V7 stateChange`,note:`the consequence visibly`}]},AF=e=>kF[e]||kF.thing,Object.fromEntries(OF.map(e=>[e,AF(e).map(e=>e.id)]))})),MF,NF,PF,FF,IF,LF,RF,zF,BF,VF,HF,UF,WF=o((()=>{Bj(),JN(),UO(),hP(),Xj(),rP(),DN(),NA(),qk(),pF(),DF(),jF(),MF=Object.keys(cF),NF=lF,PF=Object.keys(uF),FF=dF,IF=fF.V4_dataviz.renderers,LF=fF.V5_type.renderers,RF=[`editorial`,`energetic`,`calm`,`doc`,`documentary`,`dramatic`,`warfilm`],zF=[`panTo`,`punchTo`,`follow`,`hop`,`travel`,`zoomOut`,`establish`,`orbitLite`,`snapZoom`],BF=[`carry`,`fade`,`slide`,`shapeWipe`,`flash`,`irisWipe`,`whipPan`,`doorPass`,`objectWipe`,`matchDissolve`],VF=[`walkIn`,`runIn`,`fadeIn`,`present`,`popIn`,`dropIn`,`riseFrom`,`carryOver`],HF=[`front`,`back`,`left`,`right`],UF=[{path:`setup.name`,type:`enum`,options:Lj,default:`openField`,group:`World`,label:`Setup`},{path:`setup.palette`,type:`enum`,options:ZA,default:`day`,group:`World`,label:`Palette`},{path:`setup.mode`,type:`enum`,options:[`2.5d`,`2d`],default:`2.5d`,group:`World`,label:`Depth mode`},{path:`setup.seed`,type:`number`,min:0,max:9999,step:1,default:7,group:`World`,label:`Seed`},{path:`entity.face`,type:`enum`,options:HN,default:`assetBox`,group:`Placeholder`,label:`Face`},{path:`entity.label`,type:`text`,default:``,group:`Placeholder`,label:`Label`},{path:`entity.size`,type:`enum`,options:[`S`,`M`,`L`],default:`M`,group:`Placeholder`,label:`Size`},{path:`entity.plane`,type:`number`,min:0,max:1,step:.01,default:.5,group:`Placeholder`,label:`Plane (z)`},{path:`entity.x`,type:`number`,min:0,max:1,step:.01,default:.5,group:`Placeholder`,label:`X`},{path:`entity.placement`,type:`enum`,options:BN,default:`ground`,group:`Placeholder`,label:`Placement`},{path:`entity.tint`,type:`color`,default:`#4a5a6b`,group:`Placeholder`,label:`Tint`},{path:`entity.source`,type:`enum`,options:[`placeholder`,`asset`],default:`placeholder`,group:`Placeholder`,label:`Source`},{path:`cast.action`,type:`enum`,options:VO,default:`idle`,group:`Performance`,label:`Action`},{path:`cast.state`,type:`enum`,options:lP,default:[],multi:!0,group:`Performance`,label:`State overlays`},{path:`cast.facing`,type:`enum`,options:HF,default:`front`,group:`Performance`,label:`Facing`},{path:`cast.enter.type`,type:`enum`,options:VF,default:`walkIn`,group:`Performance`,label:`Entrance`},{path:`effect.type`,type:`enum`,options:XN,default:`burst`,group:`Effects`,label:`Effect`},{path:`effect.tint`,type:`color`,default:`#ffd27a`,group:`Effects`,label:`Effect tint`},{path:`effect.intensity`,type:`number`,min:0,max:1,step:.05,default:.6,group:`Effects`,label:`Intensity`},{path:`setup.weather`,type:`enum`,options:[`none`,...qj],default:`none`,group:`Weather`,label:`Weather`},{path:`setup.weather.intensity`,type:`enum`,options:[`light`,`storm`],default:`light`,group:`Weather`,label:`Intensity`},{path:`setup.timeRamp.from`,type:`enum`,options:ZA,default:`goldenHour`,group:`Weather`,label:`Time ramp — from`},{path:`setup.timeRamp.to`,type:`enum`,options:ZA,default:`night`,group:`Weather`,label:`Time ramp — to`},{path:`setup.timeRamp.overPhrases`,type:`number`,min:1,max:12,step:1,default:2,group:`Weather`,label:`Time ramp — over phrases`},{path:`overlay.type`,type:`enum`,options:TN,default:`counter`,group:`Overlays`,label:`Overlay`},{path:`overlay.anchor`,type:`text`,default:`skyBand`,group:`Overlays`,label:`Anchor`},{path:`overlay.value`,type:`number`,min:0,max:1e3,step:1,default:60,group:`Overlays`,label:`Value`},{path:`overlay.label`,type:`text`,default:``,group:`Overlays`,label:`Label`},{path:`overlay.tint`,type:`color`,default:`#2BB3A3`,group:`Overlays`,label:`Overlay tint`},{path:`card.type`,type:`enum`,options:EN,default:`titleCard`,group:`Overlays`,label:`Structural card`},{path:`camera.idle`,type:`enum`,options:[`focusFlow`,`drift`,`locked`],default:`focusFlow`,group:`Camera`,label:`Idle motion`},{path:`camera.stylePreset`,type:`enum`,options:RF,default:`editorial`,group:`Camera`,label:`Style preset`},{path:`camera.directive`,type:`enum`,options:zF,default:`establish`,group:`Camera`,label:`Directive`},{path:`transitionOut.type`,type:`enum`,options:BF.concat([`irisObject`,`strokeSweep`,`slabWipe`,`curtainFall`,`lightWash`,`bandWipe`,`carryTravel`]),default:`carry`,group:`Transitions`,label:`Transition out`},{path:`transitionOut.durationMs`,type:`number`,min:200,max:4e3,step:50,default:1200,group:`Transitions`,label:`Duration (ms)`},{path:`transitionOut.ease`,type:`enum`,options:[`linear`,`smooth`,`smoother`],default:`smoother`,group:`Transitions`,label:`Ease`},{path:`transitionOut.direction`,type:`enum`,options:[`L2R`,`R2L`,`T2B`,`B2T`,`radialIn`,`radialOut`],default:`L2R`,group:`Transitions`,label:`Direction`},{path:`transitionOut.colorMode`,type:`enum`,options:[`bridge`,`incoming`,`token`,`custom`],default:`bridge`,group:`Transitions`,label:`Colour mode`},{path:`transitionOut.carrySubject`,type:`text`,default:``,group:`Transitions`,label:`Carry subject (castId)`},{path:`sfx.name`,type:`text`,default:``,group:`Audio`,label:`SFX cue`},{path:`board.name`,type:`enum`,options:jA,default:`conceptTriptych`,group:`Boards`,label:`Board`},{path:`setup.element`,type:`bool`,default:!0,group:`Boards`,label:`Element (per manifest)`},{path:`camera.mode`,type:`enum`,options:[`generated`,`manual`,`hybrid`],default:`generated`,group:`PanControl`,label:`Camera mode`},{path:`camera.style`,type:`enum`,options:[`editorial`,`calm`,`energetic`,`dramatic`,`custom`],default:`editorial`,group:`PanControl`,label:`Shot style`},{path:`camera.seed`,type:`number`,min:0,max:9999,step:1,default:1,group:`PanControl`,label:`Shot seed`},{path:`camera.safeZone.enabled`,type:`bool`,default:!0,group:`PanControl`,label:`Safe-zone clamp`},{path:`camera.point.x`,type:`number`,min:-4e3,max:4e3,step:1,default:0,group:`PanControl`,label:`Point · X`},{path:`camera.point.y`,type:`number`,min:-4e3,max:4e3,step:1,default:0,group:`PanControl`,label:`Point · Y`},{path:`camera.point.zoom`,type:`number`,min:.5,max:3,step:.01,default:1,group:`PanControl`,label:`Point · zoom`},{path:`camera.point.rotation`,type:`number`,min:-6,max:6,step:.1,default:0,group:`PanControl`,label:`Point · rotation`},{path:`camera.point.time`,type:`number`,min:0,max:600,step:.1,default:0,group:`PanControl`,label:`Point · time`},{path:`camera.point.ease`,type:`enum`,options:[`linear`,`smooth`,`smoother`],default:`smoother`,group:`PanControl`,label:`Point · ease`},{path:`appearance.hair`,type:`enum`,options:yk,default:`crop`,group:`Wardrobe`,label:`Hair`},{path:`appearance.top`,type:`enum`,options:Kk.top,default:`tee`,group:`Wardrobe`,label:`Top`},{path:`appearance.sleeves`,type:`enum`,options:Kk.sleeves,default:`short`,group:`Wardrobe`,label:`Sleeves`},{path:`appearance.outerwear`,type:`enum`,options:Kk.outerwear,default:`none`,group:`Wardrobe`,label:`Outerwear`},{path:`appearance.bottom`,type:`enum`,options:Kk.bottom,default:`jeans`,group:`Wardrobe`,label:`Bottom`},{path:`appearance.footwear`,type:`enum`,options:Kk.footwear,default:`sneakers`,group:`Wardrobe`,label:`Footwear`},{path:`appearance.faceShape`,type:`enum`,options:jk,default:`oval`,group:`Wardrobe`,label:`Face shape`},{path:`appearance.facialHair`,type:`enum`,options:Pk,default:`none`,group:`Wardrobe`,label:`Facial hair`},{path:`appearance.glasses`,type:`enum`,options:Ik,default:`none`,group:`Wardrobe`,label:`Glasses`},{path:`appearance.topColor`,type:`color`,default:`#2b6cb0`,group:`Wardrobe`,label:`Top colour`},{path:`appearance.outerColor`,type:`color`,default:`#455a70`,group:`Wardrobe`,label:`Outerwear colour`},{path:`appearance.bottomColor`,type:`color`,default:`#37455a`,group:`Wardrobe`,label:`Bottom colour`},{path:`appearance.pack`,type:`enum`,options:Gk,default:`casual`,group:`Wardrobe`,label:`Wardrobe pack`},{path:`cast.ageHint`,type:`enum`,options:[`childYoung`,`child`,`teen`,`adult`,`elder`],default:`adult`,group:`Wardrobe`,label:`Age`},{path:`appearance.headwear`,type:`enum`,options:Rk,default:`none`,group:`Wardrobe`,label:`Headwear`},{path:`appearance.headwearColor`,type:`color`,default:`#37455a`,group:`Wardrobe`,label:`Headwear colour`},{path:`appearance.eyeShape`,type:`enum`,options:Bk,default:`round`,group:`Wardrobe`,label:`Eye shape`},{path:`appearance.eyeSpacing`,type:`number`,min:-1,max:1,step:.1,default:0,group:`Wardrobe`,label:`Eye spacing`},{path:`appearance.irisColor`,type:`color`,default:`#243038`,group:`Wardrobe`,label:`Iris colour`},{path:`appearance.lashes`,type:`bool`,default:!1,group:`Wardrobe`,label:`Lashes`},{path:`appearance.browShape`,type:`enum`,options:Hk,default:`flat`,group:`Wardrobe`,label:`Brow shape`},{path:`appearance.browThickness`,type:`number`,min:2,max:7,step:.5,default:4,group:`Wardrobe`,label:`Brow thickness`},{path:`appearance.browColor`,type:`color`,default:`#253038`,group:`Wardrobe`,label:`Brow colour`},{path:`appearance.freckles`,type:`bool`,default:!1,group:`Wardrobe`,label:`Freckles`},{path:`appearance.blush`,type:`bool`,default:!1,group:`Wardrobe`,label:`Blush`},{path:`appearance.earrings`,type:`bool`,default:!1,group:`Wardrobe`,label:`Earrings`},{path:`appearance.wrinkles`,type:`bool`,default:!1,group:`Wardrobe`,label:`Wrinkles (age)`},{path:`lighting.look`,type:`enum`,options:MF,default:`soft`,group:`Lighting`,label:`Lighting look`},{path:`lighting.light.type`,type:`enum`,options:[`sun`,`point`,`spot`,`ambient`],default:`sun`,group:`Lighting`,label:`Key light`},{path:`lighting.light.x`,type:`number`,min:0,max:1,step:.01,default:.3,group:`Lighting`,label:`Light X`},{path:`lighting.light.y`,type:`number`,min:0,max:1,step:.01,default:.1,group:`Lighting`,label:`Light Y (height)`},{path:`lighting.light.color`,type:`color`,default:`#fff2cc`,group:`Lighting`,label:`Light colour`},{path:`element.glow.color`,type:`color`,default:`#ffd27a`,group:`Lighting`,label:`Glow colour`},{path:`element.glow.radius`,type:`number`,min:0,max:200,step:5,default:60,group:`Lighting`,label:`Glow radius`},{path:`element.rim`,type:`bool`,default:!1,group:`Lighting`,label:`Rim light`},{path:`liquid.type`,type:`enum`,options:[`fill`,`pour`,`flow`,`drip`,`wave`],default:`fill`,group:`Materials`,label:`Liquid`},{path:`liquid.pct`,type:`number`,min:0,max:1,step:.01,default:.5,group:`Materials`,label:`Fill level`},{path:`liquid.color`,type:`color`,default:`#4aa3c4`,group:`Materials`,label:`Liquid colour`},{path:`material.shader`,type:`enum`,options:[`none`,`glass`,`metal`,`wet`],default:`none`,group:`Materials`,label:`Material`},{path:`fire.type`,type:`enum`,options:[`flame`,`smoke`,`spark`,`explosion`,`steam`],default:`flame`,group:`Fire`,label:`Fire/energy`},{path:`fire.size`,type:`number`,min:10,max:200,step:5,default:60,group:`Fire`,label:`Size`},{path:`smoke.variant`,type:`enum`,options:[`smolder`,`puff`,`billow`,`wisp`],default:`billow`,group:`Fire`,label:`Smoke variant`},{path:`dataviz.type`,type:`enum`,options:IF,default:`plotOverTime`,group:`Data-viz`,label:`Chart`},{path:`dataviz.data`,type:`text`,default:`[]`,group:`Data-viz`,label:`Data (JSON)`},{path:`type.effect`,type:`enum`,options:LF,default:`wordPop`,group:`Typography`,label:`Kinetic type`},{path:`type.text`,type:`text`,default:``,group:`Typography`,label:`Text`},{path:`type.stagger`,type:`number`,min:0,max:.5,step:.01,default:.15,group:`Typography`,label:`Stagger`},{path:`ui.device`,type:`enum`,options:NF,default:`phone`,group:`Screen/UI`,label:`Device frame`},{path:`ui.content`,type:`enum`,options:[`fakeUI`,`chatThread`,`codeType`,`browserBar`,`notification`,`graphOnScreen`],default:`fakeUI`,group:`Screen/UI`,label:`Screen content`},{path:`state.set`,type:`enum`,options:PF,default:`condition`,group:`Object-state`,label:`State set`},{path:`state.shakeIntensity`,type:`number`,min:0,max:20,step:1,default:6,group:`Object-state`,label:`Shake`},{path:`state.popScale`,type:`number`,min:1,max:2,step:.05,default:1.25,group:`Object-state`,label:`Pop scale`},{path:`weather.consequence`,type:`enum`,options:[`wetGround`,`snowAccumulation`,`windEffect`,`wetCharacter`,`fogBank`],default:`wetGround`,group:`Weather`,label:`Consequence`},{path:`weather.windStrength`,type:`number`,min:0,max:3,step:.1,default:1,group:`Weather`,label:`Wind strength`},{path:`continuity.mode`,type:`enum`,options:[`carryObject`,`motionCarry`,`thematicReprise`],default:`carryObject`,group:`Continuity`,label:`Carry mode`},{path:`particles.mode`,type:`enum`,options:FF,default:`stream`,group:`Particles`,label:`Flow mode`},{path:`particles.count`,type:`number`,min:1,max:300,step:1,default:20,group:`Particles`,label:`Count`},{path:`particles.particleType`,type:`enum`,options:[`dot`,`coin`,`arrow`],default:`dot`,group:`Particles`,label:`Particle`},{path:`particles.rate`,type:`number`,min:.1,max:4,step:.1,default:1,group:`Particles`,label:`Rate`},{path:`finish.profile`,type:`enum`,options:EF,default:`polished`,group:`Finish`,label:`Finish profile`},{path:`element.tier`,type:`enum`,options:wF,default:`secondary`,group:`Finish`,label:`Motion tier`},{path:`element.feel`,type:`enum`,options:SF,default:`flat`,group:`Finish`,label:`Feel (override)`},{path:`element.feelParams.overshootPct`,type:`number`,min:0,max:.4,step:.01,default:.08,group:`Finish`,label:`Overshoot %`},{path:`element.feelParams.windupPct`,type:`number`,min:0,max:.3,step:.01,default:.08,group:`Finish`,label:`Wind-up %`},{path:`element.feelParams.settleMs`,type:`number`,min:0,max:500,step:10,default:150,group:`Finish`,label:`Settle (ms)`},{path:`element.feelParams.intensity`,type:`number`,min:0,max:2,step:.1,default:1,group:`Finish`,label:`Feel intensity`},{path:`finish.staggerMs`,type:`number`,min:0,max:200,step:5,default:75,group:`Finish`,label:`Stagger (ms)`},{path:`finish.secondaryMotion`,type:`bool`,default:!0,group:`Finish`,label:`Secondary motion`},{path:`beat.simultaneous`,type:`bool`,default:!1,group:`Finish`,label:`Enter simultaneously`},{path:`beat.type`,type:`enum`,options:OF,default:`thing`,group:`Taste`,label:`Beat type`},{path:`beat.emphasis`,type:`bool`,default:!1,group:`Taste`,label:`Emphasis beat`},{path:`beat.focalSide`,type:`enum`,options:[`left`,`center`,`right`],default:`left`,group:`Taste`,label:`Focal position`},{path:`beat.deliberateCenter`,type:`bool`,default:!1,group:`Taste`,label:`Deliberate center`},{path:`beat.intensity`,type:`number`,min:0,max:1,step:.05,default:.4,group:`Taste`,label:`Beat intensity`}],Object.fromEntries(UF.map(e=>[e.path,e]))})),GF=o((()=>{WP(),sF(),Bj(),NA(),UO(),DN(),UM(),rP(),Xj(),hP(),JN(),cA(),WF()})),KF=o((()=>{GF()})),qF=o((()=>{GF(),new Set(Lj)})),JF=o((()=>{new Set(`the a an and or but of to in on at for with by from as is are was were be been it its this that these those they them their you your we our i he she his her not no yes so if then than into over about after before while when where why how what which who whom can could will would should may might must do does did have has had get got make makes made just very more most some any all each every one two three now here there also only even because through during them then meanwhile feel feels feeling think thinks really actually basically thing things stuff time times way ways`.split(` `))})),YF=o((()=>{JF(),new Set(`the a an and or of to in on at for with by from as is are was were it its this that your you our their about`.split(` `))}));function XF(e){return String(e||``).trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}function ZF(e,t=`flat`){return`${t}-${XF(e)}`}var QF=o((()=>{})),$F=o((()=>{YF(),new Set(`the a an and or of to in on at for with by from as is are was were it its this that so now then`.split(` `))})),eI=o((()=>{GF(),qF(),YF(),JF(),kd(),$F()})),tI=o((()=>{GF(),KF()})),nI=o((()=>{GF(),KF(),qF(),eI(),tI()}));function rI(e={}){let t=new Map(Object.entries(e));return{read:()=>Object.fromEntries(t),write:e=>{t.clear();for(let[n,r]of Object.entries(e))t.set(n,r)}}}function iI(){return{read(){try{return JSON.parse(localStorage.getItem(sI)||`{}`)||{}}catch{return{}}},write(e){try{localStorage.setItem(sI,JSON.stringify(e))}catch{}}}}function aI(){return typeof localStorage<`u`?iI():rI()}function oI(e=aI()){let t=()=>e.read();return{has(e){return Object.prototype.hasOwnProperty.call(t(),e)},get(e){return t()[e]||null},put(n,r){let i=t();return i[n]={inner:r.inner,w:r.w,h:r.h},e.write(i),n},keys(){return Object.keys(t())},resolverFor(e){let n=t(),r={};return e.forEach(e=>{n[e]&&(r[e]=n[e])}),r}}}var sI,cI=o((()=>{sI=`aivw.v2.assets`}));function lI(e,t,n={}){let r=n.style||`flat`,i=!1,a=(e.scenes||[]).map(e=>{if(!e.entities?.length)return e;let n=!1,a=e.entities.map(e=>{if(e.type!==`assetBox`&&e.type!==`placeholder`)return e;let i=XF(e.label);if(!i)return e;let a=ZF(i,r),o=t.has(a)?`${fI}${a}`:`placeholder`;return e.source===o?e:(n=!0,{...e,source:o})});return n?(i=!0,{...e,entities:a}):e});return i?{...e,scenes:a}:e}function uI(e){let t=new Set;return(e.scenes||[]).forEach(e=>(e.entities||[]).forEach(e=>{let n=mI(e.source);n&&t.add(n)})),(e.props||[]).forEach(e=>{let n=mI(e.cache);n&&t.add(n)}),[...t]}function dI(e,t){let n={};return uI(e).forEach(e=>{let r=t.get(e);r&&(n[`${fI}${e}`]=r)}),n}var fI,pI,mI,hI=o((()=>{QF(),fI=`vault:`,pI=e=>typeof e==`string`&&e.startsWith(fI),mI=e=>pI(e)?e.slice(6):null})),gI=o((()=>{QF(),cI(),hI()})),_I,vI=o((()=>{cI(),_I=oI(aI())}));function yI(e,t,n){return new Promise((t,n)=>{let r=new Blob([e],{type:`image/svg+xml;charset=utf-8`}),i=URL.createObjectURL(r),a=new Image;a.onload=()=>{URL.revokeObjectURL(i),t(a)},a.onerror=()=>{URL.revokeObjectURL(i),n(Error(`v2 svg raster failed`))},a.src=i})}function bI(e,t,n,r){let i=(t||[]).map(e=>e.text).filter(Boolean).join(` `).trim();if(!i)return;let a=Math.max(14,Math.round(r*.03));e.font=`700 ${a}px Nunito, system-ui, sans-serif`;let o=n*.86,s=i.split(/\s+/),c=[],l=``;for(let t of s){let n=l?`${l} ${t}`:t;e.measureText(n).width>o&&l?(c.push(l),l=t):l=n}l&&c.push(l);let u=a*1.3,d=a*.7,f=a*.5,p=Math.min(o+d*2,Math.max(...c.map(t=>e.measureText(t).width))+d*2),m=c.length*u+f*2,h=(n-p)/2,g=r-m-r*.06,_=Math.min(18,m/2);e.fillStyle=`rgba(20,24,30,0.82)`,e.beginPath(),e.moveTo(h+_,g),e.arcTo(h+p,g,h+p,g+m,_),e.arcTo(h+p,g+m,h,g+m,_),e.arcTo(h,g+m,h,g,_),e.arcTo(h,g,h+p,g,_),e.closePath(),e.fill(),e.fillStyle=`#f4f6f8`,e.textAlign=`center`,e.textBaseline=`middle`,c.forEach((t,r)=>e.fillText(t,n/2,g+f+u*(r+.5)))}function xI(e,t,n){let r=lI(e,_I),i=dI(r,_I),a=document.createElement(`div`);a.style.cssText=`position:fixed;left:-99999px;top:0;width:${t}px;height:${n}px;`,document.body.appendChild(a);let o=new oF(a);o.setAspect(r.meta?.aspect||`16:9`),o.setAssets(i),o.svg.setAttribute(`width`,String(t)),o.svg.setAttribute(`height`,String(n));let s=document.createElement(`canvas`);s.width=t,s.height=n;let c=s.getContext(`2d`),l=new XMLSerializer;return{width:t,height:n,async frameAt(e){let i=kP(r,Math.max(0,e));o.render(i),c.clearRect(0,0,t,n),c.fillStyle=`#0b0e12`,c.fillRect(0,0,t,n);try{c.drawImage(o.canvas,0,0,t,n)}catch{}try{let e=await yI(l.serializeToString(o.svg),t,n);c.drawImage(e,0,0,t,n)}catch{}return bI(c,i.bubbles,t,n),s},close(){try{o.destroy()}catch{}try{a.remove()}catch{}}}}var SI=o((()=>{nI(),gI(),vI()}));function CI(e,t,n,r,i){let a=e.createLinearGradient(0,0,0,n);a.addColorStop(0,r),a.addColorStop(1,i),e.fillStyle=a,e.fillRect(0,0,t,n)}function wI(e){let t=Math.sin(e*127.1+311.7)*43758.5453;return t-Math.floor(t)}function TI(e){let t=/^#?([0-9a-f]{6})$/i.exec(String(e||``).trim());if(!t)return null;let n=parseInt(t[1],16);return{r:n>>16&255,g:n>>8&255,b:n&255}}function EI(e,t,n){let r=TI(e),i=TI(t);if(!r||!i)return e;let a=e=>Math.round(r[e]+(i[e]-r[e])*n);return`rgb(${a(`r`)},${a(`g`)},${a(`b`)})`}function DI(e,t){let n=TI(e);return n?`rgba(${n.r},${n.g},${n.b},${t})`:`rgba(0,0,0,${t})`}function OI(e,t,n,r,i){let a,o,s,c,l;if(II(i)){let e=i[0]||zI[0],t=i[1]||zI[1];a=e,o=EI(e,t,.4),s=DI(t,.28),c=DI(t,.35),l=DI(t,0)}else a=`#0a1a3f`,o=`#123a8a`,s=`rgba(120,170,255,0.28)`,c=`rgba(80,140,255,0.35)`,l=`rgba(80,140,255,0)`;CI(e,t,n,a,o);let u=Math.max(28,Math.min(t,n)*.09),d=r*u*.35%u;e.lineWidth=Math.max(1,Math.min(t,n)*.0022),e.strokeStyle=s,e.beginPath();for(let r=-u+d%u;r<=t+u;r+=u)e.moveTo(r,0),e.lineTo(r,n);for(let r=-u+d;r<=n+u;r+=u)e.moveTo(0,r),e.lineTo(t,r);e.stroke();let f=e.createRadialGradient(t/2,n*.45,0,t/2,n*.45,Math.max(t,n)*.6);f.addColorStop(0,c),f.addColorStop(1,l),e.fillStyle=f,e.fillRect(0,0,t,n)}function kI(e,t,n,r){CI(e,t,n,`#050716`,`#0b1030`);let i=[{c:`rgba(90,220,200,0.55)`,fx:.07,fy:.05,px:.3,py:.35,r:.55},{c:`rgba(140,90,240,0.5)`,fx:.05,fy:.08,px:.7,py:.5,r:.6},{c:`rgba(60,140,255,0.5)`,fx:.09,fy:.06,px:.5,py:.7,r:.5},{c:`rgba(240,120,190,0.4)`,fx:.06,fy:.09,px:.4,py:.2,r:.45}];e.globalCompositeOperation=`lighter`;for(let a=0;a<i.length;a++){let o=i[a],s=t*(o.px+.18*Math.sin(r*o.fx*Math.PI*2+a)),c=n*(o.py+.16*Math.cos(r*o.fy*Math.PI*2+a*1.7)),l=Math.max(t,n)*o.r,u=e.createRadialGradient(s,c,0,s,c,l);u.addColorStop(0,o.c),u.addColorStop(1,`rgba(0,0,0,0)`),e.fillStyle=u,e.fillRect(0,0,t,n)}e.globalCompositeOperation=`source-over`}function AI(e,t,n,r){CI(e,t,n,`#1a1130`,`#2a0f3a`);let i=[{c:`rgba(255,120,80,0.55)`,bx:.25,by:.3},{c:`rgba(255,80,160,0.5)`,bx:.75,by:.28},{c:`rgba(120,90,255,0.5)`,bx:.7,by:.75},{c:`rgba(80,200,255,0.45)`,bx:.28,by:.72}];e.globalCompositeOperation=`lighter`;for(let a=0;a<i.length;a++){let o=i[a],s=t*(o.bx+.1*Math.sin(r*.15*Math.PI+a*1.3)),c=n*(o.by+.1*Math.cos(r*.13*Math.PI+a*.9)),l=Math.max(t,n)*(.5+.06*Math.sin(r*.2+a)),u=e.createRadialGradient(s,c,0,s,c,l);u.addColorStop(0,o.c),u.addColorStop(1,`rgba(0,0,0,0)`),e.fillStyle=u,e.fillRect(0,0,t,n)}e.globalCompositeOperation=`source-over`}function jI(e,t,n,r,i){let a;if(II(i)){let r=i[0]||BI[0],o=i[1]||BI[1];CI(e,t,n,r,EI(r,o,.18)),a=e=>DI(o,e)}else CI(e,t,n,`#0b1226`,`#152244`),a=e=>`rgba(150,190,255,${e})`;let o=n*1.25;e.globalCompositeOperation=`lighter`;for(let i=0;i<46;i++){let s=.4+wI(i)*.9,c=(.01+wI(i+99)*.04)*Math.min(t,n),l=(wI(i+7)+.05*Math.sin(r*.3+i))*t,u=n+c-(r*s*n*.06+wI(i+31)*o)%o,d=.15+wI(i+53)*.4,f=e.createRadialGradient(l,u,0,l,u,c);f.addColorStop(0,a(d)),f.addColorStop(1,a(0)),e.fillStyle=f,e.beginPath(),e.arc(l,u,c,0,Math.PI*2),e.fill()}e.globalCompositeOperation=`source-over`}function MI(e,t,n,r){CI(e,t,n,`#04122a`,`#0a2e4a`);for(let i of[{c:`rgba(30,140,200,0.5)`,amp:.05,base:.62,k:1.3,spd:.5},{c:`rgba(40,190,180,0.5)`,amp:.06,base:.72,k:1,spd:-.7},{c:`rgba(80,110,230,0.55)`,amp:.07,base:.82,k:.8,spd:.9}]){e.beginPath(),e.moveTo(0,n);let a=Math.max(6,t/120);for(let o=0;o<=t;o+=a){let a=o/t*Math.PI*2*i.k+r*i.spd,s=n*i.base+Math.sin(a)*n*i.amp;e.lineTo(o,s)}e.lineTo(t,n),e.closePath(),e.fillStyle=i.c,e.fill()}}function NI(e,t,n,r,i){let a=II(i),o=a?i[0]||VI[0]:`#e8e4da`,s=a?i[1]||VI[1]:`#57503f`,c=Math.floor(Math.max(0,Number(r)||0)/LI)%RI*977,l=Math.min(t,n)/360;CI(e,t,n,o,EI(o,s,.08));let u=e.createRadialGradient(t/2,n/2,Math.min(t,n)*.35,t/2,n/2,Math.max(t,n)*.75);u.addColorStop(0,DI(s,0)),u.addColorStop(1,DI(s,.1)),e.fillStyle=u,e.fillRect(0,0,t,n);for(let r=0;r<6;r++){let i=wI(c+11+r)*t,a=wI(c+23+r)*n,o=Math.max(t,n)*(.1+.16*wI(c+37+r)),l=e.createRadialGradient(i,a,0,i,a,o);l.addColorStop(0,DI(s,.055)),l.addColorStop(1,DI(s,0)),e.fillStyle=l,e.fillRect(0,0,t,n)}let d=Math.max(24,Math.min(t,n)*.075),f=(wI(c+3)-.5)*3*l,p=(wI(c+4)-.5)*3*l;e.lineWidth=Math.max(1,l*1.1),e.strokeStyle=DI(s,.16),e.beginPath();for(let r=-d+f;r<=t+d;r+=d)e.moveTo(r,0),e.lineTo(r,n);for(let r=-d+p;r<=n+d;r+=d)e.moveTo(0,r),e.lineTo(t,r);e.stroke(),e.fillStyle=DI(s,.5);for(let r=0;r<42;r++){let i=wI(c+101+r)*t,a=wI(c+211+r)*n,o=(.8+1.8*wI(c+307+r))*l;e.globalAlpha=.22+.38*wI(c+401+r),e.fillRect(i,a,o,o)}e.strokeStyle=DI(s,.3),e.lineWidth=Math.max(.6,l*.7);for(let r=0;r<14;r++){let i=wI(c+503+r)*t,a=wI(c+601+r)*n,o=wI(c+701+r)*Math.PI*2,s=(4+6*wI(c+809+r))*l;e.globalAlpha=.15+.2*wI(c+907+r),e.beginPath(),e.moveTo(i,a),e.lineTo(i+Math.cos(o)*s,a+Math.sin(o)*s),e.stroke()}for(let r=0;r<160;r++){let i=wI(c+1103+r)*t,a=wI(c+1301+r)*n,o=r%2==0;e.fillStyle=o?DI(s,1):`#ffffff`,e.globalAlpha=o?.04+.05*wI(c+1409+r):.05+.07*wI(c+1511+r),e.fillRect(i,a,l,l)}e.globalAlpha=1}function PI(e){if(typeof e!=`string`||!e.startsWith(`anim|`))return null;let[,t,...n]=e.split(`|`);return HI[t]?{key:t,colors:n}:null}function FI(e,t,n,r,i){let a=PI(t);return a?(HI[a.key].draw(e,n,r,Number(i)||0,a.colors),!0):!1}var II,LI,RI,zI,BI,VI,HI,UI=o((()=>{II=e=>Array.isArray(e)&&e.length>0,LI=.17,RI=8,zI=[`#0a1a3f`,`#3b7dff`],BI=[`#0b1226`,`#96beff`],VI=[`#e8e4da`,`#57503f`],HI={grid:{label:`Blue Grid`,draw:OI,css:`linear-gradient(180deg, #0a1a3f, #123a8a)`,tunable:[{key:`base`,label:`Background`,default:zI[0]},{key:`accent`,label:`Grid & glow`,default:zI[1]}]},aurora:{label:`Aurora`,draw:kI,css:`radial-gradient(circle at 35% 40%, rgba(90,220,200,0.7), rgba(140,90,240,0.5) 45%, #0b1030 80%)`},mesh:{label:`Mesh`,draw:AI,css:`radial-gradient(circle at 30% 30%, rgba(255,120,80,0.7), rgba(120,90,255,0.5) 55%, #2a0f3a 85%)`},bokeh:{label:`Bokeh`,draw:jI,css:`radial-gradient(circle at 60% 70%, rgba(150,190,255,0.5), #152244 70%)`,tunable:[{key:`base`,label:`Background`,default:BI[0]},{key:`accent`,label:`Dots`,default:BI[1]}]},waves:{label:`Waves`,draw:MI,css:`linear-gradient(180deg, #0a2e4a 40%, rgba(40,190,180,0.6) 70%, #04122a)`},paper:{label:`Paper`,draw:NI,css:`linear-gradient(180deg, #e8e4da, #ded9cd)`,tunable:[{key:`base`,label:`Paper`,default:VI[0]},{key:`accent`,label:`Grid & flecks`,default:VI[1]}]}}}));function WI(e,t,n,r,i){let a=typeof t==`string`?t:``;if(!FI(e,a,n,r,(Number(i)||0)/1e3)){if(a.startsWith(`radial|`)||a.startsWith(`linear|`)){let t=a.split(`|`),i;if(t[0]===`radial`){let a=t.slice(1);i=e.createRadialGradient(n/2,r*.42,Math.min(n,r)*.05,n/2,r*.5,Math.max(n,r)*.72),GI(i,a)}else{let a=Number(t[1])||90,o=t.slice(2),s=(a-90)*Math.PI/180,c=Math.max(n,r)/2,l=Math.cos(s)*c,u=Math.sin(s)*c;i=e.createLinearGradient(n/2-l,r/2-u,n/2+l,r/2+u),GI(i,o)}e.fillStyle=i}else e.fillStyle=a||`#ffffff`;e.fillRect(0,0,n,r)}}function GI(e,t){let n=t.length;t.forEach((t,r)=>e.addColorStop(n===1?0:r/(n-1),t))}function KI(e){let t=Number(e?.videoWidth||e?.width||e?.naturalWidth||e?.displayWidth)||0,n=Number(e?.videoHeight||e?.height||e?.naturalHeight||e?.displayHeight)||0;return{w:Math.max(1,t),h:Math.max(1,n)}}function qI(e,t){let n=Math.max(0,(t-(e.appearMs||0))/1e3),r=Number(e.speed)>0?Number(e.speed):1,i=Math.max(0,Number(e.trimStartSec)||0),a=i+n*r,o=Number(e.durationSec)||0;if(o>0){let t=Math.max(.05,o-i);a=e.loop===!1?Math.min(a,o-.05):i+(a-i)%t}return a}function JI(e,t){if(Array.isArray(e.wordTimes)&&Number.isFinite(Number(e.wordTimes[t])))return Number(e.wordTimes[t]);let n=e.anim?.speedMs||180;return(e.appearMs||0)+t*n}function YI(e,t){return String(e.text||``).split(/\s+/).filter(Boolean).map((n,r)=>{let i=JI(e,r),a=t-i;return{text:n,start:i,local:a,p:aL(a/320,0,1),spoken:a>=0}})}function XI(e,t){let n=YI(e,t),r=0;for(let t=0;t<n.length;t++){let i=n[t];if(!i.spoken)break;let a=t+1<n.length?Math.max(40,n[t+1].start-i.start):(e.anim?.speedMs||180)*2,o=aL(i.local/a,0,1);r+=Math.round(o*(i.text.length+1))}return r}function ZI(e,t,n){if(!e.motion||e.motion.type===`none`||t<(e.appearMs||0))return null;let r=e.leaveMs==null?n||0:e.leaveMs,i=Math.max(.1,(r-(e.appearMs||0))/1e3),a=(t-(e.appearMs||0))/1e3;return Nu(e.motion,a,i)}function QI(e,t,n){return e+(t-e)*n}function $I(e,t){let n=Math.max(0,Math.min(1,e));return t===`linear`?n:t===`ease-in`?n*n:t===`ease-out`?1-(1-n)*(1-n):n<.5?2*n*n:1-(-2*n+2)**2/2}function eL(e,t){let n={x:e.pos?.x??.5,y:e.pos?.y??.5,size:e.size},r=Array.isArray(e.moves)?e.moves.filter(e=>e&&typeof e==`object`).slice().sort((e,t)=>(e.atMs||0)-(t.atMs||0)):[],i=n;for(let e=0;e<r.length;e++){let n=r[e],a=Number(n.atMs)||0;if(t<a)break;let o=Number(n.durMs),s=Number.isFinite(o)&&o>=0?o:500,c=e+1<r.length?Number(r[e+1].atMs)||0:1/0,l=Math.max(0,Math.min(s,c-a)),u={x:n.pos?.x==null?i.x:n.pos.x,y:n.pos?.y==null?i.y:n.pos.y,size:n.size==null?i.size:n.size};if(l<=0||t>=a+l){i=u;continue}let d=$I((t-a)/l,n.ease);return{pos:{x:QI(i.x,u.x,d),y:QI(i.y,u.y,d)},size:i.size!=null&&u.size!=null?QI(i.size,u.size,d):u.size??i.size}}return{pos:{x:i.x,y:i.y},size:i.size}}function tL(e,t,n){let r=t.shadow==null?.18:Math.max(0,Math.min(1,Number(t.shadow)));if(r<=.001){e.shadowColor=`transparent`,e.shadowBlur=0,e.shadowOffsetY=0;return}e.shadowColor=`rgba(0,0,0,${r})`,e.shadowBlur=n*(.03+r*.14),e.shadowOffsetY=n*(.008+r*.05)}function nL(e,t){return(e?.elements||[]).filter(e=>t>=(e.appearMs||0)&&(e.leaveMs==null||t<e.leaveMs))}function rL(e,t,n=`pop`){let r=t-(e.appearMs||0),i=aL(r/320,0,1),a=1-(1-i)*(1-i);switch(e.kind===`text`?e.anim?.type||`pop`:e.entrance||n||`pop`){case`fade`:return{alpha:a,scale:1,dy:0,p:i};case`rise`:return{alpha:a,scale:1,dy:(1-a)*.06,p:i};case`scale`:return{alpha:1,scale:.4+.6*a,dy:0,p:i};case`typewriter`:case`pop-word`:case`word-pop`:case`sentence-build`:case`highlight`:return{alpha:1,scale:1,dy:0,p:i};case`line`:{let e=i<.7?i/.7*1.12:1.12-.12*((i-.7)/.3);return{alpha:Math.min(1,i*2.5),scale:e,dy:0,p:i}}default:{let e=i<.7?i/.7*1.12:1.12-.12*((i-.7)/.3);return{alpha:Math.min(1,i*2.5),scale:e,dy:0,p:i}}}}function iL(e,t,n,r,i,a){e.save(),WI(e,t.background,i,a,n);let o=t.handoff?.arrive===`fade`?`fade`:`pop`;for(let s of nL(t,n)){let c=rL(s,n,o),l=eL(s,n),u=l.pos,d=l.size==null?s.size:l.size,f=u.x*i,p=(u.y+(c.dy||0))*a;e.save(),e.globalAlpha=c.alpha,e.translate(f,p);let m=ZI(s,n,t.durationMs);if(m&&(e.translate(m.tx/100*i,m.ty/100*a),m.rot&&e.rotate(m.rot*Math.PI/180),m.scale!==1&&e.scale(m.scale,m.scale),m.blur>.01&&(e.filter=`blur(${(m.blur*(a/1080)).toFixed(2)}px)`)),s.tilt&&e.rotate(s.tilt*Math.PI/180),c.scale!==1&&e.scale(c.scale,c.scale),s.kind===`image`||s.kind===`video`){let t=s.src?r(s.src,s):null;!t&&s.kind===`video`&&s.poster&&(t=r(s.poster,s));let n=(d||.28)*i,o=s.box?Math.max(1,s.box.h*a):null,c=s.box?Math.max(1,s.box.w*i):null;if(t&&c){let{w:n,h:r}=KI(t),i=Math.max(c/n,o/r),a=c/i,l=o/i,u=(n-a)/2,d=(r-l)/2;tL(e,s,c),s.cutout||(e.fillStyle=`#fff`,e.fillRect(-c/2-c*.02,-o/2-c*.02,c+c*.04,o+c*.04),e.shadowColor=`transparent`),e.drawImage(t,u,d,a,l,-c/2,-o/2,c,o),s.cutout&&(e.shadowColor=`transparent`)}else if(t){let{w:r,h:i}=KI(t),a=i/r*n;tL(e,s,n),s.cutout||(e.fillStyle=`#fff`,e.fillRect(-n/2-n*.02,-a/2-n*.02,n+n*.04,a+n*.04),e.shadowColor=`transparent`),e.drawImage(t,-n/2,-a/2,n,a),s.cutout&&(e.shadowColor=`transparent`)}else{let t=c||n,r=o||n*.66;e.strokeStyle=`rgba(0,0,0,0.25)`,e.setLineDash([6,5]),e.lineWidth=2,e.strokeRect(-t/2,-r/2,t,r),e.setLineDash([]),e.fillStyle=`rgba(0,0,0,0.4)`,e.font=`${Math.round(a*.028)}px Hanken Grotesk, Arial, sans-serif`,e.textAlign=`center`,e.textBaseline=`middle`,e.fillText(String(s.query||(s.kind===`video`?`video`:`image`)).slice(0,28),0,0)}}else{let t=Math.max(10,(d||.07)*a);e.font=`${s.weight||700} ${t}px ${s.font||`Hanken Grotesk`}, Arial, sans-serif`,e.fillStyle=s.color||`#111111`,e.textAlign=`center`,e.textBaseline=`middle`;let r=s.anim?.type||`pop`,i=String(s.text||``);if(r===`typewriter`){if(Array.isArray(s.wordTimes)&&s.wordTimes.length){let t=XI(s,n);e.fillText(i.slice(0,t),0,0)}else{let t=s.anim?.speedMs||45,r=Math.max(0,Math.floor((n-(s.appearMs||0))/t));e.fillText(i.slice(0,r),0,0)}}else if(r===`pop-word`||r===`word-pop`||r===`sentence-build`||r===`highlight`){let i=YI(s,n),a=i.map(t=>e.measureText(`${t.text} `).width),o=-a.reduce((e,t)=>e+t,0)/2,l=s.anim?.entrance||`pop`;for(let n=0;n<i.length;n++){let s=i[n];if(r===`highlight`)e.save(),e.translate(o+a[n]/2,0),e.globalAlpha=c.alpha*(s.spoken?1:.3),e.fillText(s.text,0,0),e.restore();else if(s.spoken){let i=s.p;e.save();let u=1,d=0,f=0,p=Math.min(1,i*2.5);if(r===`sentence-build`){let e=1-(1-i)*(1-i);l===`fade`?p=e:l===`slide`?(d=(1-e)*-t*.8,p=e):l===`rise`?(f=(1-e)*t*.6,p=e):l===`scale`?(u=.4+.6*e,p=1):u=i<.7?i/.7*1.12:1.12-.12*((i-.7)/.3)}else u=i<.7?i/.7*1.12:1.12-.12*((i-.7)/.3);e.translate(o+a[n]/2+d,f),e.scale(u,u),e.globalAlpha=c.alpha*p,e.fillText(s.text,0,0),e.restore()}o+=a[n]}}else e.fillText(i,0,0)}e.restore()}e.restore()}var aL,oL=o((()=>{Lu(),UI(),[...Object.entries(HI).map(([e,t])=>({key:`anim-${e}`,label:t.label,value:`anim|${e}`,animated:!0}))],aL=(e,t,n)=>Math.max(t,Math.min(n,e))}));function sL(e){return e===`9:16`?[1080,1920]:e===`1:1`?[1080,1080]:[1920,1080]}async function cL(e,t=1920,n=1080){let r=typeof OffscreenCanvas<`u`?new OffscreenCanvas(t,n):Object.assign(document.createElement(`canvas`),{width:t,height:n}),i=r.getContext(`2d`),a=new Map,o=new Set;for(let t of e?.elements||[])t.kind===`image`&&t.src&&o.add(t.src),t.kind===`video`&&t.poster&&o.add(t.poster);await Promise.all([...o].map(e=>new Promise(t=>{let n=new Image;n.crossOrigin=`anonymous`,n.onload=()=>{a.set(e,n),t()},n.onerror=()=>t(),n.src=e})));let s=(e?.elements||[]).filter(e=>e.kind===`video`&&e.src),c=new Map;await Promise.all(s.map(e=>new Promise(t=>{if(typeof document>`u`)return t();let n=document.createElement(`video`);n.crossOrigin=`anonymous`,n.muted=!0,n.playsInline=!0,n.preload=`auto`;let r=()=>t();n.addEventListener(`loadeddata`,()=>{c.set(e.id,n),r()},{once:!0}),n.addEventListener(`error`,r,{once:!0}),setTimeout(r,8e3),n.src=e.src})));let l=(e,t)=>new Promise(n=>{if(Math.abs((e.currentTime||0)-t)<uL)return n();let r=setTimeout(n,lL);e.addEventListener(`seeked`,()=>{clearTimeout(r),n()},{once:!0});try{e.currentTime=t}catch{clearTimeout(r),n()}});return{width:t,height:n,frameAt:async o=>{let u=Math.max(0,o)*1e3;for(let e of s){let t=c.get(e.id);if(!t||u<(e.appearMs||0)||e.leaveMs!=null&&u>=e.leaveMs)continue;let n=Number(e.durationSec)||t.duration||0;await l(t,qI({...e,durationSec:n},u))}return iL(i,e,u,(e,t)=>a.get(e)||(t&&t.src===e?c.get(t.id):null)||null,t,n),r},close:()=>{a.clear();for(let e of c.values())try{e.pause(),e.removeAttribute(`src`),e.load()}catch{}c.clear()}}}var lL,uL,dL=o((()=>{oL(),lL=1500,uL=.006}));async function fL(e){let t=e?.original;if(!t?.assetId||!t?.versionId)return null;try{let e=pf(t);return e?await ff(e):null}catch{return null}}function pL(e){return e===`16:9`?[1920,1080]:e===`1:1`?[1080,1080]:[1080,1920]}function mL(e){return e?.aspect===`9:16`?[1080,1920]:e?.aspect===`1:1`?[1080,1080]:[1920,1080]}async function hL(e){let t=e.kind||`image`;if(t===`vector-scene`&&e.scene){let[t,n]=mL(e.scene),r=nO(e.scene,t,n,{debug:e.debug}),i=e.trimStart||0,a=e.speed||1;return{width:r.width,height:r.height,frameAt:e=>r.frameAt(i+Math.max(0,e)*a),close:()=>r.close?.()}}if(t===`collage`&&e.collage){let[t,n]=sL(e.collage.aspect),r=await cL(e.collage,t,n);return{width:r.width,height:r.height,frameAt:t=>r.frameAt(Math.max(0,t)*(e.speed||1)+(e.trimStart||0)),close:()=>r.close?.()}}if(t===`v2-scene`&&e.v2video){let[t,n]=pL(e.v2video.meta?.aspect),r=xI(e.v2video,t,n),i=e.trimStart||0,a=e.speed||1;return{width:r.width,height:r.height,frameAt:e=>r.frameAt(i+Math.max(0,e)*a),close:()=>r.close?.()}}let n=t===`video`?await lf(e.url):null;if(n)return gL({...e,url:n},null);let r=await fL(e)||await sf(e);if(uf(r))throw Error(`Can't find "${r.name}" on this device. Reconnect your local folder or re-import it, then try the export again.`);if(t===`video`&&(r.type||``).startsWith(`image/`)&&(t=`image`),t===`image`)try{let e=await createImageBitmap(r);return{frameAt:async()=>e,close:()=>e.close?.()}}catch{let t=URL.createObjectURL(r),n=new Image;await new Promise((r,i)=>{n.onload=r,n.onerror=()=>i(Error(`image load failed: ${e.title||e.url}`)),n.src=t});let i=await createImageBitmap(n);return URL.revokeObjectURL(t),{frameAt:async()=>i,close:()=>i.close?.()}}if(!e.reverse)try{return await NS(e,await r.arrayBuffer())}catch(t){console.warn(`[export] WebCodecs decode failed, seek fallback:`,e.title||e.url,t?.message||t)}return gL(e,r)}async function gL(e,t){let n=document.createElement(`video`);n.crossOrigin=`anonymous`,n.muted=!0,n.preload=`auto`,n.playsInline=!0;let r=t?URL.createObjectURL(t):e.url;n.src=r,await new Promise((t,r)=>{let i=()=>{s(),t()},a=()=>{s(),r(Error(`video load failed: ${e.title||e.url}`))},o=setTimeout(()=>{s(),r(Error(`video load timeout: ${e.title||e.url}`))},3e4);function s(){clearTimeout(o),n.removeEventListener(`loadeddata`,i),n.removeEventListener(`error`,a)}n.addEventListener(`loadeddata`,i),n.addEventListener(`error`,a)});let i=e.speed||1,a=e.trimStart||0,o=n.duration||0;return{async frameAt(t){let r=e.reverse?(e.trimEnd??o)-t*i:a+t*i;return r=Math.max(0,Math.min(Math.max(0,o-.001),r)),Math.abs(n.currentTime-r)>.001&&await new Promise(e=>{let t=()=>{n.removeEventListener(`seeked`,t),e()};n.addEventListener(`seeked`,t),n.currentTime=r,setTimeout(e,2e3)}),n},close(){try{n.removeAttribute(`src`),n.load(),URL.revokeObjectURL(r)}catch{}}}}var _L=o((()=>{PS(),gf(),iO(),SI(),dL()}));async function vL(e){let t=[];for(let n of e||[]){let e=n?.kind||`image`;if(!n?.url||e===`vector-scene`||e===`v2-scene`||e===`collage`||!wL(n))continue;let r=null;try{if(n.original?.assetId&&n.original?.versionId){let e=pf(n.original);e&&(r=await ff(e).catch(()=>null))}r||=await sf(n)}catch{continue}uf(r)&&t.push(r.name||n.title||n.url)}return[...new Set(t)]}function yL(e,t){let n=String(e||``).split(/[:/]/).map(Number),[r,i]=n.length===2&&n[0]>0&&n[1]>0?n:[16,9],a=[720,1080].includes(Number(t))?Number(t):1080,o,s;return r>=i?(s=a,o=Math.round(r/i*a)):(o=a,s=Math.round(i/r*a)),o-=o%2,s-=s%2,[Math.max(2,o),Math.max(2,s)]}function bL(e={}){let t=e||{},n=[24,30,60].includes(t.fps)?t.fps:TL.fps,[r,i]=yL(t.aspect||`16:9`,t.resolution),a=t.quality===`standard`?.1:.15;return{width:r,height:i,fps:n,bitrate:Math.min(28e6,Math.max(2e6,Math.round(r*i*n*a)))}}function xL(e){let t=new Map((e||[]).map((e,t)=>[e,t]));return(e,n)=>{let r=t.has(e.trackId)?t.get(e.trackId):0,i=t.has(n.trackId)?t.get(n.trackId):0;return r===i?(e.start||0)-(n.start||0):r-i}}async function SL(e,t){let n;for(let e=0;;e++)try{n=await cf(t);break}catch(t){if(e>=2)throw Error(`audio fetch failed after ${e+1} tries: ${t.message}`);await new Promise(t=>setTimeout(t,400*(e+1)))}if(uf(n))throw Error(`Can't find audio "${n.name}" on this device. Reconnect your local folder or re-import it, then try the export again.`);return e.decodeAudioData(n)}async function CL(e,{onProgress:t,settings:n,nativeAudio:r=null}={}){let{clips:i=[],audio:a=[],targetDuration:o=0,trackOrder:s=[],overlays:c=[],stickers:l=[],blurs:u=[],zooms:d=[],polishFx:f=[],fullscreenFrames:p=[],figureSweeps:m=[],graphs:h=[],fxEvents:g=[],liveOverlays:_=[],previewH:v=0,backgroundColor:y=`#000000`,stillmadeWatermark:b=!1,stillmadeWatermarkPos:x=`br`,stillmadeWatermarkOpacity:S=null,stillmadeEndScreen:C=!1,stillmadeEndScreenSec:w=void 0,stillmadeEndScreenAnim:T=void 0}=e||{},E=await vL(i);if(E.length){let e=E.length===1?E[0]:`${E.slice(0,-1).join(`, `)} and ${E.at(-1)}`;throw Error(`Can't find ${E.length===1?`this file`:`these files`} on this device: ${e}. Reconnect your local folder or re-import, then try the export again. If you just re-imported ${E.length===1?`it`:`them`}, choose Update affected steps on the Steps after Import media first, so they use the new copies.`)}let D=i.filter(e=>e&&(e.url||e.kind===`vector-scene`&&e.scene||e.kind===`v2-scene`&&e.v2video||e.kind===`collage`&&e.collage)).map(e=>({id:e.id,kind:e.kind||`image`,url:e.url,scene:e.kind===`vector-scene`?e.scene:void 0,v2video:e.kind===`v2-scene`?e.v2video:void 0,collage:e.kind===`collage`?e.collage:void 0,source:e.source,localKey:e.localKey,original:e.original,title:e.title,trackId:e.trackId,start:e.start||0,duration:e.duration||0,speed:e.speed||1,reverse:!!e.reverse,trimStart:(e.trimStart||0)+(e.sourceOffset||0),trimEnd:e.trimEnd,motion:e.motion,color:e.color,lut:e.lut,transition:e.transition,speedRamp:e.speedRamp,freeze:e.freeze,transform:{...e.transform||{},opacity:e.transform?.opacity??e.opacity??1},shareSource:!!e.shareSource})).sort(xL(s)),O=D.reduce((e,t)=>Math.max(e,t.start+t.duration),0),k=a.reduce((e,t)=>Math.max(e,(t.start||0)+(t.duration||0)),0),A=Math.max(o||0,O,k,1),j=C?A+sp(w):A,M=[],N=new Map;for(let e of D)N.has(e.trackId)||N.set(e.trackId,[]),N.get(e.trackId).push(e);for(let e of N.values()){e.sort((e,t)=>e.start-t.start);for(let t=0;t<e.length-1;t++){let n=e[t],r=e[t+1],i=n.transition?.type;if(!i||i===`Cut`)continue;let a=Math.min(n.transition.duration||.5,n.duration*.9,r.duration*.9);a<=.01||M.push({outId:n.id,inId:r.id,type:i,startT:Math.max(0,n.start+n.duration-a/2),dur:a,color:n.transition.color||null})}}let P=null,F=a.filter(e=>e&&e.url);if(F.length&&r===null){let e=new(window.AudioContext||window.webkitAudioContext),n=[],r=new Map;for(let i of F){t&&t({phase:`audio-decode`});try{let t=`${i.source||``}\u0000${i.localKey||``}\u0000${i.url}`;r.has(t)||r.set(t,SL(e,i));let a=await r.get(t);n.push({audioBuffer:a,start:i.start||0,durationSec:i.duration||a.duration,volume:(i.volume??80)/100,fadeIn:i.fadeIn||0,fadeOut:i.fadeOut||0,sourceOffset:i.sourceOffset||0,loop:!!i.loop,rate:i.rate>0?i.rate:1})}catch(t){if(!i.embedded){try{e.close?.()}catch{}throw Error(`Audio "${i.title||i.url}" failed to load (${t.message}). Export stopped so this sound isn't silently missing — if retrying doesn't fix it, re-import or replace that item (its source may be gone).`)}console.warn(`[export] audio decode failed, skipping:`,i.url,t.message)}}try{e.close?.()}catch{}n.length&&(P=await Du(n,{duration:j}))}let I={...n,aspect:n?.aspect||e?.aspect||e?.aspectRatio};return{...TL,...bL(I),duration:j,layers:D,transitions:M,overlays:c,stickers:l,blurs:u,zooms:d,polishFx:f,fullscreenFrames:p,figureSweeps:m,graphs:h,fxEvents:g,liveOverlays:_,previewH:v,backgroundColor:y,stillmadeWatermark:b,stillmadeWatermarkPos:x,stillmadeWatermarkOpacity:S,stillmadeEndScreen:C,stillmadeEndScreenSec:w,stillmadeEndScreenAnim:T,audioBuffer:P,nativeAudio:r}}var wL,TL,EL=o((()=>{ku(),gf(),gp(),wL=e=>!!(e?.original?.assetId&&e?.original?.versionId)||/^(?:sm-media|blob|file):/i.test(String(e?.url||``)),TL={width:1920,height:1080,fps:60,bitrate:18e6}}));function DL(e){return e instanceof Blob&&OL.add(e),e}var OL,kL=o((()=>{OL=new WeakSet})),AL=c({renderNative:()=>ML,wavHeader:()=>jL});function jL(e){let t=e.numberOfChannels,n=e.length*t*2;if(n>4294967259)throw Error(`Audio exceeds WAV size limit`);let r=new Uint8Array(44),i=new DataView(r.buffer),a=(e,t)=>[...t].forEach((t,n)=>i.setUint8(e+n,t.charCodeAt(0)));return a(0,`RIFF`),i.setUint32(4,n+36,!0),a(8,`WAVE`),a(12,`fmt `),i.setUint32(16,16,!0),i.setUint16(20,1,!0),i.setUint16(22,t,!0),i.setUint32(24,e.sampleRate,!0),i.setUint32(28,e.sampleRate*t*2,!0),i.setUint16(32,t*2,!0),i.setUint16(34,16,!0),a(36,`data`),i.setUint32(40,n,!0),r}async function ML(e,{onProgress:t,signal:n,exportAuthorization:r}={}){let i=hf(),a=new Map,o,s=()=>{if(n?.aborted)throw Error(`Export aborted`)},c=()=>{o&&i.cancelExport(o.id).catch(()=>{})};n?.addEventListener(`abort`,c,{once:!0});try{s();let n=Math.max(1,Math.round(e.duration*e.fps));if(o=await i.beginExport({width:e.width,height:e.height,fps:e.fps,frames:n},r?.ticket),s(),await document.fonts?.ready,s(),e.stickers?.some(e=>e.shape===`gif`)){let{preloadGifStickers:t}=await Sr(async()=>{let{preloadGifStickers:e}=await Promise.resolve().then(()=>(Vf(),xf));return{preloadGifStickers:e}},void 0);await t(e.stickers)}for(let t of e.layers)s(),a.has(t.id)||a.set(t.id,await hL(t));let c=new OffscreenCanvas(e.width,e.height).getContext(`2d`,{willReadFrequently:!0});for(let r=0;r<n;r++)s(),await Nh(c,e,r/e.fps,a,e.width,e.height),s(),await i.writeExportFrame(o.id,r,new Uint8Array(c.getImageData(0,0,e.width,e.height).data.buffer)),s(),(r%12==0||r===n-1)&&t?.({phase:`video`,done:r+1,total:n});if(e.nativeAudio?.length&&(s(),t?.({phase:`audio`}),await i.mixExportAudio(o.id,e.nativeAudio),s()),s(),e.audioBuffer){let n=e.audioBuffer;t?.({phase:`audio`}),await i.writeExportAudio(o.id,jL(n));let r=Array.from({length:n.numberOfChannels},(e,t)=>n.getChannelData(t));for(let e=0;e<n.length;e+=16384){s();let t=Math.min(16384,n.length-e),a=new Uint8Array(t*r.length*2),c=new DataView(a.buffer);for(let n=0;n<t;n++)for(let t=0;t<r.length;t++){let i=Math.max(-1,Math.min(1,r[t][e+n]));c.setInt16((n*r.length+t)*2,Math.round(i<0?i*32768:i*32767),!0)}await i.writeExportAudio(o.id,a)}}s();let l=await i.finishExport(o.id);return o=null,s(),t?.({phase:`done`}),l}finally{n?.removeEventListener(`abort`,c);for(let e of a.values())e.close?.();o&&await i.cancelExport(o.id).catch(()=>{})}}var NL=o((()=>{Lh(),_L(),gf(),Cr()}));async function PL(){return hf()&&(await hf().capabilities()).nativeTimelineExport?{strategy:`native`}:Ir()}async function FL(e,t={}){JL(t.signal),t.exportAuthorization?.watermark===!0&&(e={...e,stillmadeWatermark:!0});let n=hf(),r=n&&(await n.capabilities()).nativeTimelineExport;JL(t.signal);let i=r&&n.prepareNativeAudio?await n.prepareNativeAudio(e.audio||[]):null;JL(t.signal);let a=await CL(e,{...t,nativeAudio:i});if(a.stillmadeWatermark||a.stillmadeEndScreen)try{await Promise.all(pp().map(e=>document.fonts.load(e)))}catch{}JL(t.signal);let o=r?await(await Sr(async()=>{let{renderNative:e}=await Promise.resolve().then(()=>(NL(),AL));return{renderNative:e}},void 0)).renderNative(a,t):await BL(a,t);return t.exportAuthorization?DL(o):o}async function IL(e,{width:t,height:n,duration:r,fps:i=30,shortSide:a=1080,signal:o,onProgress:s,render:c=BL,plan:l=CL}={}){if(JL(o),!(e instanceof Blob)||!e.size)throw Error(`A video file is needed for a working copy.`);if(!(t>0&&n>0&&r>0))throw Error(`The video’s size and length are needed before it can be made smaller.`);if(Math.min(t,n)<720)throw Error(`no-gain`);let u=URL.createObjectURL(e);try{let e=await l({clips:[{id:`working`,kind:`video`,url:u,start:0,duration:r,trimStart:0,speed:1,trackId:`video`}],audio:[{id:`working-audio`,url:u,start:0,duration:r,trimStart:0,volume:1,trackId:`audio`}],targetDuration:r,trackOrder:[`video`],stillmadeWatermark:!1,stillmadeEndScreen:!1},{settings:{aspect:`${t}:${n}`,resolution:Math.min(a,1080)>=1080?1080:720,fps:[24,30,60].includes(i)?i:30,quality:`standard`},onProgress:s,signal:o});JL(o);let d=await c(e,{onProgress:s,signal:o});return d instanceof Blob?d:new Blob([d],{type:`video/mp4`})}finally{URL.revokeObjectURL(u)}}async function LL(e,{keep:t,width:n,height:r,duration:i,fps:a=30,shortSide:o=1080,signal:s,onProgress:c,render:l=BL,plan:u=CL}={}){JL(s);let d=e instanceof Blob&&e.size>0,f=typeof e==`string`&&e?e:d?URL.createObjectURL(e):null;if(!f)throw Error(`A video file is needed to cut.`);if(!(n>0&&r>0&&i>0))throw Error(`The video’s size and length are needed before it can be cut.`);let p=(Array.isArray(t)?t:[]).map(e=>({start:Math.max(0,Number(e?.start)),end:Math.min(i,Number(e?.end))})).filter(e=>Number.isFinite(e.start)&&Number.isFinite(e.end)&&e.end-e.start>.001);if(!p.length)throw Error(`Keep at least part of the recording.`);try{let e=0,t=[],i=[];for(let[n,r]of p.entries()){let a=r.end-r.start;t.push({id:`cut-${n}`,kind:`video`,url:f,start:e,duration:a,trimStart:r.start,speed:1,trackId:`video`}),i.push({id:`cut-audio-${n}`,url:f,start:e,duration:a,trimStart:r.start,volume:1,trackId:`audio`}),e+=a}let d=await u({clips:t,audio:i,targetDuration:e,trackOrder:[`video`],stillmadeWatermark:!1,stillmadeEndScreen:!1},{settings:{aspect:`${n}:${r}`,resolution:Math.min(n,r,o)>=1080?1080:720,fps:[24,30,60].includes(a)?a:30,quality:`standard`},onProgress:c,signal:s});JL(s);let m=await l(d,{onProgress:c,signal:s});return{file:m instanceof Blob?m:new Blob([m],{type:`video/mp4`}),duration:e}}finally{d&&URL.revokeObjectURL(f)}}async function RL(e,t={}){JL(t.signal);let n=hf(),r=n?.beginAudioExport&&n.prepareNativeAudio?await n.prepareNativeAudio(e.audio||[]):null;JL(t.signal);let i=await CL(e,{...t,nativeAudio:r});if(JL(t.signal),r?.length){let e,a=()=>{e&&n.cancelExport(e.id).catch(()=>{})};try{e=await n.beginAudioExport(i.duration,t.exportAuthorization?.ticket),t.signal?.addEventListener(`abort`,a,{once:!0}),JL(t.signal),t.onProgress?.(.1),await n.mixExportAudio(e.id,r),JL(t.signal),t.onProgress?.(.8);let o=await n.finishExport(e.id);return e=null,JL(t.signal),t.onProgress?.(1),o}finally{t.signal?.removeEventListener(`abort`,a),e&&await n.cancelExport(e.id).catch(()=>{})}}if(!i.audioBuffer){let e=Error(`NO_AUDIO`);throw e.code=`NO_AUDIO`,e}return Ou(i.audioBuffer,t)}async function zL(e,t){if(!e.shareSource||e.kind!==`video`||e.reverse||!e.url)return hL(e);t.has(e.url)||t.set(e.url,hL({...e,id:`shared:${e.url}`,start:0,trimStart:0,trimEnd:void 0,speed:1}));let n=await t.get(e.url),r=e.trimStart||0,i=e.speed||1;return{...n,frameAt:e=>n.frameAt(r+Math.max(0,e)*i),close(){}}}async function BL(e,{onProgress:t,signal:n}={}){let r=await Ir();if(r.strategy!==`webcodecs`)throw Error(`WebCodecs unavailable (wasm fallback is a later phase)`);let{width:i,height:a,fps:o,duration:s}=e;if(e.overlays?.length)try{await document.fonts?.ready}catch{}if(e.stickers?.some?.(e=>e?.shape===`gif`))try{let{preloadGifStickers:t}=await Sr(async()=>{let{preloadGifStickers:e}=await Promise.resolve().then(()=>(Vf(),xf));return{preloadGifStickers:e}},void 0);await t(e.stickers)}catch{}let c=new Map,l=new Map,u=null;try{for(let t of e.layers){if(n?.aborted)throw Error(`aborted`);c.has(t.id)||c.set(t.id,await zL(t,l))}let d=e.audioBuffer?await Tu(e.audioBuffer):null,f=Math.max(1,Math.round(s*o)),p=d?Math.ceil(d.buffer.length/(d.codec===`opus`?960:1024))+64:0,m=Mo({width:i,height:a,fps:o,audio:d?{channels:d.buffer.numberOfChannels,sampleRate:d.buffer.sampleRate,codec:d.codec}:null,expected:{video:f+16,audio:p}});u=Po({codec:r.videoCodec,width:i,height:a,fps:o,bitrate:e.bitrate||1e7,hardwareAcceleration:r.hardwareAcceleration||`prefer-hardware`,onChunk:(e,t)=>m.addVideoChunk(e,t)});let h=new OffscreenCanvas(i,a),g=h.getContext(`2d`),_=f;for(let r=0;r<_;r++){if(n?.aborted)throw Error(`aborted`);let s=r/o;await Nh(g,e,s,c,i,a),await u.encodeFrame(h,Math.round(s*1e6),r%48==0),t&&(r%12==0||r===_-1)&&t({phase:`video`,done:r+1,total:_})}return await u.finish(),u=null,d&&(t&&t({phase:`audio`}),await Eu(d.buffer,{config:d.config,onChunk:(e,t)=>m.addAudioChunk(e,t)})),t&&t({phase:`done`}),m.finalize()}finally{for(let e of c.values())try{e.close?.()}catch{}for(let e of l.values())try{(await e).close?.()}catch{}if(u)try{u.close()}catch{}}return e.audioBuffer&&(t&&t({phase:`audio`}),await Eu(e.audioBuffer,{onChunk:(e,t)=>muxer.addAudioChunk(e,t)})),t&&t({phase:`done`}),muxer.finalize()}async function VL(){let e=await Ir();if(e.strategy!==`webcodecs`)return{ok:!1,reason:`no webcodecs`,caps:e};let t=44100,n=Mo({width:640,height:360,fps:24,audio:{channels:2,sampleRate:t}}),r=Po({codec:e.videoCodec,width:640,height:360,fps:24,bitrate:2e6,onChunk:(e,t)=>n.addVideoChunk(e,t)}),i=new OffscreenCanvas(640,360),a=i.getContext(`2d`);for(let e=0;e<48;e++)a.fillStyle=`#101830`,a.fillRect(0,0,640,360),a.fillStyle=`#e0b84c`,a.fillRect(e/48*560,140,80,80),await r.encodeFrame(i,Math.round(e/24*1e6),e%48==0);await r.finish();let o=new OfflineAudioContext(2,t*2,t),s=o.createOscillator();s.frequency.value=440;let c=o.createGain();c.gain.value=.2,s.connect(c).connect(o.destination),s.start(0),s.stop(2),await Eu(await o.startRendering(),{onChunk:(e,t)=>n.addAudioChunk(e,t)});let l=n.finalize(),u=new Uint8Array(await l.slice(0,12).arrayBuffer()),d=String.fromCharCode(u[4],u[5],u[6],u[7])===`ftyp`,f=URL.createObjectURL(l),p=await new Promise(e=>{let t=document.createElement(`video`);t.preload=`metadata`,t.muted=!0,t.onloadedmetadata=()=>e({w:t.videoWidth,h:t.videoHeight,dur:Math.round(t.duration*100)/100}),t.onerror=()=>e({error:`decode error`}),t.src=f,setTimeout(()=>e({error:`timeout`}),5e3)});return URL.revokeObjectURL(f),{ok:!0,size:l.size,type:l.type,ftyp:d,codec:e.videoCodec,probe:p}}function HL(e,t){let n=document.createElement(`canvas`);n.width=800,n.height=450;let r=n.getContext(`2d`);r.fillStyle=t,r.fillRect(0,0,800,450),r.strokeStyle=`rgba(255,255,255,0.35)`;for(let e=0;e<=800;e+=80)r.beginPath(),r.moveTo(e,0),r.lineTo(e,450),r.stroke();for(let e=0;e<=450;e+=90)r.beginPath(),r.moveTo(0,e),r.lineTo(800,e),r.stroke();return r.fillStyle=`#fff`,r.font=`bold 160px sans-serif`,r.textAlign=`center`,r.textBaseline=`middle`,r.fillText(e,400,225),n.toDataURL(`image/png`)}async function UL(){let e={width:640,height:360,fps:24,duration:4,bitrate:3e6,layers:[{id:`a`,kind:`image`,url:HL(`A`,`#1a3a5a`),start:0,duration:2,motion:{type:`zoom`,zoomDirection:`in`,zoomAmount:1.4,zoomAnchor:`center`,intensity:100,range:[0,100],easing:`ease-in-out`},color:{saturation:40},transform:{opacity:1}},{id:`b`,kind:`image`,url:HL(`B`,`#5a1a3a`),start:2,duration:2,motion:{type:`pan`,panDirection:`left-right`,panAmount:20,intensity:100,range:[0,100],easing:`linear`},lut:`Teal and Orange`,transform:{opacity:1}}]},t=44100,n=new OfflineAudioContext(2,t*4,t),r=n.createOscillator();r.frequency.value=330;let i=n.createGain();i.gain.value=.15,r.connect(i).connect(n.destination),r.start(0),r.stop(4),e.audioBuffer=await n.startRendering();let a=performance.now(),o=await BL(e),s=Math.round(performance.now()-a),c=new Map;for(let t of e.layers)c.set(t.id,await hL(t));let l=document.getElementById(`__rt`);l||(l=document.createElement(`canvas`),l.id=`__rt`,l.style.cssText=`position:fixed;top:8px;left:8px;z-index:99999;border:2px solid #0f0;background:#000`,document.body.appendChild(l)),l.width=640,l.height=360,await Nh(l.getContext(`2d`),e,1,c,640,360);let u=new Uint8Array(await o.slice(0,12).arrayBuffer()),d=String.fromCharCode(u[4],u[5],u[6],u[7])===`ftyp`,f=URL.createObjectURL(o),p=await new Promise(e=>{let t=document.createElement(`video`);t.preload=`metadata`,t.muted=!0,t.onloadedmetadata=()=>e({w:t.videoWidth,h:t.videoHeight,dur:Math.round(t.duration*100)/100}),t.onerror=()=>e({error:`decode`}),t.src=f,setTimeout(()=>e({error:`timeout`}),6e3)});return URL.revokeObjectURL(f),{ok:!0,size:o.size,ftyp:d,probe:p,ms:s}}async function WL(){let e=await BL({width:480,height:270,fps:24,duration:3,bitrate:2e6,layers:[{id:`s`,kind:`image`,url:HL(`V`,`#243a2a`),start:0,duration:3,motion:{type:`pan`,panDirection:`left-right`,panAmount:30,intensity:100,range:[0,100],easing:`linear`},transform:{opacity:1}}]}),t=URL.createObjectURL(e),n=performance.now(),r=await BL({width:480,height:270,fps:24,duration:2,bitrate:2e6,layers:[{id:`v`,kind:`video`,url:t,start:0,duration:2,trimStart:.5,speed:1,motion:{type:`zoom`,zoomDirection:`in`,zoomAmount:1.3,zoomAnchor:`center`,intensity:100,range:[0,100],easing:`ease-in-out`},transform:{opacity:1}}]}),i=Math.round(performance.now()-n);URL.revokeObjectURL(t);let a=new Uint8Array(await r.slice(0,12).arrayBuffer()),o=String.fromCharCode(a[4],a[5],a[6],a[7])===`ftyp`,s=URL.createObjectURL(r),c=await new Promise(e=>{let t=document.createElement(`video`);t.preload=`metadata`,t.muted=!0,t.onloadedmetadata=()=>e({w:t.videoWidth,h:t.videoHeight,dur:Math.round(t.duration*100)/100}),t.onerror=()=>e({error:`decode`}),t.src=s,setTimeout(()=>e({error:`timeout`}),8e3)});return URL.revokeObjectURL(s),{ok:!0,srcSize:e.size,size:r.size,ftyp:o,probe:c,ms:i}}async function GL(){let e=await CL({targetDuration:4,trackOrder:[`video`,`overlay`],audio:[],clips:[{id:`c1`,kind:`image`,trackId:`video`,url:HL(`1`,`#203a4a`),start:0,duration:2,motion:{type:`ken-burns`,intensity:100,range:[0,100],easing:`ease-in-out`},transform:{opacity:1}},{id:`c2`,kind:`image`,trackId:`video`,url:HL(`2`,`#4a2030`),start:2,duration:2,motion:{type:`zoom`,zoomDirection:`out`,zoomAmount:1.5,intensity:100,range:[0,100]},lut:`Filmic`,transform:{opacity:1}}]}),t=performance.now(),n=await BL(e),r=Math.round(performance.now()-t),i=new Uint8Array(await n.slice(0,12).arrayBuffer()),a=String.fromCharCode(i[4],i[5],i[6],i[7])===`ftyp`,o=URL.createObjectURL(n),s=await new Promise(e=>{let t=document.createElement(`video`);t.preload=`metadata`,t.muted=!0,t.onloadedmetadata=()=>e({w:t.videoWidth,h:t.videoHeight,dur:Math.round(t.duration*100)/100}),t.onerror=()=>e({error:`decode`}),t.src=o,setTimeout(()=>e({error:`timeout`}),8e3)});return URL.revokeObjectURL(o),{ok:!0,layers:e.layers.length,dims:[e.width,e.height],size:n.size,ftyp:a,probe:s,ms:r}}async function KL(){let e=await CL({targetDuration:4,trackOrder:[`video`],audio:[],clips:[{id:`a`,kind:`image`,trackId:`video`,url:HL(`A`,`#1a3a5a`),start:0,duration:2,transition:{type:`Wipe left`,duration:1},transform:{opacity:1}},{id:`b`,kind:`image`,trackId:`video`,url:HL(`B`,`#5a1a3a`),start:2,duration:2,transform:{opacity:1}}]}),t=await BL(e),n=new Map;for(let t of e.layers)n.set(t.id,await hL(t));let r=document.getElementById(`__rt`);r||(r=document.createElement(`canvas`),r.id=`__rt`,r.style.cssText=`position:fixed;top:8px;left:8px;z-index:99999;border:2px solid #0ff;background:#000`,document.body.appendChild(r)),r.width=640,r.height=360,await Nh(r.getContext(`2d`),e,2,n,640,360);let i=new Uint8Array(await t.slice(0,12).arrayBuffer()),a=String.fromCharCode(i[4],i[5],i[6],i[7])===`ftyp`;return{ok:!0,transitions:e.transitions.length,transition:e.transitions[0],size:t.size,ftyp:a}}async function qL(){let e=await CL({targetDuration:3,trackOrder:[`video`],audio:[],previewH:360,clips:[{id:`bg`,kind:`image`,trackId:`video`,url:HL(`BG`,`#22303a`),start:0,duration:3,transform:{opacity:1}}],overlays:[{text:`Title Card`,subtitle:``,font:`Georgia`,size:60,color:`#ffffff`,background:`#16140F`,backgroundOpacity:90,backgroundPadding:10,backgroundRadius:5,position:`center`,start:0,end:3},{text:`A caption at the bottom`,font:`Hanken Grotesk`,size:28,color:`#ffffff`,background:`#000000`,backgroundOpacity:45,backgroundPadding:10,backgroundRadius:6,position:`bottom center`,start:0,end:3}],stickers:[{shape:`circle`,color:`#e0b84c`,x:22,y:30,scale:1,opacity:.9,rotation:0,start:0,end:3},{shape:`frame`,color:`#ffffff`,x:78,y:32,scale:1,opacity:.9,rotation:0,start:0,end:3}]}),t=await BL(e),n=new Map;for(let t of e.layers)n.set(t.id,await hL(t));let r=document.getElementById(`__rt`);r||(r=document.createElement(`canvas`),r.id=`__rt`,r.style.cssText=`position:fixed;top:8px;left:8px;z-index:99999;border:2px solid #ff0;background:#000`,document.body.appendChild(r)),r.width=640,r.height=360,await Nh(r.getContext(`2d`),e,1,n,640,360);let i=new Uint8Array(await t.slice(0,12).arrayBuffer()),a=String.fromCharCode(i[4],i[5],i[6],i[7])===`ftyp`;return{ok:!0,overlays:e.overlays.length,stickers:e.stickers.length,size:t.size,ftyp:a}}var JL,YL=o((()=>{zr(),No(),Fo(),ku(),Lh(),_L(),EL(),gf(),kL(),gp(),Cr(),JL=e=>{if(e?.aborted)throw Object.assign(Error(`Export aborted`),{name:`AbortError`})}})),XL=c({__overlayTest:()=>qL,__planTest:()=>GL,__renderTest:()=>UL,__smokeTestExport:()=>VL,__transitionTest:()=>KL,__videoTest:()=>WL,exportEditorAudioMp3:()=>RL,exportEditorTimeline:()=>FL,getExportCapabilities:()=>PL,renderRecordingCut:()=>LL,renderTimeline:()=>BL,renderWorkingCopy:()=>IL}),ZL,QL,$L=o((()=>{Ar(),Er(),Dn(),YL(),ZL=e=>()=>{throw Error(e+` is unavailable in the local preview.`)},QL={version:1};for(let e of Tr)QL[e]=[`toast`,`presenterHost`,`upgradeReasons`].includes(e)?{}:ZL(e);Object.assign(QL,{loadMediaBlob:async e=>{let t=typeof e==`string`?e:e?.url,n=t?await fetch(t).catch(()=>null):null;return n?.ok?n.blob():{missing:!0,ref:e}},loadMediaArrayBuffer:async e=>{let t=typeof e==`string`?e:e?.url,n=t?await fetch(t).catch(()=>null):null;return n?.ok?n.arrayBuffer():{missing:!0,ref:e}},resolveDesktopMediaUrl:async e=>typeof e==`string`&&e.startsWith(`sm-media://asset/`)?e:null,isMissing:e=>!!(e&&e.missing),proxiedMediaUrl:e=>e,cachedObjectUrlIfPresent:()=>null,desktopBridge:()=>null,isDeviceMediaUrl:_n,resolveDeviceMediaUrl:cn,deviceMediaUrlFor:e=>/^[0-9a-f-]{36}$/i.test(e?.assetId||``)&&/^[0-9a-f]{64}$/.test(e?.versionId||``)?hn(e):null,loadDeviceMediaBlob:async e=>{let t=gn(e);if(!t)return null;try{return await on(t)}catch{return null}}}),Dr(QL)})),eR=c({cutRecording:()=>rR,cutWithMediaRecorder:()=>nR,rendererAvailable:()=>tR});async function tR({capabilities:e}={}){try{if(typeof VideoEncoder>`u`||typeof OffscreenCanvas>`u`)return!1;let t=await(e||(await Sr(async()=>{let{getExportCapabilities:e}=await Promise.resolve().then(()=>($L(),XL));return{getExportCapabilities:e}},void 0)).getExportCapabilities)();return t?.strategy===`webcodecs`||t?.strategy===`native`}catch{return!1}}async function nR(e,{keep:t,width:n,height:r,shortSide:i=1080,fps:a=30,signal:o,onProgress:s,documentRef:c=globalThis.document}={}){if(typeof MediaRecorder!=`function`||!c)throw Error(`This browser cannot cut recordings.`);let l=(t||[]).filter(e=>e.end>e.start);if(!l.length)throw Error(`Keep at least part of the recording.`);let u=l.reduce((e,t)=>e+t.end-t.start,0),d=iR(n||1920,r||1080,i),f=URL.createObjectURL(e),p=c.createElement(`video`),m=c.createElement(`canvas`);m.width=d.width,m.height=d.height;for(let e of[p,m])e.setAttribute(`aria-hidden`,`true`),e.style.position=`fixed`,e.style.left=`-20000px`,e.style.top=`0`,e.style.width=`1px`,e.style.height=`1px`;p.preload=`auto`,p.playsInline=!0,p.muted=!1,p.volume=1,p.src=f,c.body.append(p,m);let h=m.getContext(`2d`,{alpha:!1}),g=null,_=null,v=null,y=null,b=()=>{clearInterval(y);try{_?.getTracks().forEach(e=>e.stop())}catch{}try{g?.close()}catch{}p.pause(),p.removeAttribute(`src`);try{p.load()}catch{}p.remove(),m.remove(),URL.revokeObjectURL(f)},x=()=>{if(o?.aborted)throw Object.assign(Error(`The cut was cancelled.`),{name:`AbortError`})};try{await new Promise((e,t)=>{let n=setTimeout(()=>t(Error(`The recording did not load in time.`)),3e4);p.onloadedmetadata=()=>{clearTimeout(n),e()},p.onerror=()=>{clearTimeout(n),t(Error(`This recording could not be read.`))}}),x(),_=m.captureStream(a);let e=globalThis.AudioContext||globalThis.webkitAudioContext;if(typeof e==`function`&&typeof MediaStream==`function`)try{g=new e;let t=g.createMediaStreamDestination();g.createMediaElementSource(p).connect(t),_=new MediaStream([..._.getVideoTracks(),...t.stream.getAudioTracks()])}catch{g?.close?.(),g=null}let t=cr(`screen`,{isTypeSupported:e=>MediaRecorder.isTypeSupported?.(e),canPlayType:e=>c.createElement(`video`).canPlayType(e)});v=new MediaRecorder(_,{...t?{mimeType:t}:{},videoBitsPerSecond:lr({width:d.width,height:d.height,frameRate:a}),audioBitsPerSecond:mr.voice});let n=[];v.addEventListener(`dataavailable`,e=>{e.data?.size&&n.push(e.data)});let r=new Promise(e=>v.addEventListener(`stop`,e,{once:!0})),i=new Promise((e,t)=>v.addEventListener(`error`,()=>t(Error(`Recording the cut failed.`)),{once:!0})),f=()=>{try{h.drawImage(p,0,0,d.width,d.height)}catch{}},b=e=>new Promise((t,n)=>{let r=setTimeout(()=>n(Error(`The recording could not be positioned.`)),15e3);p.onseeked=()=>{clearTimeout(r),t()},p.currentTime=e});await b(l[0].start),f(),v.start(1e3),v.pause();let S=0;y=setInterval(f,Math.round(1e3/a));for(let e of l)x(),Math.abs(p.currentTime-e.start)>.05&&await b(e.start),f(),await g?.resume?.(),v.resume(),await p.play(),await new Promise((t,n)=>{let r=()=>{if(o?.aborted){n(Object.assign(Error(`The cut was cancelled.`),{name:`AbortError`}));return}let i=p.currentTime;if(s?.(Math.min(1,(S+Math.max(0,i-e.start))/u)),i>=e.end-1/a||p.ended){t();return}setTimeout(r,40)};Promise.race([i]).catch(n),r()}),p.pause(),v.pause(),S+=e.end-e.start;v.stop(),await Promise.race([r,i]);let C=v.mimeType||t||`video/webm`,w=await tr(new Blob(n,{type:C}),u*1e3);if(!w.size)throw Error(`Nothing was recorded from the cut.`);return s?.(1),{file:w,duration:u,width:d.width,height:d.height}}finally{b()}}async function rR(e,{keep:t,width:n,height:r,duration:i,shortSide:a=1080,fps:o=30,signal:s,onProgress:c,renderer:l,playback:u=nR,available:d=tR}={}){return await d()?{...await(l||(await Sr(async()=>{let{renderRecordingCut:e}=await Promise.resolve().then(()=>($L(),XL));return{renderRecordingCut:e}},void 0)).renderRecordingCut)(e,{keep:t,width:n,height:r,duration:i,fps:o,shortSide:a,signal:s,onProgress:c}),method:`renderer`}:{...await u(e,{keep:t,width:n,height:r,shortSide:a,fps:o,signal:s,onProgress:c}),method:`playback`}}var iR,aR=o((()=>{sr(),vr(),Cr(),iR=(e,t,n)=>{let r=Math.min(1,n/Math.max(1,Math.min(e,t)));return{width:Math.max(2,Math.round(e*r/2)*2),height:Math.max(2,Math.round(t*r/2)*2)}}}));xt(),We(),Ut(),Dn(),sr(),vr(),Cr();var oR={screen:`screen.capture`,camera:`camera.capture`,microphone:`microphone.capture`},sR=500,cR=async(e,t)=>(await Sr(async()=>{let{cutRecording:e}=await Promise.resolve().then(()=>(aR(),eR));return{cutRecording:e}},void 0)).cutRecording(e,t),lR=async()=>{if(typeof MediaRecorder!=`function`)return`none`;try{return await(await Sr(async()=>{let{rendererAvailable:e}=await Promise.resolve().then(()=>(aR(),eR));return{rendererAvailable:e}},void 0)).rendererAvailable()?`renderer`:`playback`}catch{return`playback`}};async function uR(e){if(typeof document>`u`)return{};let t=URL.createObjectURL(e),n=document.createElement(`video`);n.preload=`metadata`,n.muted=!0;try{return await new Promise((e,r)=>{let i=setTimeout(()=>r(Error(`The video did not load in time.`)),3e4);n.onloadedmetadata=()=>{clearTimeout(i),e({duration:Number.isFinite(n.duration)?n.duration:0,width:n.videoWidth,height:n.videoHeight})},n.onerror=()=>{clearTimeout(i),r(Error(`This video cannot be read here.`))},n.src=t})}finally{n.removeAttribute(`src`);try{n.load()}catch{}URL.revokeObjectURL(t)}}var dR=/^\/api\/media\/[A-Za-z0-9_-]+\/[A-Za-z0-9_-][A-Za-z0-9._-]*$/;async function fR(e,{signal:t}={}){let n=typeof location<`u`?location.origin:``,r=e.startsWith(`sm-media://asset/`),i=dR.test(e),a=n&&e.startsWith(`blob:${n}/`);if(!r&&!i&&!a)throw Error(`Cut a recording kept on this device or saved in StillMade.`);let o=await fetch(e,{signal:t,credentials:`omit`,redirect:i?`follow`:`error`,referrerPolicy:`no-referrer`}).catch(()=>null);if(!o?.ok)throw Error(`This video cannot be read here.`);let s=(o.headers.get(`content-type`)||``).split(`;`)[0].trim().toLowerCase();if(!kn.video.includes(s))throw Error(`Choose a supported video file.`);if(Number(o.headers.get(`content-length`))>2147483648)throw Error(`Videos over 2 GB cannot be cut here.`);if(!o.body?.getReader)return o.blob();let c=o.body.getReader(),l=[],u=0;try{for(;;){let{done:e,value:t}=await c.read();if(e)break;if(u+=t.byteLength,u>2147483648)throw Error(`Videos over 2 GB cannot be cut here.`);l.push(t)}}finally{await c.cancel().catch(()=>{}),c.releaseLock()}return new Blob(l,{type:s})}function pR(e,t){if(!Array.isArray(e)||!e.length||e.length>sR)throw Error(`Keep 1 to ${sR} ranges of the recording.`);let n=-1,r=[];for(let i of e){let e=Number(i?.start),a=Number(i?.end);if(!Number.isFinite(e)||!Number.isFinite(a)||e<0||e<n||a<=e)throw Error(`Keep ranges are ordered, non-overlapping {start, end} seconds.`);r.push({start:e,end:t>0?Math.min(a,t):a}),n=a}return r.filter(e=>e.end-e.start>.001)}var mR={echoCancellation:!0,noiseSuppression:!0,autoGainControl:!1},hR=1048576,gR=e=>{try{for(let t of e?.getTracks?.()||[])t.stop()}catch{}},_R=(e,t)=>{try{return e?.[t===`video`?`getVideoTracks`:`getAudioTracks`]?.()||[]}catch{return[]}},vR=e=>{try{return e?.getSettings?.()||{}}catch{return{}}},yR=e=>[`NotAllowedError`,`AbortError`].includes(e?.name);function bR(e,{bridge:t=globalThis.stillmadeDesktop?.blockDesktop,onStatus:n=()=>{},storageScope:r=`preview`,limits:i,now:a=Date.now,renderCut:o=cR,probeVideo:s=uR,probeCut:c=lR}={}){let l=null,u=null,d=!1,f=null,p=!1,m=null,h=null,g=null,_=new Set,v=e=>e&&[`audio`,`video`,`image`].includes(e.kind)&&[`assetId`,`versionId`,`url`].every(t=>typeof e[t]==`string`&&e[t])?JSON.stringify([e.kind,e.assetId,e.versionId,e.url]):``,y=e?.manifest?.permissions?.desktop||[],b=new Map((e?.manifest?.desktopTools||[]).map(e=>[e.id,new Set(e.actions||[])])),x={"tool.launch":`launch`,"tool.project.import":`project.import`,"tool.project.open":`project.open`,"tool.project.render":`project.render`,"tool.adapter.import":`adapter.import`,"tool.adapter.inspect":`adapter.inspect`,"tool.adapter.execute":`adapter.execute`,"tool.adapter.describe":`adapter.describe`,"tool.adapter.call":`adapter.call`},S=t?`desktop`:`browser`,C=!!t&&[`recordingOpen`,`recordingAppend`,`recordingClose`].every(e=>typeof t[e]==`function`),w={...S===`browser`?gr.browser:C?gr.desktop:gr.legacyDesktop,...i},T=()=>({seconds:w.seconds,bytes:Number.isFinite(w.bytes)?w.bytes:null}),E=async(e,n,r)=>{if(!C)return t.save(l,e,new Uint8Array(await n.arrayBuffer()),r);let{id:i,maxAppendBytes:a}=await t.recordingOpen(l,{kind:e,mime:r}),o=Math.min(a||8*hR,8*hR);try{for(let e=0;e<n.size;e+=o)await t.recordingAppend(l,i,new Uint8Array(await n.slice(e,e+o).arrayBuffer()))}catch(e){throw await t.recordingClose(l,i,{discard:!0}).catch(()=>{}),e}return t.recordingClose(l,i,{})},D=()=>{if(!t)throw Error(`This capability requires the StillMade desktop app.`)},O=e=>{if(d)throw Error(`Block desktop access was closed. Reopen the Block.`);if(!y.includes(e))throw Error(`Declare permissions.desktop: ${e}`)},k=async()=>(u||=(async()=>{D();let n=e.manifest,i=await t.open({id:n.id,version:n.version,digest:await ft(e),permissions:y,tools:n.desktopTools||[],name:n.name,storageScope:`${Vt()||`anonymous`}:${r}`});if(d)throw await t.close(i),Error(`Block was closed`);return l=i,m=setTimeout(()=>ie(),36e5),i})(),u),A=async(e,n={})=>{D(),O(e);let r=await k();if(d)throw Error(`Block was closed`);return t.invoke(r,e,n)},j=(e,t,r)=>{if(!(f!==e||e.ended)){e.ended={stoppedBy:t,message:r},e.endedAt=a(),clearTimeout(e.timer),clearInterval(e.cursorTimer);try{e.recorder.state!==`inactive`&&e.recorder.stop()}catch{}n({active:!0,ended:!0,kind:e.kind,stoppedBy:t,message:r})}},M=e=>{clearTimeout(e.timer),clearInterval(e.cursorTimer),gR(e.stream),gR(e.microphone);try{e.audioContext?.close?.()}catch{}},N=(e,n)=>{e.appending=e.appending.then(async()=>{e.discarded||await t.recordingAppend(l,e.sink.id,new Uint8Array(await n.arrayBuffer()))}).catch(t=>{!e.ended&&!e.discarded&&j(e,`disk`,t?.message||`The recording could not be written to disk.`)})},P=async e=>{let r=f;if(!r)throw Error(`No recording is active`);return r.finishing||=(async()=>{if(r.recorder.state!==`inactive`&&r.recorder.stop(),await r.stopped,M(r),f=null,n({active:!1}),r.sink&&await r.appending,!e)return r.sink&&(r.discarded=!0,await t.recordingClose(l,r.sink.id,{discard:!0}).catch(()=>{})),{cancelled:!0};if(r.error)throw r.sink&&(r.discarded=!0,await t.recordingClose(l,r.sink.id,{discard:!0}).catch(()=>{})),Error(r.error);if(!r.chunks.length)throw Error(`Nothing was recorded.`);let i=r.recorder.mimeType||r.mimeType||``,o=Math.max(1,(r.endedAt||a())-r.started),s=r.kind===`microphone`?`audio`:`video`,c=i.split(`;`)[0].trim(),u={duration:o/1e3,mimeType:c,...s===`video`&&r.width?{width:r.width,height:r.height}:{}},d;if(r.sink){let e=await tr(new Blob([r.chunks[0]],i?{type:i}:void 0),o);d=await t.recordingClose(l,r.sink.id,{head:new Uint8Array(await e.arrayBuffer())})}else{let e=await tr(new Blob(r.chunks,i?{type:i}:void 0),o);if(t)d=await t.save(l,r.kind,new Uint8Array(await e.arrayBuffer()),c);else{let t=_r(r.kind,c,r.started);d=ln(await rn(new File([e],t,i?{type:c}:void 0),{kind:s,metadata:u,maxBytes:w.bytes}),{name:t})}}let p=v(d);return p&&_.add(p),{asset:d,...u,bytes:r.bytes,...r.ended?{stoppedBy:r.ended.stoppedBy,message:r.ended.message}:{},cursor:r.cursor,displays:r.displays||[],coordinates:`Global screen coordinates in device-independent pixels; timestamps in milliseconds relative to recording start.`}})(),r.finishing},F=()=>{let e=f;return e?{active:!0,platform:S,kind:e.kind,elapsed:(e.endedAt||a())-e.started,bytes:e.bytes,ended:!!e.ended,...e.ended||{},limits:T()}:{active:!1,platform:S,...g?{cutting:{progress:g.progress}}:{},limits:T()}},I=async()=>{O(Object.values(oR).find(e=>y.includes(e))||`screen.capture`);let e=typeof MediaRecorder==`function`&&!!navigator?.mediaDevices?.getDisplayMedia,n=null,r=0;if(!t)try{let e=await un();n=Number.isFinite(e?.quota)?e.quota:null,r=Number(e?.bytes)||0}catch{}let i=lr({width:1920,height:1080,frameRate:30})+mr.voice,a=S===`browser`?dr({platform:`browser`,bitsPerSecond:i,quota:n,used:r}):{seconds:w.seconds,bytes:Number.isFinite(w.bytes)?w.bytes:null};return S===`browser`&&Number.isFinite(w.bytes)&&(a.bytes=Math.min(a.bytes,w.bytes)),{platform:S,streams:C,recorder:!!e&&(t?!0:nn()),cut:e?await c():`none`,budget:{seconds:Math.min(a.seconds,w.seconds),bytes:a.bytes==null?null:Math.floor(a.bytes/hR)*hR,bitsPerSecond:i},limits:T()}},ee=async(e,t)=>{let n=navigator.mediaDevices;if(e===`screen`){let e=ur({resolution:t.resolution,frameRate:t.frameRate}),r=t=>n.getDisplayMedia({video:e,audio:t}),i=t.systemAudio===!0;try{return await r(i)}catch(e){if(!i||yR(e))throw e;return r(!1)}}return e===`camera`?n.getUserMedia({video:ur({resolution:t.resolution,frameRate:t.frameRate}),audio:!1}):n.getUserMedia({video:!1,audio:mR})},te=(e,t)=>{if(!t)return{recorded:e};let n=_R(t,`audio`),r=_R(e,`audio`);if(!n.length)return{recorded:e};let i=globalThis.AudioContext||globalThis.webkitAudioContext;if(r.length&&typeof i==`function`&&typeof MediaStream==`function`){let n=new i,r=n.createMediaStreamDestination();for(let i of[e,t])n.createMediaStreamSource(i).connect(r);return{recorded:new MediaStream([..._R(e,`video`),..._R(r.stream,`audio`)]),audioContext:n}}return typeof MediaStream==`function`?{recorded:new MediaStream([..._R(e,`video`),...r.length?r:n])}:{recorded:e}},ne=async e=>{if(O([`screen.capture`,`camera.capture`].find(e=>y.includes(e))||`screen.capture`),f)throw Error(`Stop the recording before cutting it.`);let n=e.source;if(!v(n)||n.kind!==`video`)throw Error(`Choose the video to cut.`);let r=String(n.url),i,c={width:Number(n.width)||0,height:Number(n.height)||0,duration:Number(n.duration)||0};if(_n(r)){let e=gn(r),t=await an(e);if(!t)throw Error(`This recording is not on this device.`);i=await on(e),c={width:Number(t.width)||c.width,height:Number(t.height)||c.height,duration:Number(t.duration)||c.duration}}else i=await fR(r);if(d)throw Error(`Block was closed`);c.width>0&&c.height>0&&c.duration>0||(c={...c,...await s(i)});let l=pR(e.keep,c.duration);if(!l.length)throw Error(`Keep at least part of the recording.`);g={progress:0,started:a()};try{let e=await o(i,{keep:l,width:c.width,height:c.height,duration:c.duration,onProgress:e=>{let t=typeof e==`number`?e:e?.total?e.done/e.total:null;Number.isFinite(t)&&g&&(g.progress=Math.max(0,Math.min(1,t)))}});if(d)throw Error(`Block was closed`);let r=e?.file;if(!(r instanceof Blob)||!r.size)throw Error(`The cut could not be rendered here.`);let a=await s(r).catch(()=>({})),u=String(r.type||`video/mp4`).split(`;`)[0].trim(),f={duration:a.duration||e.duration||l.reduce((e,t)=>e+t.end-t.start,0),width:a.width||c.width,height:a.height||c.height,mimeType:u},p=`${String(n.name||`recording`).replace(/\.[a-z0-9]+$/i,``).slice(0,200)||`recording`}-cut.${/webm/.test(u)?`webm`:`mp4`}`,m;m=t?await E(`screen`,r,u):ln(await rn(new File([r],p,{type:u}),{kind:`video`,metadata:f,maxBytes:w.bytes}),{name:p});let h=v(m);return h&&_.add(h),{asset:m,...f,bytes:r.size,keep:l}}finally{g=null}},re=async(e,r={})=>{if(e===`record.stop`)return P(!0);if(e===`record.cancel`)return P(!1);if(e===`record.status`)return F();if(e===`device.info`)return I();if(e===`session.close`)return await ie(),{closed:!0};if(p)throw Error(`A desktop request is already in progress`);p=!0;try{if(e===`record.cut`)return await ne(r);if(e!==`record.start`){if(e.startsWith(`tool.`)){D(),O(`native.tools`);let n=b.get(r.tool),i=x[e];if(!n||e!==`tool.status`&&!n.has(i))throw Error(`Declare the exact desktop tool action`);let a=await t.invoke(await k(),e,r);if(d)throw Error(`Block desktop access closed before the native operation completed.`);let o=v(a?.asset);return o&&_.add(o),a}if(e.startsWith(`storage.`)){if(![`storage.info`,`storage.list`,`storage.read`,`storage.write`,`storage.remove`].includes(e))throw Error(`Unknown storage operation`);if(!t)throw Error(`Device storage requires the StillMade desktop app.`);if(d)throw Error(`Block desktop access was closed. Reopen the Block.`);return t.invoke(await k(),e,r)}if(!Ue.includes(e))throw Error(`Unknown desktop operation`);if(Object.values(oR).includes(e))throw Error(`Use record.start with kind screen, camera, or microphone.`);let n=await A(e,r);if(e===`media.pick`)for(let e of n?.assets||[]){let t=v(e);t&&_.add(t)}return n}if(f)throw Error(`A recording is already active`);let i=r.kind||`screen`,o=oR[i];if(!o)throw Error(`Choose screen, camera, or microphone`);O(o);let s=i===`screen`&&r.microphone===!0;if(s&&O(`microphone.capture`),r.cursor&&(O(`cursor.track`),D(),await A(`cursor.track`)),!t){if(!navigator?.mediaDevices?.[i===`screen`?`getDisplayMedia`:`getUserMedia`]||typeof MediaRecorder!=`function`)throw Error(`This browser cannot record. Use a current desktop browser or StillMade Desktop.`);if(!nn())throw Error(`This browser cannot keep recordings on the device. Use StillMade Desktop.`)}if(t&&(i!==`screen`&&await A(o),s&&await A(`microphone.capture`)),i===`screen`||!t){if(t&&await t.authorize(await k(),o),await new Promise((e,t)=>{h={reject:t},n({awaitingStart:!0,kind:i,microphone:s,start:()=>{h=null,e()}})}),d)throw Error(`Block was closed`);t&&await A(o,{systemAudio:r.systemAudio===!0})}let c=await ee(i,r);if(d)throw gR(c),Error(`Block was closed`);let u=null;if(s){try{u=await navigator.mediaDevices.getUserMedia({video:!1,audio:mR})}catch(e){throw gR(c),Error(`The microphone is unavailable: ${e?.message||e}`)}if(d)throw gR(c),gR(u),Error(`Block was closed`)}let p=vR(_R(c,`video`)[0]),m=Number(p.width)||0,g=Number(p.height)||0,y=cr(i,{isTypeSupported:e=>MediaRecorder.isTypeSupported?.(e),canPlayType:e=>typeof document<`u`?document.createElement(`video`).canPlayType(e):`maybe`}),S={...y?{mimeType:y}:{},...i===`microphone`?{}:{videoBitsPerSecond:lr({width:m,height:g,frameRate:p.frameRate})},audioBitsPerSecond:r.systemAudio===!0?mr.system:mr.voice},E,F,I;try{({recorded:E,audioContext:F}=te(c,u)),I=new MediaRecorder(E,S)}catch(e){gR(c),gR(u);try{F?.close?.()}catch{}throw e}let re={kind:i,stream:c,microphone:u,audioContext:F,recorder:I,mimeType:y,width:m,height:g,chunks:[],bytes:0,cursor:[],started:a(),error:null,ended:null,endedAt:null,sink:null,appending:Promise.resolve(),discarded:!1};if(f=re,C){try{re.sink=await t.recordingOpen(l,{kind:i,mime:(I.mimeType||y||``).split(`;`)[0].trim()})}catch(e){throw M(re),f=null,e}if(d)throw M(re),f=null,await t.recordingClose(l,re.sink.id,{discard:!0}).catch(()=>{}),Error(`Block was closed`)}re.stopped=new Promise(e=>I.addEventListener(`stop`,e,{once:!0})),I.addEventListener(`dataavailable`,e=>{let n=e.data?.size||0;if(n&&f===re){if(re.bytes+n>w.bytes){j(re,`size`,`This recording reached the ${Math.round(w.bytes/hR)} MB that fit here and was saved up to that point.${t?``:` StillMade Desktop records longer.`}`);return}re.bytes+=n,re.sink&&re.chunks.length?N(re,e.data):re.chunks.push(e.data)}}),I.addEventListener(`error`,()=>{re.error=`Recording failed`,P(!1).catch(()=>{})});for(let e of[..._R(c,`video`),..._R(c,`audio`)])e.addEventListener(`ended`,()=>{f===re&&!re.ended&&j(re,`sharing`,`Sharing ended. The recording was saved up to that point.`)});try{I.start(1e3)}catch(e){throw M(re),f=null,e}if(r.cursor){let e=!1;re.cursorTimer=setInterval(async()=>{if(!(e||f!==re||re.ended||re.cursor.length>=18e3)){e=!0;try{let e=await A(`cursor.track`);f===re&&(re.displays=e.displays,re.cursor.push({x:e.x,y:e.y,time:e.time-re.started}))}catch(e){re.error=e.message,P(!1).catch(()=>{})}finally{e=!1}}},100)}return re.ended||(re.timer=setTimeout(()=>j(re,`time`,`This recording reached the ${Math.round(w.seconds/60)} minute limit and was saved up to that point.`),w.seconds*1e3),n({active:!0,kind:i})),{recording:!0,kind:i,cursor:!!r.cursor,microphone:!!u,mimeType:y||null,width:m,height:g,limits:T()}}catch(e){throw f||n({active:!1,error:e.message}),e}finally{p=!1}},ie=async()=>{d||(d=!0,ae?.(),h?.reject(Error(`Recording cancelled`)),h=null,clearTimeout(m),f&&(gR(f.stream),gR(f.microphone)),f&&await P(!1).catch(()=>{}),l&&await t.close(l).catch(()=>{}),n({active:!1,closed:!0}))},ae=t?.onRevoked?.(e=>{l===e&&ie().catch(()=>{})});return{call:re,close:ie,authorizesMedia:e=>_.has(v(e)),platform:S}}var xR=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,78,5,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,199,7,137,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,55,9,266,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,233,0,3,0,8,1,6,0,475,6,110,6,6,9,4759,9,787719,239],SR=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,7,25,39,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,5,57,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,24,43,261,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,33,24,3,24,45,74,6,0,67,12,65,1,2,0,15,4,10,7381,42,31,98,114,8702,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,208,30,2,2,2,1,2,6,3,4,10,1,225,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4381,3,5773,3,7472,16,621,2467,541,1507,4938,6,8489],CR=`‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࢗ-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-᫝᫠-᫫ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・`,wR=`ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-࢏ࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚ౜ౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽ೜-ೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲊᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-Ƛ꟱-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ`,TR={3:`abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile`,5:`class enum extends super const export import`,6:`enum`,strict:`implements interface let package private protected public static yield`,strictBind:`eval arguments`},ER=`break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this`,DR={5:ER,"5module":ER+` export import`,6:ER+` const class extends export import super`},OR=/^in(stanceof)?$/,kR=RegExp(`[`+wR+`]`),AR=RegExp(`[`+wR+CR+`]`);function jR(e,t){for(var n=65536,r=0;r<t.length;r+=2){if(n+=t[r],n>e)return!1;if(n+=t[r+1],n>=e)return!0}return!1}function MR(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&kR.test(String.fromCharCode(e)):t!==!1&&jR(e,SR)}function NR(e,t){return e<48?e===36:e<58?!0:e<65?!1:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&AR.test(String.fromCharCode(e)):t===!1?!1:jR(e,SR)||jR(e,xR)}var PR=function(e,t){t===void 0&&(t={}),this.label=e,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop||null,this.updateContext=null};function FR(e,t){return new PR(e,{beforeExpr:!0,binop:t})}var IR={beforeExpr:!0},LR={startsExpr:!0},RR={};function zR(e,t){return t===void 0&&(t={}),t.keyword=e,RR[e]=new PR(e,t)}var Z={num:new PR(`num`,LR),regexp:new PR(`regexp`,LR),string:new PR(`string`,LR),name:new PR(`name`,LR),privateId:new PR(`privateId`,LR),eof:new PR(`eof`),bracketL:new PR(`[`,{beforeExpr:!0,startsExpr:!0}),bracketR:new PR(`]`),braceL:new PR(`{`,{beforeExpr:!0,startsExpr:!0}),braceR:new PR(`}`),parenL:new PR(`(`,{beforeExpr:!0,startsExpr:!0}),parenR:new PR(`)`),comma:new PR(`,`,IR),semi:new PR(`;`,IR),colon:new PR(`:`,IR),dot:new PR(`.`),question:new PR(`?`,IR),questionDot:new PR(`?.`),arrow:new PR(`=>`,IR),template:new PR(`template`),invalidTemplate:new PR(`invalidTemplate`),ellipsis:new PR(`...`,IR),backQuote:new PR("`",LR),dollarBraceL:new PR("${",{beforeExpr:!0,startsExpr:!0}),eq:new PR(`=`,{beforeExpr:!0,isAssign:!0}),assign:new PR(`_=`,{beforeExpr:!0,isAssign:!0}),incDec:new PR(`++/--`,{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new PR(`!/~`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:FR(`||`,1),logicalAND:FR(`&&`,2),bitwiseOR:FR(`|`,3),bitwiseXOR:FR(`^`,4),bitwiseAND:FR(`&`,5),equality:FR(`==/!=/===/!==`,6),relational:FR(`</>/<=/>=`,7),bitShift:FR(`<</>>/>>>`,8),plusMin:new PR(`+/-`,{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:FR(`%`,10),star:FR(`*`,10),slash:FR(`/`,10),starstar:new PR(`**`,{beforeExpr:!0}),coalesce:FR(`??`,1),_break:zR(`break`),_case:zR(`case`,IR),_catch:zR(`catch`),_continue:zR(`continue`),_debugger:zR(`debugger`),_default:zR(`default`,IR),_do:zR(`do`,{isLoop:!0,beforeExpr:!0}),_else:zR(`else`,IR),_finally:zR(`finally`),_for:zR(`for`,{isLoop:!0}),_function:zR(`function`,LR),_if:zR(`if`),_return:zR(`return`,IR),_switch:zR(`switch`),_throw:zR(`throw`,IR),_try:zR(`try`),_var:zR(`var`),_const:zR(`const`),_while:zR(`while`,{isLoop:!0}),_with:zR(`with`),_new:zR(`new`,{beforeExpr:!0,startsExpr:!0}),_this:zR(`this`,LR),_super:zR(`super`,LR),_class:zR(`class`,LR),_extends:zR(`extends`,IR),_export:zR(`export`),_import:zR(`import`,LR),_null:zR(`null`,LR),_true:zR(`true`,LR),_false:zR(`false`,LR),_in:zR(`in`,{beforeExpr:!0,binop:7}),_instanceof:zR(`instanceof`,{beforeExpr:!0,binop:7}),_typeof:zR(`typeof`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:zR(`void`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:zR(`delete`,{beforeExpr:!0,prefix:!0,startsExpr:!0})},BR=/\r\n?|\n|\u2028|\u2029/,VR=new RegExp(BR.source,`g`);function HR(e){return e===10||e===13||e===8232||e===8233}function UR(e,t,n){n===void 0&&(n=e.length);for(var r=t;r<n;r++){var i=e.charCodeAt(r);if(HR(i))return r<n-1&&i===13&&e.charCodeAt(r+1)===10?r+2:r+1}return-1}var WR=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,GR=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,KR=Object.prototype,qR=KR.hasOwnProperty,JR=KR.toString,YR=Object.hasOwn||(function(e,t){return qR.call(e,t)}),XR=Array.isArray||(function(e){return JR.call(e)===`[object Array]`}),ZR=Object.create(null);function QR(e){return ZR[e]||(ZR[e]=RegExp(`^(?:`+e.replace(/ /g,`|`)+`)$`))}function $R(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}var ez=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,tz=function(e,t){this.line=e,this.column=t};tz.prototype.offset=function(e){return new tz(this.line,this.column+e)};var nz=function(e,t,n){this.start=t,this.end=n,e.sourceFile!==null&&(this.source=e.sourceFile)};function rz(e,t){for(var n=1,r=0;;){var i=UR(e,r,t);if(i<0)return new tz(n,t-r);++n,r=i}}var iz={ecmaVersion:null,sourceType:`script`,strict:!1,onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,startLocation:null,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},az=!1;function oz(e){var t={};for(var n in iz)t[n]=e&&YR(e,n)?e[n]:iz[n];if(t.ecmaVersion===`latest`?t.ecmaVersion=1e8:t.ecmaVersion==null?(!az&&typeof console==`object`&&console.warn&&(az=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
1169
+ </g>`,OO=`http://www.w3.org/2000/svg`,kO=e=>e===`left`||e===`right`,AO=(e,t)=>e.querySelector(`[data-role="${t}"]`)}));function MO(e,t,n){e===`talk`&&(e=`talkGesture`);let r=BO[e];return r?r(t,n):{}}function NO(e){let t=(q(e*8.7)+1)/2;return{mOpen:2+t*12,mWidth:12+t*15,mCurve:2+q(e*4.6)*6}}function PO(e,t=0){return{armR:6*q(e*4.6),armL:4*q(e*4.6+1),headTilt:1.2*q(e*2.2)+t*3}}function FO(e,...t){let n={...e};for(let e of t)for(let t in e)n[t]=(n[t]||0)+e[t];return n}var q,IO,LO,RO,zO,BO,VO,HO,UO=o((()=>{q=Math.sin,IO=Math.cos,LO=Math.max,RO=Math.PI,zO=(e,t,n)=>e<t?t:e>n?n:e,BO={idle(e){return{headTilt:1.2*q(e*1.2),bob:1.5*q(e*1.5),armR:-8+2*q(e),armL:8-2*q(e)}},stand(e){return{headTilt:.5*q(e*1.1),bob:.6*q(e*1.3)}},turn(e){return BO.idle(e)},wave(e){return{armR:-150,elbowR:-30+18*q(e*9),headTilt:3,bob:1.2*q(e*1.5)}},point(e,t={}){return{armR:-132-zO((t.aimDY||0)*18,-10,22),elbowR:-6,headTilt:zO(-4+(t.aimDX||0)*6,-11,7),card:1,bob:q(e*1.3)}},look(e,t={}){return{headTilt:zO((t.aimDX||0)*9,-11,11),bob:1.1*q(e*1.3)}},lookAround(e,t={}){return{headTilt:((t.aimDX||0)*8||0)+10*q(e*.9),bob:1.1*q(e*1.2),armR:-8+2*q(e)}},walk(e,t={}){let n=e*(t.speed||1.2)%1*2*RO;return{legR:-28*q(n),legL:-28*q(n+RO),kneeR:34*LO(0,q(n+2)),kneeL:34*LO(0,q(n+RO+2)),armR:-8+22*q(n+RO),armL:8+22*q(n),elbowR:-12,elbowL:12,bob:-2-4*(.5-.5*IO(2*n))}},run(e,t={}){let n=e*(t.speed||1.2)*1.6%1*2*RO;return{legR:-42*q(n),legL:-42*q(n+RO),kneeR:46*LO(0,q(n+2)),kneeL:46*LO(0,q(n+RO+2)),armR:-22+34*q(n+RO),armL:22+34*q(n),elbowR:-42,elbowL:42,bob:-3-7*(.5-.5*IO(2*n)),headTilt:-4}},sit(e){return{legR:-58,legL:-56,kneeR:76,kneeL:74,bob:40,armR:-14,armL:14,headTilt:1*q(e*1.1)}},fall(e){return{headTilt:34,armR:-58,armL:58,elbowR:20,elbowL:-20,legR:-42,legL:18,kneeR:20,bob:22}},handshake(e){return{armR:-72+5*q(e*7),elbowR:34,headTilt:4,bob:1}},handOverItem(e){return{armR:-84,elbowR:22,armL:12,headTilt:3,bob:q(e*1.4)}},argue(e){return{armR:-66+22*q(e*6),elbowR:-22,armL:12,headTilt:5*q(e*3.2),bob:1.5*q(e*2)}},shrug(e){return{armL:26,armR:-26,elbowL:-34,elbowR:34,headTilt:2*q(e*1.4),bob:1+1.4*(.5-.5*IO(e*3))}},think(e){return{armR:-96,elbowR:-62,headTilt:8,armL:6,bob:.8*q(e*1.1)}},shocked(e){return{armR:-42,armL:42,elbowR:22,elbowL:-22,headTilt:-6,mOpen:15,mWidth:12,bob:-3+.6*q(e*8)}},celebrate(e){return{armL:150,armR:-150,elbowL:10,elbowR:-10,headTilt:2*q(e*4),bob:-6*Math.abs(q(e*4))}},cry(e){return{armR:-104,armL:104,elbowR:-58,elbowL:58,headTilt:12+2*q(e*5),mCurve:-8,bob:1.4*q(e*3)}},whisper(e){return{armR:-98,elbowR:-54,headTilt:6,mOpen:3+1.5*q(e*8),mWidth:12,bob:.6*q(e*1.5)}},talkGesture(e,t={}){return{armR:-14+10*q(e*4.6),elbowR:-16,armL:12+8*q(e*4.6+1),headTilt:1.6*q(e*2.2)+(t.aimDX||0)*4,bob:1.1*q(e*1.5)}},carryBox(e){return{armL:66,armR:-66,elbowL:-40,elbowR:40,headTilt:2,bob:1+.8*q(e*1.4)}},type(e){return{armR:-30,armL:30,elbowR:22,elbowL:-22,headTilt:7,bob:.5*q(e*6)}},drink(e){return{armR:-120,elbowR:-72,headTilt:-5,armL:8,bob:.6*q(e*1.3)}},sleep(e){return{headTilt:32,bob:1.4*q(e*.8),armR:-4,armL:4}},march(e,t={}){let n=e*(t.speed||1)%1*2*RO;return{legR:-24*q(n),legL:-24*q(n+RO),kneeR:40*LO(0,q(n+2)),kneeL:40*LO(0,q(n+RO+2)),armR:-10+16*q(n+RO),armL:10+16*q(n),elbowR:-24,elbowL:24,bob:-2-3*(.5-.5*IO(2*n)),headTilt:0}},flee(e,t={}){return{...BO.run(e,t),headTilt:-18+3*q(e*6),armR:-30+40*q(e*8),armL:30+40*q(e*8+RO),mOpen:6}},salute(e){return{armR:-150,elbowR:-78,headTilt:-2,armL:6,bob:.5*q(e*1.2)}},aim(e,t={}){return{armR:-92-zO((t.aimDY||0)*16,-12,16),elbowR:4,armL:6,headTilt:zO((t.aimDX||0)*6,-8,8),bob:.5*q(e*1.3)}},duck(e){return{bob:30,kneeR:60,kneeL:60,legR:-18,legL:-18,headTilt:14,armR:-30,armL:30,elbowR:30,elbowL:-30}},cheer(e){return{armL:160,armR:-160,elbowL:8,elbowR:-8,headTilt:3*q(e*5),bob:-7*Math.abs(q(e*5)),mOpen:10,mWidth:14}},tablePoint(e,t={}){return{armR:-50-zO((t.aimDY||0)*20,-14,18),elbowR:40,headTilt:zO(10+(t.aimDX||0)*6,2,18),armL:8,bob:.6*q(e*1.2)}},standGuard(e){return{headTilt:.6*q(e*.8),bob:.5*q(e*1),armR:-4,armL:4,elbowR:8,elbowL:-8,legR:-6,legL:6}},sneak(e,t={}){let n=e*(t.speed||.7)%1*2*RO;return{legR:-16*q(n),legL:-16*q(n+RO),kneeR:44+10*LO(0,q(n)),kneeL:44+10*LO(0,q(n+RO)),bob:22,headTilt:6,armR:-24,armL:24,elbowR:30,elbowL:-30}},jump(e){let t=e%1*2*RO,n=LO(0,q(t));return{bob:30-n*70,legR:-20+n*40,legL:-20+n*40,kneeR:40-n*30,kneeL:40-n*30,armR:-20-n*120,armL:20+n*120,headTilt:-2}},climb(e){let t=e*3;return{armR:-150+20*q(t),armL:-150+20*q(t+RO),elbowR:-20,elbowL:-20,legR:-30+20*q(t+RO),legL:-30+20*q(t),kneeR:40,kneeL:40,bob:-2+3*q(t*2),headTilt:-4}},nod(e){let t=q(e*4);return{headTilt:1.5*q(e*1.1),bob:1+3*LO(0,t),armR:-8,armL:8}},headShake(e){return{headTilt:12*q(e*5),bob:.6*q(e*1.3),armR:-8,armL:8}},facepalm(e){return{armR:-128,elbowR:-96,headTilt:16,armL:6,bob:.6*q(e*1.1)}},thumbsUp(e){return{armR:-70,elbowR:44,headTilt:-3,armL:8,bob:.8*q(e*1.4)}},clap(e){let t=24*(.5+.5*q(e*9));return{armR:-40-t,armL:40+t,elbowR:40,elbowL:-40,headTilt:2*q(e*2),bob:1+.8*q(e*4.5)}},beckon(e,t={}){return{armR:-60+12*q(e*5),elbowR:30+20*q(e*5),headTilt:zO(2+(t.aimDX||0)*5,-8,8),armL:8,bob:.8*q(e*1.4)}},presentPalm(e,t={}){return{armR:-58-zO((t.aimDY||0)*14,-10,14),elbowR:24,headTilt:zO((t.aimDX||0)*6,-8,8),armL:8,bob:.6*q(e*1.3)}},laugh(e){return{headTilt:-12+4*q(e*9),bob:2+3*LO(0,q(e*7)),armR:-40,armL:40,elbowR:30,elbowL:-30,mOpen:12,mWidth:18,mCurve:8}},angryStomp(e){let t=e%1*2*RO,n=LO(0,q(t));return{legR:-10-n*20,kneeR:20+n*40,legL:4,bob:6-n*8,headTilt:-8,armR:-30+10*q(e*6),armL:30-10*q(e*6),elbowR:40,elbowL:-40,mOpen:6}},exhausted(e){return{headTilt:20,bob:8+3*q(e*1.4),armR:-18,armL:18,elbowR:8,elbowL:-8,legR:-4,legL:4,mOpen:3+2*q(e*1.4)}},proud(e){return{armR:-44,armL:44,elbowR:64,elbowL:-64,headTilt:-4,bob:.6*q(e*1.1),legR:-8,legL:8}},worry(e){let t=q(e*.8);return{headTilt:5*q(e*1.6),bob:1*q(e*1.4),armR:-70+4*q(e*3),armL:-70-4*q(e*3),elbowR:-40,elbowL:40,legR:-3*t,legL:3*t}},hug(e){return{armR:-74,armL:74,elbowR:64,elbowL:-64,headTilt:6,bob:1+.6*q(e*1.3),legR:-4,legL:4}},pushObject(e){let t=.5-.5*IO(e*3);return{armR:-70,armL:70,elbowR:12,elbowL:-12,headTilt:9,bob:2+2*t,legR:-18-4*t,legL:10}},pull(e){let t=q(e*3.4);return{armR:-46-6*t,armL:46+6*t,elbowR:72,elbowL:-72,headTilt:-7,bob:2+2*t,legR:-16,legL:8}},liftOverhead(e){return{armR:-172,armL:172,elbowR:-8,elbowL:8,headTilt:-6,bob:2+1.4*q(e*1.6),legR:-6,legL:6}},throw(e){let t=e%1*2*RO,n=IO(t);return{armR:-70-90*n,elbowR:-30-30*LO(0,-n),armL:20+14*n,headTilt:-4-4*n,bob:1+1.5*q(e*1.4),legR:-10-6*n,legL:8}},catch(e){let t=LO(0,q(e*2.4));return{armR:-58+6*t,armL:58-6*t,elbowR:52,elbowL:-52,headTilt:-4,bob:-2+4*t}},examine(e,t={}){return{armR:-110,elbowR:-68,headTilt:10+3*q(e*1.6)+(t.aimDX||0)*4,armL:14,elbowL:-10,bob:.5*q(e*1.3)}},write(e){return{armR:-34+3*q(e*8),elbowR:26,armL:22,elbowL:-12,headTilt:13,bob:.4*q(e*5)}},eat(e){let t=LO(0,q(e*3));return{armR:-96-26*t,elbowR:-60-10*t,headTilt:-3,armL:10,bob:.5*q(e*1.3),mOpen:3+6*t}},phoneTalk(e){return{armR:-142,elbowR:-98,headTilt:8,armL:8,bob:.5*q(e*1.3),mOpen:3+2*q(e*7),mWidth:10}},phoneScroll(e){return{armL:44,armR:-34+2*q(e*7),elbowL:-34,elbowR:42,headTilt:15,bob:.4*q(e*1.4)}},sweep(e){let t=q(e*2.2);return{armR:-66+22*t,armL:-38+22*t,elbowR:28,elbowL:22,headTilt:9,bob:1+.6*t,legR:-6,legL:6}},hammer(e){let t=e*2%1*2*RO,n=LO(0,q(t));return{armR:-56-84*n,elbowR:-38,headTilt:6-4*n,armL:10,bob:1+1.4*n,legR:-6,legL:6}},dig(e){let t=e*1.5%1*2*RO,n=LO(0,q(t));return{armR:-44-10*n,armL:30-10*n,elbowR:34,elbowL:-20,headTilt:12+8*n,bob:5+12*n,kneeR:24+16*n,kneeL:24+16*n,legR:-10,legL:6}},drive(e){return{bob:40,legR:-52,legL:-50,kneeR:72,kneeL:70,armR:-46,armL:46,elbowR:38,elbowL:-38,headTilt:2*q(e*1.1)}},read(e){return{armR:-66,armL:66,elbowR:46,elbowL:-46,headTilt:16,bob:.5*q(e*1.2)}},blockShield(e){return{armR:-28,armL:38,elbowR:52,elbowL:-74,headTilt:6,bob:6+.6*q(e*2),kneeR:26,kneeL:26,legR:-8,legL:8}},dodge(e){let t=q(e*3.2);return{headTilt:-16+6*t,bob:5,armR:-40+8*t,armL:40+8*t,elbowR:24,elbowL:-24,legR:-20,legL:12,kneeR:22}}},VO=Object.keys(BO),HO=[`point`,`look`,`talk`,`talkGesture`,`lookAround`,`aim`,`tablePoint`,`presentPalm`,`beckon`]}));function WO(){return{limbWidenX:1,limbWidenLeg:1,torsoScale:1,cover:{}}}function GO(e={}){let t=WO();return[Ek[e.outerwear],Ck[e.top],Ok[e.bottom],wk[e.sleeves]].filter(Boolean).forEach(e=>{let n=e.fit||{};t.limbWidenX=Math.max(t.limbWidenX,n.limbWidenX||1),t.limbWidenLeg=Math.max(t.limbWidenLeg,n.limbWidenLeg||1),t.torsoScale=Math.max(t.torsoScale,n.torsoScale||1)}),t}function KO(e,t,n=0){let r=104-e,i=134-n,a=226+n;return hk(`M${i} 100 Q${i-4} ${r} 180 ${r-6} Q${a+4} ${r} ${a} 100 L${a-6} ${t+100} Q180 ${t+108} ${i+6} ${t+100} Z`)}function qO(e={}){let t=e.h||34,n=e.b||-34,r=100-t*.5;return KO(t,n,e.wob||0)+hk(`M136 ${r} Q180 ${68-t*.3} 224 ${r} Q200 ${80-t*.3} 180 80 Q160 80 136 ${r} Z`,`hairSh`,` opacity=".3"`)}function JO(e={}){let t=e.up||20,n=52-t,r=46-t;return hk(`M130 104 Q126 ${n} 180 ${r} Q234 ${n} 230 104 Q222 ${80-t*.5} 200 76 Q188 66 174 70 Q152 74 140 86 Q133 94 130 104 Z`)+hk(`M130 104 Q126 ${54-t} 180 ${48-t} Q150 58 140 92 Q134 99 130 104 Z`,`hairSh`,` opacity=".28"`)}function YO(e={}){let t=e.s||1;return hk(`M132 104 Q130 54 180 50 Q230 54 228 104 Q220 82 196 78 Q${180-20*t} 64 ${160-6*t} 74 Q144 82 132 104 Z`)+hk(`M132 104 Q130 56 180 52 Q164 60 150 88 Q138 98 132 104 Z`,`hairSh`,` opacity=".26"`)}function XO(e={}){let t=e.len||210;return hk(`M126 108 Q124 50 180 46 Q236 50 234 108 L228 ${t} Q224 ${t+22} 210 ${t+26} L206 150 Q206 96 180 92 Q154 96 154 150 L150 ${t+26} Q136 ${t+22} 132 ${t} Z`)+hk(`M132 100 Q145 58 180 56 Q215 58 228 100 Q206 74 180 74 Q154 74 132 100 Z`,`hairSh`,` opacity=".3"`)}function ZO(e={}){let t=e.r||27,n=e.rows||2,r=``,i=[137,163,195,222],a=[85,61,61,85];return i.forEach((e,n)=>r+=gk(e,a[n],t)),n>1&&[132,154,205,228].forEach((e,n)=>r+=gk(e,[115,126,126,115][n],t-2)),r}function QO(e={}){let t=e.n||10,n=KO(30,-30);for(let e=0;e<t;e++){let r=e/t*Math.PI,i=180+Math.cos(r)*48,a=80-Math.sin(r)*26;n+=gk(i,a,7)}return n}function $O(e={}){let t=e.n||7,n=hk(`M134 102 Q140 78 180 74 Q220 78 226 102 Q206 88 180 86 Q154 88 134 102 Z`);for(let e=0;e<t;e++){let r=138+e*(80/(t-1));n+=hk(`M${r} 86 L${r-5} ${52+e%2*8} L${r+5} 54 Z`)}return n}function ek(){return hk(`M168 108 Q168 46 180 44 Q192 46 192 108 Z`)+hk(`M170 100 Q170 52 180 50 Q178 70 178 100 Z`,`hairSh`,` opacity=".3"`)}function tk(e={}){return KO(28,-30)+gk(180,46,e.r||16)}function nk(e={}){let t=e.side||1,n=e.len||170;return KO(30,-28)+hk(`M${180+t*40} 70 Q${180+t*70} 90 ${180+t*62} ${n} Q${180+t*44} ${n+10} ${180+t*40} ${n} Q${180+t*50} 120 ${180+t*30} 78 Z`)}function rk(e={}){return e.fringe?hk(`M136 100 Q140 84 180 82 Q220 84 224 100 Q206 92 180 92 Q154 92 136 100 Z`):``}function ik(){return hk(`M138 104 Q140 74 165 72 Q150 82 146 104 Z M222 104 Q220 74 195 72 Q210 82 214 104 Z`)}function ak(e={}){let t=e.n||6,n=KO(20,-22);for(let e=0;e<t;e++){let r=142+e*(76/(t-1)),i=180+(r-180)*.3;n+=hk(`M${r-2.5} 100 Q${r-2.5} 62 ${i-2.5} 54 L${i+2.5} 54 Q${r+2.5} 62 ${r+2.5} 100 Z`)}return n}function ok(e,t=`#59352b`){return`<g class="wardrobeHairArt" style="color:${t}">${(_k[e]||_k.crop).fn({})}</g>`}function sk(e,t){if(!Ek[e])return``;let n=sO(t,.8),r=sO(t,.72),i=[`jacket`,`blazer`,`cardigan`,`hoodieOpen`,`bomber`,`suitJacket`,`denimJacket`,`vestOuter`,`kimono`,`peacoat`].includes(e),a=`<path d="M124 192 Q108 210 116 258 Q120 310 136 346 Q180 360 224 346 Q240 310 244 258 Q252 210 236 192 Q208 172 180 170 Q152 172 124 192 Z" fill="${t}"/>`,o=i?`<path d="M180 172 L164 348 M180 172 L196 348" stroke="${r}" stroke-width="4" fill="none"/><path d="M180 172 L150 196 L164 348 M180 172 L210 196 L196 348" fill="${n}" opacity=".5"/>`:`<path d="M180 172 L180 348" stroke="${r}" stroke-width="2.5" fill="none"/>`,s=e===`hiVisVest`?`<rect x="150" y="238" width="60" height="14" fill="#fff" opacity=".75"/><rect x="150" y="262" width="60" height="14" fill="#fff" opacity=".75"/>`:e===`labCoat`?`<rect x="152" y="256" width="16" height="20" fill="#eef2f5"/>`:e===`apron`?`<path d="M158 200 L158 344 L202 344 L202 200 Q180 190 158 200 Z" fill="${n}"/>`:e===`cape`?`<path d="M126 190 Q112 300 130 360 L230 360 Q248 300 234 190 Q208 200 180 200 Q152 200 126 190 Z" fill="${n}" opacity=".9"/>`:``;return`<g data-role="wardrobeOuter">${e===`cape`?s:``}${a}${o}${e===`cape`?``:s}</g>`}function ck(e,t){let n=t,r=sO(n,.82),i=e===`skirtLong`||e===`dressBottom`||e===`palazzo`,a=i?470:400,o=i?26:14;return`<g data-role="wardrobeBottom"><path d="M150 330 Q180 322 210 330 L${210+o} ${a} Q180 ${a+14} ${150-o} ${a} Z" fill="${n}"/><path d="M150 330 Q180 322 210 330" fill="none" stroke="${r}" stroke-width="3"/></g>`}function lk(e,t=`#2a2f3a`){if(e===`barefoot`||!Ak[e])return``;let n=n=>{let r=e===`heels`?`<rect x="${n+12}" y="568" width="5" height="18" fill="${t}"/>`:``;return`${e===`boots`||e===`winterBoots`?`<rect x="${n-16}" y="530" width="32" height="34" rx="6" fill="${t}"/>`:``}<path d="M${n-20} 566Q${n-22} 556 ${n-12} 554L${n+18} 554Q${n+26} 556 ${n+26} 566Q${n+26} 574 ${n+14} 574L${n-18} 574Q${n-22} 572 ${n-20} 566Z" fill="${t}"/>${r}`};return`<g data-role="wardrobeFeet">${n(160)}${n(200)}</g>`}function uk(e,t=`#2a2018`){if(e===`none`||!Fk(e))return``;let n={stubble:`M145 131Q152 152 180 160Q208 152 215 131Q208 145 180 149Q152 145 145 131Z`,shortBeard:`M145 130Q150 160 180 170Q210 160 215 130Q208 152 180 156Q152 152 145 130Z`,fullBeard:`M143 126Q146 172 180 186Q214 172 217 126Q210 156 180 160Q150 156 143 126Z`,goatee:`M170 140Q180 168 190 140Q184 156 180 156Q176 156 170 140Z`,vanDyke:`M170 138Q180 164 190 138Q184 152 180 152ZM168 120Q180 126 192 120Q180 130 168 120Z`,mustache:`M164 122Q180 130 196 122Q188 118 180 120Q172 118 164 122Z`,handlebar:`M158 122Q180 132 202 122Q194 116 180 120Q166 116 158 122Q160 128 156 130Q162 126 158 122ZM202 122Q204 128 208 130Q202 126 202 122Z`,mutton:`M145 118Q142 150 158 164Q160 140 156 118ZM215 118Q218 150 202 164Q200 140 204 118Z`,soulPatch:`M176 138Q180 148 184 138Q180 144 176 138Z`,circleBeard:`M164 122Q180 130 196 122Q188 118 180 120Q172 118 164 122ZM170 138Q180 166 190 138Q184 154 180 154Q176 154 170 138Z`,chinStrap:`M146 118Q148 158 180 168Q212 158 214 118Q210 150 180 154Q150 150 146 118ZM160 130L200 130Q198 140 180 142Q162 140 160 130Z`,verstache:`M164 122Q180 130 196 122Q188 118 180 120Q172 118 164 122ZM176 138Q180 148 184 138Z`,longBeard:`M143 126Q146 190 180 210Q214 190 217 126Q210 156 180 160Q150 156 143 126Z`};return`<path data-role="wardrobeFacial" d="${n[e]||n.shortBeard}" fill="${t}"/>`}function dk(e){if(e===`none`||e===!1||!Lk(e))return``;let t=`#26313a`,n=e===`square`?e=>`<rect x="${e-13}" y="99" width="26" height="22" rx="4" fill="none" stroke="${t}" stroke-width="3"/>`:e===`catEye`?e=>`<path d="M${e-13} 116 Q${e-14} 100 ${e} 100 Q${e+14} 100 ${e+13} 116 Q${e} 122 ${e-13} 116 Z" fill="none" stroke="${t}" stroke-width="3"/>`:e===`sunglasses`?e=>`<circle cx="${e}" cy="110" r="13" fill="#26313a"/>`:n=>`<circle cx="${n}" cy="110" r="13" fill="${e===`rimless`?`rgba(180,200,220,.25)`:`none`}" stroke="${e===`rimless`?`none`:t}" stroke-width="3"/>`;return`<g data-role="wardrobeGlasses">${n(164)}${n(196)}<rect x="177" y="108" width="6" height="3" rx="1.5" fill="${t}"/></g>`}function fk(e,t=`#37455a`){if(e===`none`||!zk(e))return``;let n=sO(t,.8);return`<g data-role="wardrobeHat">${{cap:`<path d="M134 66 Q180 30 226 62 Q228 74 180 74 Q140 74 134 66 Z" fill="${t}"/><path d="M226 62 Q252 62 256 74 L226 76 Q224 68 226 62 Z" fill="${n}"/>`,beanie:`<path d="M132 72 Q132 34 180 32 Q228 34 228 72 Q180 82 132 72 Z" fill="${t}"/><rect x="130" y="66" width="100" height="12" rx="6" fill="${n}"/>`,fedora:`<ellipse cx="180" cy="72" rx="66" ry="12" fill="${n}"/><path d="M146 70 Q150 38 180 36 Q210 38 214 70 Z" fill="${t}"/><rect x="146" y="60" width="68" height="8" fill="${n}"/>`,topHat:`<ellipse cx="180" cy="66" rx="58" ry="10" fill="${n}"/><rect x="150" y="8" width="60" height="60" rx="4" fill="${t}"/><rect x="150" y="52" width="60" height="8" fill="${n}"/>`,hardHat:`<path d="M138 66 Q180 30 222 66 Q180 76 138 66 Z" fill="${t}"/><rect x="132" y="64" width="96" height="8" rx="4" fill="${t}"/><rect x="176" y="34" width="8" height="30" fill="${n}"/>`,crown:`<path d="M142 66 L146 40 L160 56 L180 34 L200 56 L214 40 L218 66 Z" fill="#f2b134"/><circle cx="180" cy="40" r="4" fill="#fff"/>`,helmet:`<path d="M130 76 Q130 32 180 30 Q230 32 230 76 Q180 86 130 76 Z" fill="${t}"/><rect x="176" y="30" width="8" height="46" fill="${n}"/>`,headband:`<rect x="132" y="60" width="96" height="12" rx="6" fill="${t}"/>`,cowboyHat:`<path d="M118 72 Q180 60 242 72 Q180 88 118 72 Z" fill="${t}"/><path d="M150 68 Q154 38 180 36 Q206 38 210 68 Z" fill="${t}"/><rect x="150" y="60" width="60" height="7" fill="${n}"/>`,wizardHat:`<path d="M180 4 L214 70 L146 70 Z" fill="${t}"/><ellipse cx="180" cy="70" rx="44" ry="8" fill="${n}"/><circle cx="180" cy="26" r="4" fill="#ffd54a"/>`,beret:`<ellipse cx="180" cy="52" rx="42" ry="22" fill="${t}"/><circle cx="200" cy="40" r="4" fill="${n}"/>`,visor:`<rect x="134" y="62" width="92" height="10" rx="5" fill="${t}"/><path d="M226 66 Q250 66 254 76 L226 78 Z" fill="${n}"/>`,bandana:`<path d="M132 66 Q180 52 228 66 Q228 74 180 78 Q140 74 132 66 Z" fill="${t}"/><path d="M226 68 L246 84 L232 86 L222 72 Z" fill="${n}"/>`,partyHat:`<path d="M180 8 L200 66 L160 66 Z" fill="${t}"/><circle cx="180" cy="12" r="5" fill="#ff6b5e"/>`,santaHat:`<path d="M134 68 Q140 30 202 34 Q214 40 210 66 Z" fill="#c0392b"/><rect x="126" y="64" width="92" height="12" rx="6" fill="#fff"/><circle cx="210" cy="38" r="8" fill="#fff"/>`}[e]||``}</g>`}function pk(e={}){let t=``;return e.freckles&&(t+=`<g fill="#b5794f" opacity=".5">${[[152,116],[158,120],[148,122],[202,116],[208,120],[212,122]].map(([e,t])=>`<circle cx="${e}" cy="${t}" r="1.6"/>`).join(``)}</g>`),e.blush&&(t+=`<ellipse cx="150" cy="120" rx="10" ry="6" fill="#ff8a8a" opacity=".3"/><ellipse cx="210" cy="120" rx="10" ry="6" fill="#ff8a8a" opacity=".3"/>`),e.earrings&&(t+=`<circle cx="134" cy="122" r="3" fill="#f2b134"/><circle cx="226" cy="122" r="3" fill="#f2b134"/>`),e.wrinkles&&(t+=`<g stroke="#c9a882" stroke-width="1.2" fill="none" opacity=".5"><path d="M150 90 Q164 88 176 90"/><path d="M186 90 Q198 88 210 90"/><path d="M156 128 Q164 132 172 128"/><path d="M188 128 Q196 132 204 128"/></g>`),t?`<g data-role="wardrobeFaceExtras">${t}</g>`:``}var mk,hk,gk,_k,vk,yk,bk,xk,Sk,Ck,wk,Tk,Ek,Dk,Ok,kk,Ak,jk,Mk,Nk,Pk,Fk,Ik,Lk,Rk,zk,Bk,Vk,Hk,Uk,Wk,Gk,Kk,qk=o((()=>{pO(),mk={armU:20,armL:17,legU:26,legL:22},hk=(e,t=`hair`,n=``)=>`<path class="${t}" d="${e}"${n}/>`,gk=(e,t,n,r=`hair`)=>`<circle class="${r}" cx="${e}" cy="${t}" r="${n}"/>`,_k={},vk=(e,t,n)=>t.forEach((t,r)=>{_k[t]={cat:e,fn:n(r)}}),vk(`short`,[`crop`,`buzz`,`caesar`,`ivyLeague`,`crewCut`,`taper`,`flatTop`,`hightop`,`shortAfro`,`pixie`,`frenchCrop`,`butch`,`burr`,`induction`,`shortBrush`,`lowFade`,`midFade`,`highFade`,`blowout`,`edgar`],e=>e===8?e=>ZO({r:20,rows:1}):e===6||e===7?e=>JO({up:8}):t=>qO({h:28+e%5*2,wob:e%3-1})),vk(`medium`,[`quiff`,`pompadour`,`sidePart`,`comboOver`,`sweptBack`,`curtains`,`waves`,`shag`,`bob`,`lob`,`fauxHawkMed`,`texturedCrop`,`messyMed`,`flowMed`,`middlePart`,`slickBack`,`wolfCut`,`mullet`,`featheredMed`,`layeredMed`],e=>e<=1?t=>JO({up:18+e*6}):e===8||e===9?e=>XO({len:160}):e<=4?t=>YO({s:e%2?1:-1}):e=>qO({h:38,b:6,wob:2})),vk(`long`,[`straightLong`,`ponytail`,`highPonytail`,`braid`,`doubleBraid`,`bun`,`topKnot`,`spaceBuns`,`longAfro`,`dreads`,`longLayers`,`sidePonytail`,`lowBun`,`halfUp`,`mermaid`,`hime`,`longWavy`,`longStraight`,`longCurly`,`longShag`],e=>e===1||e===2||e===11?t=>nk({len:175,side:e===11?1:.1}):e===5||e===6||e===12?e=>tk({}):e===8?e=>ZO({r:27,rows:2}):t=>XO({len:200+e%3*10})),vk(`textured`,[`curly`,`tightCurls`,`afro`,`afroTaper`,`coils`,`ringlets`,`wavyLong`,`kinky`,`twistOut`,`curlyFade`,`curlyBob`,`curlyShag`,`looseCurls`,`spiralCurls`,`bantuKnots`],e=>e===2||e===3?e=>ZO({r:27,rows:2}):e===4||e===8?e=>QO({n:10}):e=>ZO({r:22,rows:1})),vk(`styled`,[`mohawk`,`fauxHawk`,`undercut`,`manBun`,`cornrows`,`locs`,`spiky`,`emoFringe`,`bunched`,`hatHairShort`,`liberty`,`devilock`,`quiffPunk`,`razorPart`,`flattopHi`],e=>e===0||e===10||e===11||e===12?e=>ek():e===3?e=>tk({r:14}):e===4?e=>ak({n:6}):e===6||e===13||e===14?e=>$O({n:7}):e=>qO({h:30})),vk(`aged`,[`greySwept`,`greyBun`,`balding`,`saltPepper`,`wispy`,`recedingGrey`,`baldFringe`,`thinTop`,`combover`,`silverLong`],e=>e===1?e=>tk({}):e===2||e===7?e=>ik():e===6?e=>rk({fringe:!0}):e===9?e=>XO({len:180}):e=>YO({s:1})),_k.bald={cat:`aged`,fn:e=>rk({})},_k.widowsPeak={cat:`styled`,fn:e=>hk(`M136 104Q138 70 165 68L180 84L195 68Q222 70 224 104Q206 84 180 82Q154 84 136 104Z`)},_k.receding={cat:`aged`,fn:e=>ik()},yk=Object.keys(_k),bk=e=>Object.prototype.hasOwnProperty.call(_k,e),xk={tee:``,tank:e=>`<path d="M156 196L156 250M204 196L204 250" stroke="${sO(e,.8)}" stroke-width="3" fill="none" opacity=".5"/>`,poloShirt:e=>`<path d="M168 176L180 190L192 176" fill="none" stroke="${sO(e,.78)}" stroke-width="4"/><circle cx="180" cy="210" r="2.4" fill="${sO(e,.7)}"/><circle cx="180" cy="226" r="2.4" fill="${sO(e,.7)}"/>`,buttonUp:e=>`<path d="M180 176L180 340" stroke="${sO(e,.72)}" stroke-width="2.5"/>${[196,220,252,284,316].map(t=>`<circle cx="180" cy="${t}" r="2.2" fill="${sO(e,.6)}"/>`).join(``)}`,hoodie:e=>`<path d="M150 182Q180 168 210 182Q206 200 180 206Q154 200 150 182Z" fill="${sO(e,.82)}"/><path d="M172 206L172 250M188 206L188 250" stroke="${sO(e,.7)}" stroke-width="3"/><rect x="150" y="300" width="60" height="26" rx="8" fill="${sO(e,.86)}"/>`,jersey:e=>`<text x="180" y="270" text-anchor="middle" font-size="34" font-weight="900" fill="${sO(e,.6)}">${`0`+(1+e.length%9)}</text>`,turtleneck:e=>`<rect x="164" y="158" width="32" height="22" rx="8" fill="${e}"/>`,vest:e=>`<path d="M150 196L150 330M210 196L210 330" stroke="${sO(e,.7)}" stroke-width="4" fill="none"/>`,henley:e=>`<path d="M180 178L180 220" stroke="${sO(e,.72)}" stroke-width="2.5"/><circle cx="180" cy="196" r="2" fill="${sO(e,.6)}"/><circle cx="180" cy="212" r="2" fill="${sO(e,.6)}"/>`},Sk=[`tee`,`tank`,`poloShirt`,`buttonUp`,`blouse`,`sweater`,`turtleneck`,`hoodie`,`jersey`,`croptop`,`vest`,`dressTop`,`tunic`,`henley`,`flannel`,`stripedTee`,`graphicTee`,`longSleeveTee`,`raglan`,`workShirt`,`scrubTop`,`thermal`,`poncho`,`halterTop`,`wrapTop`],Ck={},Sk.forEach(e=>{let t=[`sweater`,`turtleneck`,`hoodie`,`longSleeveTee`,`workShirt`,`thermal`,`flannel`,`blouse`,`scrubTop`].includes(e);Ck[e]={id:e,slot:`top`,kind:`paint`,covers:[`arm`],longSleeve:t,capRx:10,detail:xk[e]||``,fit:{limbWidenX:t?1.12:1}}}),wk={short:{id:`short`,slot:`sleeves`,kind:`paint`,covers:[`arm`],longSleeve:!1,capRx:10},long:{id:`long`,slot:`sleeves`,kind:`paint`,covers:[`arm`],longSleeve:!0,capRx:8.5,fit:{limbWidenX:1.1}},rolled:{id:`rolled`,slot:`sleeves`,kind:`paint`,covers:[`arm`],longSleeve:!1,capRx:10},threeQuarter:{id:`threeQuarter`,slot:`sleeves`,kind:`paint`,covers:[`arm`],longSleeve:!0,capRx:8.5,fit:{limbWidenX:1.06}},sleeveless:{id:`sleeveless`,slot:`sleeves`,kind:`paint`,covers:[],capRx:10}},Tk=[`jacket`,`blazer`,`coat`,`trenchcoat`,`hoodieOpen`,`cardigan`,`puffer`,`bomber`,`apron`,`labCoat`,`hiVisVest`,`robe`,`cape`,`suitJacket`,`denimJacket`,`raincoat`,`parka`,`peacoat`,`windbreaker`,`fleece`,`vestOuter`,`poncho2`,`kimono`,`overalls`,`wetsuitTop`],Ek={},Tk.forEach(e=>{let t=[`coat`,`trenchcoat`,`puffer`,`parka`,`peacoat`,`robe`,`labCoat`,`raincoat`,`fleece`].includes(e),n=e===`puffer`||e===`parka`?1.5:t?1.34:1.18;Ek[e]={id:e,slot:`outerwear`,kind:`overlay`,covers:[`arm`],longSleeve:!0,capRx:12,fit:{limbWidenX:n,torsoScale:t?1.08:1.03,cover:{armU:mk.armU*n+2,armL:mk.armL*n+2}}}}),Dk=[`shorts`,`jeans`,`trousers`,`slacks`,`joggers`,`cargos`,`skirtShort`,`skirtLong`,`leggings`,`dressBottom`,`kilt`,`shortsAthletic`,`snowPants`,`chinos`,`sweatpants`,`capris`,`overallsBottom`,`palazzo`,`culottes`,`bikeShorts`],Ok={},Dk.forEach(e=>{let t=![`shorts`,`skirtShort`,`shortsAthletic`,`bikeShorts`,`capris`].includes(e),n=e===`snowPants`;Ok[e]={id:e,slot:`bottom`,kind:`paint`,covers:[`leg`],longLeg:t,capRx:11,skirt:e.startsWith(`skirt`)||e===`kilt`||e===`dressBottom`||e===`palazzo`,fit:{limbWidenLeg:n?1.4:t?1.06:1}}}),kk=[`sneakers`,`dressShoes`,`boots`,`heels`,`sandals`,`cleats`,`winterBoots`,`barefoot`,`loafers`,`hightops`],Ak={},kk.forEach(e=>Ak[e]={id:e,slot:`footwear`,kind:`overlay`}),jk=[`oval`,`round`,`square`,`heart`,`long`,`diamond`,`wide`,`narrow`,`soft`,`angular`,`chubby`,`gaunt`],Mk={oval:[1,1],round:[1.06,.96],square:[1.04,1],heart:[1.03,1],long:[.94,1.08],diamond:[.98,1.04],wide:[1.12,.96],narrow:[.9,1.02],soft:[1.05,1],angular:[.98,1.02],chubby:[1.1,.98],gaunt:[.9,1.05]},Nk=e=>jk.includes(e),Pk=[`none`,`stubble`,`shortBeard`,`fullBeard`,`goatee`,`vanDyke`,`mustache`,`handlebar`,`mutton`,`soulPatch`,`circleBeard`,`chinStrap`,`verstache`,`longBeard`],Fk=e=>Pk.includes(e),Ik=[`none`,`round`,`square`,`rimless`,`sunglasses`,`catEye`,`aviator`],Lk=e=>Ik.includes(e),Rk=[`none`,`cap`,`beanie`,`fedora`,`topHat`,`hardHat`,`crown`,`helmet`,`headband`,`cowboyHat`,`wizardHat`,`beret`,`visor`,`bandana`,`partyHat`,`santaHat`],zk=e=>Rk.includes(e),Bk=[`round`,`almond`,`narrow`,`wide`],Vk={round:[6.5,9],almond:[7,6],narrow:[7,4.5],wide:[8,9.5]},Hk=[`flat`,`arched`,`angled`],Uk={flat:0,arched:-4,angled:3},Wk={casual:{top:`tee`,sleeves:`short`,bottom:`jeans`,footwear:`sneakers`,outerwear:`none`},business:{top:`buttonUp`,sleeves:`long`,outerwear:`blazer`,bottom:`slacks`,footwear:`dressShoes`},uniformMilitary:{top:`workShirt`,sleeves:`long`,outerwear:`jacket`,bottom:`cargos`,footwear:`boots`},uniformPolice:{top:`buttonUp`,sleeves:`long`,outerwear:`vestOuter`,bottom:`trousers`,footwear:`boots`},doctor:{top:`scrubTop`,sleeves:`short`,outerwear:`labCoat`,bottom:`trousers`,footwear:`sneakers`},worker:{top:`workShirt`,sleeves:`long`,outerwear:`hiVisVest`,bottom:`cargos`,footwear:`boots`},chef:{top:`buttonUp`,sleeves:`long`,outerwear:`apron`,bottom:`trousers`,footwear:`sneakers`},athlete:{top:`jersey`,sleeves:`sleeveless`,bottom:`shortsAthletic`,footwear:`cleats`,outerwear:`none`},royal:{top:`dressTop`,sleeves:`long`,outerwear:`cape`,bottom:`dressBottom`,footwear:`dressShoes`},winter:{top:`sweater`,sleeves:`long`,outerwear:`puffer`,bottom:`snowPants`,footwear:`winterBoots`},ancient:{top:`tunic`,sleeves:`long`,outerwear:`robe`,bottom:`trousers`,footwear:`sandals`},spacesuit:{top:`thermal`,sleeves:`long`,outerwear:`parka`,bottom:`snowPants`,footwear:`boots`}},Gk=Object.keys(Wk),Kk={hair:yk,top:Object.keys(Ck),sleeves:Object.keys(wk),outerwear:[`none`,...Tk],bottom:Object.keys(Ok),footwear:kk,faceShape:jk,facialHair:Pk,glasses:Ik}}));function Jk(e,t){return typeof e==`string`&&e[0]===`@`?(oA[t]||oA.auto)[e.slice(1)]||oA.auto[e.slice(1)]||`#888888`:e}function Yk(e,t){let n={...e};return[`skin`,`hairColor`,`shirt`,`shorts`,`legs`].forEach(e=>{n[e]!=null&&(n[e]=Jk(n[e],t))}),n}function Xk(e={}){return{...sA,...e}}function Zk(e,t,n){e.querySelectorAll(`.`+t).forEach(e=>e.setAttribute(`fill`,n))}function Qk(e,t){let n=Xk(t),r=n.shorts||n.shirt,i=n.legs||n.shirt;e.querySelectorAll(`.hairStyle`).forEach(e=>e.setAttribute(`opacity`,e.dataset.style===n.hairStyle?`1`:`0`)),Zk(e,`hair`,n.hairColor),Zk(e,`hairSh`,sO(n.hairColor,.78)),Zk(e,`shirt`,n.shirt),Zk(e,`shirtSh`,sO(n.shirt,.78)),Zk(e,`shorts`,r),Zk(e,`shortsSh`,sO(r,.78)),Zk(e,`leg`,i),Zk(e,`legSh`,sO(i,.78)),Zk(e,`skin`,n.skin),Zk(e,`skinSh`,sO(n.skin,.88));let a=e.querySelector(`[data-role="glasses"]`);a&&a.setAttribute(`opacity`,n.glasses?`1`:`0`);let o=e.querySelector(`[data-role="beard"]`);o&&(o.setAttribute(`opacity`,n.beard?`1`:`0`),n.beard&&o.setAttribute(`fill`,sO(n.hairColor,.85)));let s=e.querySelector(`[data-role="collar"]`);if(s&&s.setAttribute(`opacity`,n.collar||n.build===`dave`?`1`:`0`),e.querySelector(`[data-role="hairProfShort"]`)){let t=[`bob`,`long`,`ponytail`,`curly`,`afro`].includes(n.hairStyle),r=e.querySelector(`[data-role="hairProfLong"]`);r&&r.setAttribute(`opacity`,t?`1`:`0`);let i=e.querySelector(`[data-role="hairPony"]`);i&&i.setAttribute(`opacity`,n.hairStyle===`ponytail`?`1`:`0`)}n.appearance&&nA(e,n)}function $k(e,t,n){let r=e.querySelector(`[data-role="${t}"]`);return r||(r=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),r.setAttribute(`data-role`,t),(e.querySelector(n)||e).appendChild(r)),r}function eA(e,t,n=`char`,r=`head`){let i=e.querySelector(`[data-role="${t}"]`);if(!i){i=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),i.setAttribute(`data-role`,t);let a=e.querySelector(`[data-role="${n}"]`),o=e.querySelector(`[data-role="${r}"]`);a&&o?a.insertBefore(i,o):a&&a.appendChild(i)}return i}function tA(e,t,n){[`armL`,`armR`].forEach(n=>{let r=e.querySelector(`[data-role="${n}"] > rect`);r&&r.setAttribute(`fill`,t)}),n&&[`armLf`,`armRf`].forEach(n=>{let r=e.querySelector(`[data-role="${n}"] > rect`);r&&r.setAttribute(`fill`,t)})}function nA(e,t){let n=t.appearance,r=t.hairColor;if(n.hair&&bk(n.hair)&&(e.querySelectorAll(`.hairStyle`).forEach(e=>e.setAttribute(`opacity`,`0`)),e.querySelector(`[data-role="hairRoot"]`))){let t=$k(e,`wardrobeHair`,`[data-role="hairRoot"]`);t.innerHTML=ok(n.hair,r),Zk(t,`hair`,r),Zk(t,`hairSh`,sO(r,.78))}if(n.faceShape&&Nk(n.faceShape)){let[t,r]=Mk[n.faceShape],i=e.querySelector(`[data-role="face"]`);i&&i.setAttribute(`transform`,`translate(180 104) scale(${t} ${r}) translate(-180 -104)`)}if(n.top&&Ck[n.top]){let r=n.topColor||t.shirt;Zk(e,`shirt`,r),Zk(e,`shirtSh`,sO(r,.78));let i=Ck[n.top].detail,a=$k(e,`wardrobeTop`,`[data-role="torsoWrap"]`);a.innerHTML=typeof i==`function`?i(r):i||``}if(n.sleeves&&wk[n.sleeves]&&wk[n.sleeves].longSleeve&&tA(e,n.topColor||t.shirt,!0),n.outerwear&&n.outerwear!==`none`&&Ek[n.outerwear]){let r=n.outerColor||sO(t.shirt,.7);tA(e,r,!0);let i=eA(e,`wardrobeOuterRoot`);i.innerHTML=sk(n.outerwear,r)}else{let t=e.querySelector(`[data-role="wardrobeOuterRoot"]`);t&&(t.innerHTML=``)}if(n.bottom&&Ok[n.bottom]){let r=n.bottomColor||t.shorts||t.shirt;Zk(e,`shorts`,r),Zk(e,`shortsSh`,sO(r,.78)),Ok[n.bottom].longLeg&&(Zk(e,`leg`,r),Zk(e,`legSh`,sO(r,.78)));let i=eA(e,`wardrobeBottomRoot`);i.innerHTML=Ok[n.bottom].skirt?ck(n.bottom,r):``}{let t=$k(e,`wardrobeFeetRoot`,`[data-role="char"]`);t.innerHTML=n.footwear?lk(n.footwear,n.footColor||`#2a2f3a`):``}if(n.facialHair&&Fk(n.facialHair)){let t=e.querySelector(`[data-role="beard"]`);t&&t.setAttribute(`opacity`,(n.facialHair,`0`));let i=eA(e,`wardrobeFacialRoot`,`faceFeatures`,`mouth`);i.innerHTML=uk(n.facialHair,sO(r,.85))}if(n.glasses&&Lk(n.glasses)){let t=e.querySelector(`[data-role="glasses"]`);t&&t.setAttribute(`opacity`,`0`);let r=$k(e,`wardrobeGlassesRoot`,`[data-role="faceFeatures"]`);r.innerHTML=dk(n.glasses)}{let t=$k(e,`wardrobeHatRoot`,`[data-role="head"]`);t.innerHTML=n.headwear&&zk(n.headwear)?fk(n.headwear,n.headwearColor||`#37455a`):``}{let t=eA(e,`wardrobeExtrasRoot`,`faceFeatures`,`mouth`);t.innerHTML=pk(n)}if(n.eyeShape||n.irisColor||n.eyeSpacing!=null||n.lashes){let[t,r]=Vk[n.eyeShape]||Vk.round,i=(n.eyeSpacing||0)*6;[[`eyeL`,164-i],[`eyeR`,196+i]].forEach(([i,a])=>{let o=e.querySelector(`[data-role="${i}"]`);o&&(o.setAttribute(`rx`,t),o.setAttribute(`ry`,r),o.setAttribute(`cx`,a),n.irisColor&&o.setAttribute(`fill`,n.irisColor))});let a=$k(e,`wardrobeLashRoot`,`[data-role="faceFeatures"]`);a.innerHTML=n.lashes?`<path d="M${158-i} ${104-r} Q${164-i} ${101-r} ${170-i} ${104-r}" stroke="#243038" stroke-width="1.4" fill="none"/><path d="M${190+i} ${104-r} Q${196+i} ${101-r} ${202+i} ${104-r}" stroke="#243038" stroke-width="1.4" fill="none"/>`:``}if(n.browShape||n.browThickness||n.browColor){let t=Uk[n.browShape]||0;[[`browL`,153,174],[`browR`,186,207]].forEach(([r,i,a])=>{let o=e.querySelector(`[data-role="${r}"]`);o&&(n.browThickness&&o.setAttribute(`stroke-width`,n.browThickness),n.browColor&&o.setAttribute(`stroke`,n.browColor),o.setAttribute(`d`,`M${i} 94 Q${(i+a)/2} ${89+t} ${a} 94`))})}}function rA(e,t,n={}){let r=Xk(e),i=aA[r.ageHint]||aA.adult,a=iA.includes(r.ageHint)?CO[r.ageHint]:null,o=a||CO[r.build]||CO.default,s=GO(r.appearance||{}),c={...o,armX:o.armX*s.limbWidenX,legX:o.legX*s.limbWidenLeg,torsoX:o.torsoX*s.torsoScale},l=a?1:i.headScale,u=a?o.scale||1:i.heightScale;return{profile:SO[r.body]||SO.regular,build:c,hairVol:r.hairVol,eyeMul:r.eye,browTilt:n.browTilt||0,headScale:l,heightScale:(r.heightScale||1)*u*(n.depthScale||1),limbScale:n.limbScale||1,rigX:t,facing:n.facing||`front`,squash:n.squash==null?1:n.squash,yShift:n.yShift||0,opacity:n.opacity==null?1:n.opacity}}var iA,aA,oA,sA,cA=o((()=>{pO(),jO(),qk(),iA=[`childYoung`,`child`,`teen`],aA={child:{heightScale:.72,headScale:1.14},adult:{heightScale:1,headScale:1},elder:{heightScale:.95,headScale:1.02}},Object.keys(aA),oA={auto:{primary:`#2BB3A3`,accent:`#FF6B5E`,warm:`#F2B134`,cool:`#5B6CE0`,ink:`#2E3440`,pale:`#F2C9A0`},sunset:{primary:`#E07A5F`,accent:`#F2CC8F`,warm:`#F4A261`,cool:`#81B29A`,ink:`#3D405B`,pale:`#F4EBDD`},ocean:{primary:`#2b6cb0`,accent:`#38b2ac`,warm:`#ecc94b`,cool:`#4299e1`,ink:`#1a365d`,pale:`#bee3f8`}},sA={skin:`#F2C9A0`,hairStyle:`bob`,hairColor:`#59352B`,hairVol:1,shirt:`#2BB3A3`,shorts:null,legs:null,body:`regular`,build:`default`,eye:1,glasses:!1,beard:!1,collar:!1,heightScale:1}}));function lA(e,t,n=fA){let r=pA[e]||pA.central;return{x:r.x*t,y:r.y*n,tint:r.tint}}function uA(e=7){return[{d:0,draw:(e,t,n)=>{let r=e.createLinearGradient(0,0,0,n);r.addColorStop(0,`#123a52`),r.addColorStop(1,`#0c2536`),e.fillStyle=r,e.fillRect(-500,-500,t+1e3,n+1e3)}},{d:0,draw:(e,t,n)=>{e.strokeStyle=`rgba(255,255,255,.05)`,e.lineWidth=1;for(let r=0;r<=t;r+=t/12)e.beginPath(),e.moveTo(r,0),e.lineTo(r,n),e.stroke();for(let r=0;r<=n;r+=n/8)e.beginPath(),e.moveTo(0,r),e.lineTo(t,r),e.stroke()}},{d:0,draw:(t,n,r)=>{let i=oO(`map`+e);mA.forEach(e=>{let a=pA[e],o=a.x*n,s=a.y*r,c=a.r*n;t.save(),t.fillStyle=a.tint,t.globalAlpha=.94,t.beginPath();for(let e=0;e<=Math.PI*2+.01;e+=Math.PI/7){let n=c*(.8+i()*.4),r=o+Math.cos(e)*n,a=s+Math.sin(e)*n*.82;e===0?t.moveTo(r,a):t.lineTo(r,a)}t.closePath(),t.fill(),t.strokeStyle=`rgba(0,0,0,.12)`,t.lineWidth=2,t.stroke(),t.restore()})}}]}function dA(e=7){return[{d:.1,draw:(e,t,n)=>{e.fillStyle=`#1b2230`,e.fillRect(-500,-500,t+1e3,n+1e3)}},{d:.18,draw:(e,t,n)=>{let r=e.createRadialGradient(t/2,n*.28,20,t/2,n*.28,n*.85);r.addColorStop(0,`rgba(150,180,220,.20)`),r.addColorStop(1,`rgba(150,180,220,0)`),e.fillStyle=r,e.fillRect(0,0,t,n)}},{d:.4,draw:(t,n,r,i,a)=>{t.save(),t.fillStyle=`#2a3446`,t.beginPath(),t.moveTo(n*.26,i-30*a),t.lineTo(n*.74,i-30*a),t.lineTo(n*.92,i+130*a),t.lineTo(n*.08,i+130*a),t.closePath(),t.fill(),t.fillStyle=`#39496a`,t.beginPath(),t.moveTo(n*.3,i-22*a),t.lineTo(n*.7,i-22*a),t.lineTo(n*.84,i+96*a),t.lineTo(n*.16,i+96*a),t.closePath(),t.fill();let o=oO(`wr`+e);t.fillStyle=`#c9a36a`;for(let e=0;e<5;e++)t.beginPath(),t.arc(n*(.36+o()*.28),i+(6+o()*56)*a,6*a,0,7),t.fill();t.strokeStyle=`rgba(230,200,140,.5)`,t.lineWidth=2*a,t.beginPath(),t.moveTo(n*.4,i+20*a),t.lineTo(n*.6,i+60*a),t.stroke(),t.restore()}}]}var fA,pA,mA,hA=o((()=>{pO(),fA=640,pA={north:{x:.3,y:.3,r:.14,tint:`#8fae7a`},south:{x:.42,y:.68,r:.12,tint:`#c9a36a`},east:{x:.68,y:.4,r:.15,tint:`#7a9bb5`},west:{x:.15,y:.52,r:.11,tint:`#b58a7a`},central:{x:.5,y:.47,r:.11,tint:`#a7b98c`},isles:{x:.82,y:.66,r:.07,tint:`#8aa6b5`}},mA=Object.keys(pA)}));function gA(e){let t=e===`grid`?4:e===`hero`||e===`islands`?3:e===`pin`||e===`steps`||e===`orbit`?5:3,n=[{key:`bg`,default:!0},{key:`accent`,default:!0}];for(let e=0;e<t;e++)n.push({key:`panel`+e,default:!0});n.push({key:`fgBlob`,default:!0}),e===`pin`&&n.push({key:`strings`,default:!0},{key:`boardTexture`,default:!0}),e===`steps`&&n.push({key:`path`,default:!0}),e===`orbit`&&n.push({key:`orbitLines`,default:!0}),n.push({key:`focusRing`,default:!1},{key:`hud`,default:!1});let r=e===`steps`?[4200,1600]:e===`grid`?[2600,1900]:e===`orbit`?[2600,2e3]:e===`islands`?[3200,1900]:e===`hero`?[3e3,1700]:[800+t*760,1500];return{world:r,view:[1920,1080],kind:e,manifest:n,build(n,i){let[a,o]=r,s=oO(`board`+e+n),c=_A(e,t,a,o,s),l=[],u=[],d=[],f=`pmbg_`+e,p=`<defs><linearGradient id="${f}" x1="0" x2="1" y1="0" y2="1"><stop offset="0" stop-color="${AA[e][0]}"/><stop offset="1" stop-color="${AA[e][1]}"/></linearGradient></defs>`;i(`bg`)?l.push(p+`<rect x="${-a}" y="${-o}" width="${3*a}" height="${3*o}" fill="url(#${f})"/>`):l.push(p),i(`accent`)&&l.push(`<circle cx="${(a*.2).toFixed(0)}" cy="${(o*.26).toFixed(0)}" r="${(o*.22).toFixed(0)}" fill="${AA[e][2]}" opacity=".5"/><circle cx="${(a*.82).toFixed(0)}" cy="${(o*.3).toFixed(0)}" r="${(o*.28).toFixed(0)}" fill="${AA[e][3]}" opacity=".45"/>`),e===`pin`&&i(`boardTexture`)&&l.push(xA(a,o)),e===`steps`&&i(`path`)&&u.push(vA(c)),e===`orbit`&&i(`orbitLines`)&&u.push(yA(c)),e===`pin`&&i(`strings`)&&u.push(bA(c));let m=[],h=[];return c.forEach((t,n)=>{if(!i(`panel`+n))return;let r=t.depth===.24?l:t.depth===1.28?d:u,a=e===`pin`?s()*6-3:0,o=OA(0,0,t.w,t.h)+DA(0,0,t.w,t.h,t.fill||`#fff`,t.op||.95)+(e===`pin`?`<circle cx="0" cy="${(-t.h/2+26).toFixed(0)}" r="12" fill="#c0392b"/>`:``);r.push(`<g transform="translate(${t.x.toFixed(0)} ${t.y.toFixed(0)}) rotate(${a.toFixed(1)})">${o}</g>`),m.push({id:`panel`+n,x:t.x,y:t.y,w:t.w,h:t.h,depth:t.depth}),h.push({id:`panel`+n,x:t.x,y:t.y,importance:t.importance||1})}),i(`fgBlob`)&&d.push(`<circle cx="${(a*.1).toFixed(0)}" cy="${(o*.88).toFixed(0)}" r="${(o*.12).toFixed(0)}" fill="#25155b" opacity=".3"/><circle cx="${(a*.94).toFixed(0)}" cy="${(o*.84).toFixed(0)}" r="${(o*.15).toFixed(0)}" fill="#25155b" opacity=".26"/>`),{planes:[{depth:.24,id:`bg`,svg:l.join(``)},{depth:1,id:`mid`,svg:u.join(``)},{depth:1.28,id:`fg`,svg:d.join(``)}],panels:m,subjects:h}}}}function _A(e,t,n,r,i){let a=n/2,o=r/2,s=[];if(e===`row`){let e=n/(t+.4),r=e*.72;for(let n=0;n<t;n++)s.push({x:e*(.7+n),y:o+(n%2?70:-70),w:r,h:560,depth:1})}else if(e===`grid`){let e=[n*.3,n*.7],t=[r*.32,r*.7];for(let n=0;n<4;n++)s.push({x:e[n%2],y:t[n<2?0:1],w:720,h:520,depth:1})}else if(e===`hero`)s.push({x:n*.36,y:o,w:1120,h:900,depth:1,importance:1.15}),s.push({x:n*.78,y:r*.34,w:560,h:440,depth:1}),s.push({x:n*.78,y:r*.7,w:560,h:440,depth:1});else if(e===`islands`)s.push({x:n*.22,y:r*.3,w:560,h:440,depth:.24,importance:.9}),s.push({x:n*.52,y:r*.56,w:760,h:580,depth:1,importance:1.1}),s.push({x:n*.82,y:r*.4,w:620,h:480,depth:1.28});else if(e===`pin`)for(let e=0;e<t;e++){let c=e/t*6.28;s.push({x:a+Math.cos(c)*n*.28+(i()-.5)*120,y:o+Math.sin(c)*r*.26+(i()-.5)*100,w:480,h:380,depth:1,fill:[`#fffaf0`,`#fef3e2`,`#eef7ff`][e%3]})}else if(e===`steps`)for(let e=0;e<t;e++){let i=e/(t-1);s.push({x:n*(.1+i*.8),y:o+Math.sin(i*Math.PI*1.6)*r*.26,w:560,h:460,depth:1})}else if(e===`orbit`){s.push({x:a,y:o,w:720,h:620,depth:1,importance:1.15,fill:`#fff`});for(let e=0;e<t-1;e++){let i=e/(t-1)*6.28-1.57;s.push({x:a+Math.cos(i)*n*.3,y:o+Math.sin(i)*r*.32,w:420,h:340,depth:1})}}return s}function vA(e){return e.length<2?``:`<path d="${e.map((e,t)=>(t?`L`:`M`)+e.x.toFixed(0)+` `+e.y.toFixed(0)).join(` `)}" fill="none" stroke="#8a7a5a" stroke-width="10" stroke-dasharray="4 26" stroke-linecap="round" opacity=".7"/>`}function yA(e){if(!e.length)return``;let t=e[0];return e.slice(1).map(e=>`<line x1="${t.x.toFixed(0)}" y1="${t.y.toFixed(0)}" x2="${e.x.toFixed(0)}" y2="${e.y.toFixed(0)}" stroke="#5b6ce0" stroke-width="5" stroke-dasharray="2 14" opacity=".55"/>`).join(``)}function bA(e){let t=``;for(let n=1;n<e.length;n++)t+=`<line x1="${e[n-1].x.toFixed(0)}" y1="${e[n-1].y.toFixed(0)}" x2="${e[n].x.toFixed(0)}" y2="${e[n].y.toFixed(0)}" stroke="#b04a3a" stroke-width="4" opacity=".6"/>`;return t}function xA(e,t){return`<rect x="0" y="0" width="${e}" height="${t}" fill="#c8a97a" opacity=".5"/>`}function SA(e,t={}){let n=kA[e];if(!n)throw Error(`unknown board "${e}"`);let r={};n.manifest.forEach(e=>r[e.key]=e.default);for(let n of Object.keys(t))if(!(n in r))throw Error(`unknown element "${n}" for board "${e}" (has: ${Object.keys(r).join(`, `)})`);return{...r,...t}}function CA(e){let t=kA[e];return t?t.manifest:[]}function wA(e,t=0,n={}){let r=kA[e];if(!r)throw Error(`unknown board "${e}"`);let i=SA(e,n),a=e=>i[e]!==!1,o=r.build(t,a);return{worldW:r.world[0],worldH:r.world[1],viewW:r.view[0],viewH:r.view[1],focusRing:a(`focusRing`),hud:a(`hud`),elements:i,...o}}function TA(e,t,n=0){let r=175+Math.sin(n*4)*12;return`<circle cx="${e.toFixed(1)}" cy="${t.toFixed(1)}" r="155" fill="none" stroke="#fff" stroke-width="18" opacity=".78"/><circle cx="${e.toFixed(1)}" cy="${t.toFixed(1)}" r="${r.toFixed(1)}" fill="none" stroke="#f5c43e" stroke-width="6" opacity=".8"/>`}var EA,DA,OA,kA,AA,jA,MA,NA=o((()=>{pO(),EA=44,DA=(e,t,n,r,i=`#fff`,a=.92)=>`<rect x="${(e-n/2).toFixed(0)}" y="${(t-r/2).toFixed(0)}" width="${n.toFixed(0)}" height="${r.toFixed(0)}" rx="${EA}" fill="${i}" opacity="${a}"/>`,OA=(e,t,n,r)=>`<ellipse cx="${e.toFixed(0)}" cy="${(t+r/2+8).toFixed(0)}" rx="${(n*.44).toFixed(0)}" ry="${Math.max(14,r*.05).toFixed(0)}" fill="#2b2140" opacity=".16"/>`,kA={conceptTriptych:{world:[3e3,1800],view:[1920,1080],manifest:[{key:`bgGradient`,default:!0},{key:`bgCircleA`,default:!0},{key:`bgCircleB`,default:!0},{key:`roseBand`,default:!0},{key:`panelA`,default:!0},{key:`panelB`,default:!0},{key:`panelC`,default:!0},{key:`panelShadows`,default:!0},{key:`swoosh`,default:!0},{key:`fgBlobA`,default:!0},{key:`fgBlobB`,default:!0},{key:`focusRing`,default:!1},{key:`hud`,default:!1}],build(e,t){let n=`<defs><linearGradient id="pmbg_ct" x1="0" x2="1"><stop offset="0" stop-color="#f7dca7"/><stop offset="1" stop-color="#d9c5ef"/></linearGradient></defs>`;t(`bgGradient`)&&(n+=`<rect x="-500" y="-300" width="4000" height="2400" fill="url(#pmbg_ct)"/>`),t(`bgCircleA`)&&(n+=`<circle cx="350" cy="320" r="200" fill="#fff5dc" opacity=".65"/>`),t(`bgCircleB`)&&(n+=`<circle cx="2630" cy="420" r="280" fill="#8eddf1" opacity=".55"/>`),t(`roseBand`)&&(n+=`<path d="M-200 1550 Q700 1050 1450 1420 T3200 1200 L3200 2100 H-200Z" fill="#d86d82" opacity=".28"/>`);let r=``;t(`panelA`)&&(r+=`<rect x="120" y="260" width="630" height="520" rx="44" fill="#fff" opacity=".9"/>`),t(`panelB`)&&(r+=`<rect x="1840" y="290" width="720" height="560" rx="44" fill="#fff" opacity=".9"/>`),t(`panelC`)&&(r+=`<rect x="920" y="910" width="730" height="520" rx="44" fill="#fff" opacity=".92"/>`),t(`panelShadows`)&&(r+=`<ellipse cx="480" cy="710" rx="120" ry="30" fill="#2b2140" opacity=".16"/><ellipse cx="2200" cy="790" rx="160" ry="35" fill="#2b2140" opacity=".16"/><ellipse cx="1280" cy="1400" rx="220" ry="45" fill="#2b2140" opacity=".16"/>`);let i=``;return t(`swoosh`)&&(i+=`<path d="M-400 1750 Q350 1180 860 1600 T2050 1510 T3400 1310 L3400 2200 H-400Z" fill="#54379e" opacity=".72"/>`),t(`fgBlobA`)&&(i+=`<circle cx="220" cy="1440" r="150" fill="#25155b" opacity=".35"/>`),t(`fgBlobB`)&&(i+=`<circle cx="2900" cy="1360" r="220" fill="#25155b" opacity=".28"/>`),{planes:[{depth:.24,id:`bg`,svg:n},{depth:1,id:`mid`,svg:r},{depth:1.28,id:`fg`,svg:i}],panels:[{id:`panelA`,x:480,y:500,w:630,h:520},{id:`panelB`,x:2200,y:540,w:720,h:560},{id:`panelC`,x:1280,y:1180,w:730,h:520}],subjects:[{id:`panelA`,x:480,y:500,importance:1.05},{id:`panelB`,x:2200,y:540,importance:1.08},{id:`panelC`,x:1280,y:1180,importance:1.1}]}}},panelRow:gA(`row`),panelGrid:gA(`grid`),heroPanelSide:gA(`hero`),floatingIslands:gA(`islands`),pinboard:gA(`pin`),stepsPath:gA(`steps`),orbitBoard:gA(`orbit`)},AA={row:[`#f7dca7`,`#d9c5ef`,`#fff5dc`,`#8eddf1`],grid:[`#e8f0e6`,`#cfe0f0`,`#fff2d6`,`#bfe3d8`],hero:[`#fbe3cf`,`#e6d2f0`,`#ffe6c2`,`#c9d8f2`],islands:[`#dfeafc`,`#f3e2ef`,`#cfe9ff`,`#ffd9ec`],pin:[`#e8d9bf`,`#d3c0a3`,`#fff3d6`,`#d9c19a`],steps:[`#e9f2df`,`#d4e8f0`,`#fff0cf`,`#c7e6d6`],orbit:[`#1b1740`,`#2b2160`,`#5b6ce0`,`#8eddf1`]},jA=Object.keys(kA),MA=e=>Object.prototype.hasOwnProperty.call(kA,e)}));function PA(e){return function(t=7){let n=XA[e]||XA.day,r=e+t;return[J(0,(e,t,r)=>{let i=e.createLinearGradient(0,0,0,r);i.addColorStop(0,n.skyTop),i.addColorStop(1,n.skyBot),e.fillStyle=i,e.fillRect(-500,-500,t+1e3,r+1e3)}),$A(.14,`dfar`+r,n.far,90,150),$A(.3,`dmid`+r,n.mid,80,90),KA(n.ground),$A(.66,`dnear`+r,n.near,70,40),ej(-1,n),ej(1,n)]}}function FA(e,t){return function(n=7,r=`day`){let i=XA[r]||XA.day,a=e+r+n,o=(mj[t]||{}).bias||0;if(e===`room`)return[GA(i.skyBot),J(.2,(e,t,n,r)=>{e.fillStyle=i.mid,e.fillRect(-500,-500,t+1e3,r+500)}),J(.28,(e,t,n)=>{e.fillStyle=i.far,e.fillRect(t*.34,n*.15,t*.32,n*.32),e.fillStyle=i.skyTop,e.fillRect(t*.36,n*.17,t*.28,n*.28)}),KA(i.ground),J(.66,(e,t,n,r,a)=>{e.fillStyle=i.near,e.fillRect(-500,r-14*a,t+1e3,14*a)}),...hj(t,i)];let s=cj[e]||cj.field;return[nj(i),lj(s[0],.14,`far`+a,{col:i.far,bias:o}),lj(s[1],.3,`mid`+a,{col:i.mid,bias:o}),KA(i.ground),lj(s[2],.66,`near`+a,{col:i.near,bias:o}),...hj(t,i)]}}function IA(e,t){let n=Fj[e]||Fj[`center.c`];return{x:n.x*t,y:n.y,z:n.z==null?.5:n.z}}function LA(e){let t={};return e.map((e,n)=>{let r=zj(e.d);return t[r]=(t[r]||0)+1,{key:`l`+n,default:!0,label:r+(t[r]>1?` `+t[r]:``)}})}function RA(e){return MA(e)?CA(e):LA((UA[e]||UA.plain)(7,`day`))}function zA(e,t={}){let n={};RA(e).forEach(e=>n[e.key]=e.default);for(let r of Object.keys(t))if(!(r in n))throw Error(`unknown element "${r}" for setup "${e}" (has: ${Object.keys(n).join(`, `)})`);return{...n,...t}}function BA(e,t=7,n=`2.5d`,r=`day`,i={}){let a=(UA[e]||UA.plain)(t,r),o=zA(Rj(e)?e:`plain`,i);return{name:Rj(e)?e:`plain`,mode:n,seed:t,palette:r,slots:Nj[e]||Ij,layers:a,elements:o}}function VA(e,t,n,r,i,a={scale:0,pan:0},o=0){let s=n/HA;t&&t.layers.length&&t.layers.forEach((c,l)=>{if(t.elements&&t.elements[`l`+l]===!1)return;e.save();let u=1+a.scale*c.d,d=a.pan*c.d*s;e.translate(n/2,i),e.scale(u,u),e.translate(-n/2,-i),e.translate(d,0),c.draw(e,n,r,i,s,o),e.restore()})}var HA,UA,J,WA,GA,KA,qA,JA,YA,XA,ZA,QA,$A,ej,tj,nj,rj,ij,aj,oj,sj,cj,lj,uj,dj,fj,pj,mj,hj,gj,_j,vj,yj,bj,xj,Sj,Cj,wj,Tj,Ej,Dj,Oj,kj,Aj,jj,Mj,Nj,Pj,Fj,Ij,Lj,Rj,zj,Bj=o((()=>{pO(),hA(),NA(),HA=960,UA={plain(){return[]},skyDay(e){let t=oO(`skyDay`+e),n=[];for(let e=0;e<6;e++)n.push({x:t()*HA,y:60+t()*200,s:.7+t()*.9});return[{d:0,draw:(e,t,n)=>{let r=e.createLinearGradient(0,0,0,n);r.addColorStop(0,`#3d8fd6`),r.addColorStop(.6,`#8fc4ec`),r.addColorStop(1,`#dceffa`),e.fillStyle=r,e.fillRect(-500,-500,t+1e3,n+1e3),e.fillStyle=`rgba(255,246,214,0.95)`,e.beginPath(),e.arc(t*.8,n*.22,44,0,7),e.fill()}},{d:.18,draw:(e,t,r,i,a)=>{e.fillStyle=`rgba(255,255,255,0.9)`,n.forEach(t=>{let n=t.x*a,i=t.y/540*r,o=26*t.s*a;e.beginPath(),e.arc(n,i,o,0,7),e.arc(n+o,i+4*a,o*.8,0,7),e.arc(n-o,i+4*a,o*.8,0,7),e.arc(n+o*.4,i-o*.6,o*.7,0,7),e.fill()})}}]},skyNight(e){let t=oO(`skyNight`+e),n=[];for(let e=0;e<90;e++)n.push({x:t()*HA,y:t()*480,r:.6+t()*1.8});return[{d:0,draw:(e,t,n)=>{let r=e.createLinearGradient(0,0,0,n);r.addColorStop(0,`#0b1430`),r.addColorStop(1,`#26325c`),e.fillStyle=r,e.fillRect(-500,-500,t+1e3,n+1e3),e.fillStyle=`rgba(240,240,220,0.9)`,e.beginPath(),e.arc(t*.24,n*.2,30,0,7),e.fill()}},{d:.12,draw:(e,t,r,i,a)=>{e.fillStyle=`#fdfbe8`,n.forEach(t=>{e.globalAlpha=.5+t.r%1*.5,e.beginPath(),e.arc(t.x*a,t.y/540*r,t.r*a,0,7),e.fill()}),e.globalAlpha=1}}]},city(e){let t=oO(`city`+e),n=[],r=[],i=[],a=-60;for(;a<1020;){let e=26+t()*30,r=80+t()*150;n.push({x:a,w:e,h:r}),a+=e+10}for(a=-80;a<1040;){let e=60+t()*70,n=120+t()*180;r.push({x:a,w:e,h:n}),a+=e+16}for(a=-100;a<1060;){let e=90+t()*80,n=90+t()*120;i.push({x:a,w:e,h:n}),a+=e+70}return[{d:0,draw:(e,t,n)=>{let r=e.createLinearGradient(0,0,0,n);r.addColorStop(0,`#bfe3f2`),r.addColorStop(1,`#eaf6fb`),e.fillStyle=r,e.fillRect(-500,-500,t+1e3,n+1e3),e.fillStyle=`rgba(255,255,255,0.55)`,e.beginPath(),e.arc(t*.78,n*.2,46,0,7),e.fill()}},{d:.15,draw:(e,t,r,i,a)=>{e.fillStyle=`#cdd7e6`,n.forEach(t=>e.fillRect(t.x*a,i-t.h*a,t.w*a,t.h*a+260))}},{d:.34,draw:(e,t,n,i,a)=>{r.forEach(t=>{e.fillStyle=`#7d8aa0`,e.fillRect(t.x*a,i-t.h*a,t.w*a,t.h*a),e.fillStyle=`rgba(255,235,170,0.9)`;let n=Math.floor(t.h/22);for(let r=0;r<3;r++)for(let o=0;o<n-1;o++)(r*7+o*13+(t.x|0))%3!=0&&e.fillRect((t.x+8+r*((t.w-16)/3))*a,i-(t.h-14-o*22)*a,((t.w-16)/3-7)*a,10*a)})}},{d:.46,draw:(e,t,n,r)=>{e.fillStyle=`#8e9aac`,e.fillRect(-500,r,t+1e3,n-r+500)}},{d:.78,draw:(e,t,n,r,a)=>{e.fillStyle=`#6a7689`,i.forEach(t=>e.fillRect(t.x*a,r-t.h*a,t.w*a,t.h*a))}}]},nature(e){let t=oO(`nature`+e),n=[],r=20;for(;r<HA;)n.push({x:r,h:70+t()*60}),r+=90+t()*70;return[{d:0,draw:(e,t,n)=>{let r=e.createLinearGradient(0,0,0,n);r.addColorStop(0,`#bfe6ef`),r.addColorStop(1,`#eaf8f3`),e.fillStyle=r,e.fillRect(-500,-500,t+1e3,n+1e3),e.fillStyle=`rgba(255,255,255,0.5)`,e.beginPath(),e.arc(t*.76,n*.22,42,0,7),e.fill()}},{d:.16,draw:(e,t,n,r,i)=>{e.fillStyle=`#bfe0a8`,e.beginPath(),e.moveTo(-500,r);for(let n=-500;n<=t+500;n+=36)e.lineTo(n,r-Math.abs(Math.sin(n*.004+1))*90*i-30*i);e.lineTo(t+500,r),e.closePath(),e.fill()}},{d:.34,draw:(e,t,n,r,i)=>{e.fillStyle=`#9fcf9a`,e.beginPath(),e.moveTo(-500,r);for(let n=-500;n<=t+500;n+=36)e.lineTo(n,r-Math.abs(Math.sin(n*.005+3))*60*i-10*i);e.lineTo(t+500,r),e.closePath(),e.fill()}},{d:.46,draw:(e,t,n,r)=>{e.fillStyle=`#7cae5a`,e.fillRect(-500,r,t+1e3,n-r+500)}},{d:.7,draw:(e,t,r,i,a)=>{n.forEach(t=>{let n=t.h;e.fillStyle=`#6b4a2e`,e.fillRect(t.x*a-3*a,i-n*.5*a,6*a,n*.5*a),e.fillStyle=`#3f8f63`,e.beginPath(),e.arc(t.x*a,i-n*.5*a,n*.42*a,0,7),e.fill()})}}]},interior(){return[{d:.1,draw:(e,t,n,r,i)=>{e.fillStyle=`#dcd2c2`,e.fillRect(-500,-500,t+1e3,r+500),e.fillStyle=`#cfc3b0`,e.fillRect(-500,r-30*i,t+1e3,30*i)}},{d:.3,draw:(e,t,n,r,i)=>{for(let r=0;r<3;r++){let a=t*(.24+r*.26),o=n*.3,s=72*i,c=60*i;e.fillStyle=`#fff`,e.fillRect(a-s/2,o-c/2,s,c),e.fillStyle=[`#d98c6a`,`#7c9fd9`,`#7cc08a`][r],e.fillRect(a-s/2+6*i,o-c/2+6*i,s-12*i,c-12*i)}}},{d:.46,draw:(e,t,n,r,i)=>{e.fillStyle=`#b9966f`,e.fillRect(-500,r,t+1e3,n-r+500),e.fillStyle=`#a8865f`;for(let t=-5;t<20;t++)e.fillRect(t*90*i,r,3*i,n-r+300)}}]},abstract(e){let t=oO(`abstract`+e),n=[];for(let e=0;e<8;e++)n.push({x:t()*HA,y:t()*540,r:50+t()*120,d:.12+t()*.72,h:t()});let r=[{d:0,draw:(e,t,n)=>{let r=e.createLinearGradient(0,0,0,n);r.addColorStop(0,`#2a2350`),r.addColorStop(1,`#5b3f8f`),e.fillStyle=r,e.fillRect(-500,-500,t+1e3,n+1e3)}}];return n.sort((e,t)=>e.d-t.d).forEach(e=>r.push({d:e.d,draw:(t,n,r,i,a)=>{t.globalAlpha=.82,t.fillStyle=e.h<.5?`#7c5cff`:`#ff7ab0`,t.beginPath(),t.arc(e.x*a,e.y/540*r,e.r*a,0,7),t.fill(),t.globalAlpha=1}})),r}},J=(e,t)=>({d:e,draw:t}),WA=(e,t)=>J(0,(n,r,i)=>{let a=n.createLinearGradient(0,0,0,i);a.addColorStop(0,e),a.addColorStop(1,t),n.fillStyle=a,n.fillRect(-500,-500,r+1e3,i+1e3)}),GA=e=>J(0,(t,n,r)=>{t.fillStyle=e,t.fillRect(-500,-500,n+1e3,r+1e3)}),KA=(e,t=0)=>J(.46,(n,r,i,a)=>{n.fillStyle=e,n.fillRect(-500,a+t,r+1e3,i-a+500)}),qA=(e,t,n,r,i,a)=>J(e,(e,o,s,c,l)=>{let u=oO(t);e.fillStyle=n;for(let t=0;t<r;t++){let t=u()*HA,n=i[0]+u()*i[1],r=a[0]+u()*a[1];e.fillRect(t*l,c-r*l,n*l,r*l)}}),JA=(e,t,n,r)=>J(e,(e,i,a,o,s)=>{let c=oO(t),l=20;for(;l<HA;){let t=60+c()*70;e.fillStyle=n,e.fillRect(l*s-3*s,o-t*.5*s,6*s,t*.5*s),e.fillStyle=r,e.beginPath(),e.arc(l*s,o-t*.5*s,t*.42*s,0,7),e.fill(),l+=80+c()*70}}),YA=e=>J(.3,(t,n,r,i,a)=>{for(let i=0;i<3;i++){let o=n*(.22+i*.28),s=r*.28,c=66*a,l=54*a;t.fillStyle=`#fff`,t.fillRect(o-c/2,s-l/2,c,l),t.fillStyle=e[i%e.length],t.fillRect(o-c/2+6*a,s-l/2+6*a,c-12*a,l-12*a)}}),Object.assign(UA,{genericRoom(e){return UA.interior(e)},office(e){return[WA(`#dfe6ee`,`#eef2f6`),YA([`#7c9fd9`,`#3fae6b`]),J(.34,(e,t,n,r,i)=>{e.fillStyle=`#c9d2da`;for(let t=0;t<3;t++)e.fillRect((120+t*300)*i,r-70*i,200*i,70*i)}),KA(`#c9b79a`)]},classroom(){return[GA(`#e8ede2`),J(.28,(e,t,n)=>{e.fillStyle=`#3a6b52`,e.fillRect(t*.24,n*.16,t*.52,n*.34),e.strokeStyle=`#2c5240`,e.lineWidth=6,e.strokeRect(t*.24,n*.16,t*.52,n*.34)}),KA(`#c7b79a`)]},workshop(e){return[GA(`#d8d3c6`),qA(.3,`wk`+e,`#9a8b6f`,8,[30,40],[20,60]),KA(`#b09571`)]},kitchen(){return[GA(`#eef1eb`),J(.34,(e,t,n,r,i)=>{e.fillStyle=`#c7cdb9`,e.fillRect(-500,r-40*i,t+1e3,12*i)}),KA(`#cdbfa4`)]},stagePodium(){return[GA(`#242a34`),J(.2,(e,t,n)=>{let r=e.createRadialGradient(t/2,n*.3,20,t/2,n*.3,n*.7);r.addColorStop(0,`rgba(255,240,200,.35)`),r.addColorStop(1,`rgba(255,240,200,0)`),e.fillStyle=r,e.fillRect(0,0,t,n)}),KA(`#39414f`)]},corridor(){return[GA(`#dfe1e6`),J(.3,(e,t,n)=>{e.strokeStyle=`#c3c8d0`,e.lineWidth=3;for(let r=-3;r<=3;r++)e.beginPath(),e.moveTo(t/2+r*t*.16,0),e.lineTo(t/2+r*t*.04,n),e.stroke()}),KA(`#b8bcc6`)]},storeInterior(e){return[GA(`#e9e4da`),qA(.32,`st`+e,`#b79c74`,6,[70,20],[60,40]),KA(`#c3b393`)]},labGeneric(e){return[GA(`#eef3f5`),qA(.32,`lb`+e,`#cdd7dc`,5,[40,50],[30,60]),KA(`#d3dde0`)]},controlRoom(e){return[GA(`#1d2430`),J(.3,(t,n,r,i,a)=>{oO(`cr`+e);for(let e=0;e<8;e++)t.fillStyle=[`#2b6cb0`,`#2bb3a3`,`#c98a3a`][e%3],t.globalAlpha=.7,t.fillRect((60+e*110)*a,(120+e%2*40)*a,80*a,50*a),t.globalAlpha=1}),KA(`#2a323f`)]},street(e){return[WA(`#bfe3f2`,`#eaf6fb`),qA(.4,`str`+e,`#8e9aac`,10,[50,60],[90,150]),KA(`#7a8391`),J(.5,(e,t,n,r,i)=>{e.fillStyle=`#5c636e`,e.fillRect(-500,r,t+1e3,n),e.strokeStyle=`#e6c34a`,e.lineWidth=3*i,e.setLineDash([20*i,18*i]),e.beginPath(),e.moveTo(-500,r+(n-r)*.5),e.lineTo(t+500,r+(n-r)*.5),e.stroke(),e.setLineDash([])})]},park(){return[WA(`#bfe6ef`,`#eaf8f3`),KA(`#7cae5a`),JA(.6,`park`,`#6b4a2e`,`#3f8f63`),J(.5,(e,t,n,r)=>{e.fillStyle=`#cdbd8f`,e.beginPath(),e.moveTo(t*.3,n),e.lineTo(t*.46,r),e.lineTo(t*.54,r),e.lineTo(t*.7,n),e.fill()})]},forest(e){return[WA(`#cfe6d6`,`#eef7ef`),KA(`#5f8f4e`),JA(.4,`f1`+e,`#5a3e26`,`#357a4e`),JA(.7,`f2`+e,`#6b4a2e`,`#3f8f63`)]},mountain(e){return[WA(`#cfe0ef`,`#eef4f9`),J(.2,(t,n,r,i,a)=>{let o=oO(`mt`+e);t.fillStyle=`#9fb0c4`;for(let e=0;e<5;e++){let n=e*HA/4*a,r=(160+o()*120)*a;t.beginPath(),t.moveTo(n-140*a,i),t.lineTo(n,i-r),t.lineTo(n+140*a,i),t.fill()}}),KA(`#7f9e6f`)]},desertPlain(){return[WA(`#f4dcae`,`#f8eccf`),KA(`#e4c483`),J(.3,(e,t,n,r,i)=>{e.fillStyle=`#d9b46e`,e.beginPath(),e.moveTo(-500,r);for(let n=-500;n<=t+500;n+=40)e.lineTo(n,r-Math.abs(Math.sin(n*.003))*30*i);e.lineTo(t+500,r),e.fill()})]},coastBeach(){return[WA(`#bfe3f2`,`#e8f6fb`),J(.34,(e,t,n,r,i)=>{e.fillStyle=`#4aa3c4`,e.fillRect(-500,r-60*i,t+1e3,60*i)}),KA(`#ead9a6`)]},farmField(){return[WA(`#c7e6f0`,`#eef9f3`),KA(`#8bab4e`),J(.5,(e,t,n,r,i)=>{e.strokeStyle=`#79993f`,e.lineWidth=3*i;for(let n=0;n<6;n++)e.beginPath(),e.moveTo(-500,r+n*20*i),e.lineTo(t+500,r+n*20*i),e.stroke()})]},skylineWide(e){return[WA(`#bcd8ee`,`#eaf4fb`),qA(.2,`sk`+e,`#aebccd`,14,[30,40],[80,160]),qA(.42,`sk2`+e,`#8695a9`,9,[60,60],[60,120]),KA(`#79879a`)]},rooftop(e){return[WA(`#bfe3f2`,`#eaf6fb`),qA(.2,`rf`+e,`#9caabd`,10,[40,50],[60,120]),KA(`#8a8f98`),J(.5,(e,t,n,r,i)=>{e.fillStyle=`#6f747d`,e.fillRect(-500,r-16*i,t+1e3,16*i)})]},roadHighway(){return[WA(`#bfe3f2`,`#eaf6fb`),KA(`#5c636e`),J(.5,(e,t,n,r,i)=>{e.strokeStyle=`#eef2f4`,e.lineWidth=4*i,e.setLineDash([26*i,22*i]),[.35,.65].forEach(i=>{e.beginPath(),e.moveTo(-500,r+(n-r)*i),e.lineTo(t+500,r+(n-r)*i),e.stroke()}),e.setLineDash([])})]},oceanSurface(){return[WA(`#a9d6ec`,`#dff1fb`),J(.4,(e,t,n,r,i)=>{e.fillStyle=`#2f8fc0`,e.fillRect(-500,r-30*i,t+1e3,n),e.strokeStyle=`rgba(255,255,255,.5)`,e.lineWidth=2*i;for(let n=0;n<5;n++){e.beginPath(),e.moveTo(-500,r+n*26*i);for(let a=-500;a<t+500;a+=30)e.lineTo(a,r+n*26*i+Math.sin(a*.03+n)*4*i);e.stroke()}})]},underwater(e){return[WA(`#1f6f9e`,`#0c3f5f`),J(.3,(t,n,r,i,a)=>{let o=oO(`uw`+e);t.fillStyle=`rgba(255,255,255,.25)`;for(let e=0;e<30;e++)t.beginPath(),t.arc(o()*n,o()*r,(2+o()*6)*a,0,7),t.fill()}),KA(`#b79a5f`)]},skyClouds(){return UA.skyDay(3)},spacePlanet(e){return[WA(`#0a0f22`,`#161f3e`),J(.12,(t,n,r,i,a)=>{let o=oO(`sp`+e);t.fillStyle=`#fdfbe8`;for(let e=0;e<80;e++)t.fillRect(o()*n,o()*r,2,2)}),J(.2,(e,t,n,r,i)=>{e.fillStyle=`#c96a5e`,e.beginPath(),e.arc(t*.76,n*.3,60*i,0,7),e.fill(),e.fillStyle=`rgba(255,255,255,.12)`,e.beginPath(),e.arc(t*.72,n*.26,60*i,0,7),e.fill()})]},arcticIce(){return[WA(`#cfe6f2`,`#eef7fb`),KA(`#dfeef4`),J(.4,(e,t,n,r,i)=>{e.fillStyle=`#bcd7e4`;for(let t=0;t<4;t++){let n=(120+t*260)*i;e.beginPath(),e.moveTo(n-90*i,r),e.lineTo(n,r-70*i),e.lineTo(n+90*i,r),e.fill()}})]},studioPlain(){return[WA(`#eef3f4`,`#dbe8ea`)]},gradientAbstract(e){let t=oO(`ga`+e),n=Math.floor(t()*360);return[J(0,(e,t,r)=>{let i=e.createLinearGradient(0,0,t,r);i.addColorStop(0,`hsl(${n} 55% 62%)`),i.addColorStop(1,`hsl(${(n+60)%360} 55% 48%)`),e.fillStyle=i,e.fillRect(0,0,t,r)})]},gridBoard(){return[GA(`#f4f7f8`),J(.2,(e,t,n,r,i)=>{e.strokeStyle=`#dde5e9`,e.lineWidth=1.5;for(let r=0;r<t;r+=40*i)e.beginPath(),e.moveTo(r,0),e.lineTo(r,n),e.stroke();for(let r=0;r<n;r+=40*i)e.beginPath(),e.moveTo(0,r),e.lineTo(t,r),e.stroke()})]},mapStage(e){return[GA(`#dcece2`),J(.2,(t,n,r,i,a)=>{let o=oO(`mp`+e);t.fillStyle=`#b7d8c1`,t.beginPath(),t.moveTo(n*.2,r*.3);for(let e=0;e<10;e++)t.lineTo(n*(.2+o()*.6),r*(.2+o()*.6));t.closePath(),t.fill()})]},chartStage(){return[GA(`#f6f8f9`),J(.2,(e,t,n,r,i)=>{e.strokeStyle=`#d7dee3`,e.lineWidth=2,e.beginPath(),e.moveTo(t*.15,n*.2),e.lineTo(t*.15,n*.8),e.lineTo(t*.85,n*.8),e.stroke()})]},timelineBand(){return[GA(`#f4f7f8`),J(.3,(e,t,n,r,i)=>{e.fillStyle=`#e7edf1`,e.fillRect(0,n*.46,t,n*.08)})]},splitVersus(){return[J(0,(e,t,n)=>{e.fillStyle=`#dfeaf6`,e.fillRect(0,0,t/2,n),e.fillStyle=`#f6e3df`,e.fillRect(t/2,0,t/2,n),e.strokeStyle=`#c7d0d6`,e.lineWidth=3,e.beginPath(),e.moveTo(t/2,0),e.lineTo(t/2,n),e.stroke()})]},iconField(e){return[GA(`#f2f5f6`),J(.2,(t,n,r,i,a)=>{let o=oO(`if`+e);t.fillStyle=`#dbe4e8`;for(let e=0;e<24;e++)t.beginPath(),t.arc(o()*n,o()*r,10*a,0,7),t.fill()})]},blueprint(){return[GA(`#123a63`),J(.2,(e,t,n,r,i)=>{e.strokeStyle=`rgba(255,255,255,.22)`,e.lineWidth=1;for(let r=0;r<t;r+=34*i)e.beginPath(),e.moveTo(r,0),e.lineTo(r,n),e.stroke();for(let r=0;r<n;r+=34*i)e.beginPath(),e.moveTo(0,r),e.lineTo(t,r),e.stroke()})]},spotlightDark(){return[GA(`#171c24`),J(.1,(e,t,n,r)=>{let i=e.createRadialGradient(t/2,r-120,30,t/2,r-120,t*.6);i.addColorStop(0,`rgba(255,255,255,.16)`),i.addColorStop(1,`rgba(255,255,255,0)`),e.fillStyle=i,e.fillRect(0,0,t,n)}),KA(`#20262f`)]},crowdScene(e){return[WA(`#cfd8e2`,`#eaeff4`),KA(`#9aa2ad`),J(.6,(t,n,r,i,a)=>{let o=oO(`cw`+e);for(let e=0;e<26;e++){let e=o()*HA*a,n=(50+o()*30)*a;t.fillStyle=`hsl(${Math.floor(o()*360)} 30% 55%)`,t.fillRect(e,i-n,16*a,n),t.beginPath(),t.arc(e+8*a,i-n,9*a,0,7),t.fill()}})]},marketplace(e){return[WA(`#e9d9b0`,`#f4ead0`),KA(`#c9b184`),J(.5,(t,n,r,i,a)=>{oO(`mk`+e);for(let e=0;e<5;e++){let n=(80+e*200)*a;t.fillStyle=[`#c0563f`,`#3f7fc0`,`#3fae6b`,`#c9a13a`,`#8b5cf6`][e],t.fillRect(n,i-90*a,140*a,20*a),t.fillStyle=`#a9855c`,t.fillRect(n+6*a,i-70*a,6*a,70*a),t.fillRect(n+128*a,i-70*a,6*a,70*a)}})]},constructionSite(e){return[WA(`#cfe0ec`,`#eef4f9`),KA(`#b79a6a`),J(.4,(e,t,n,r,i)=>{e.strokeStyle=`#e0a52e`,e.lineWidth=6*i,e.strokeRect(t*.3,r-200*i,6*i,200*i),e.beginPath(),e.moveTo(t*.3,r-200*i),e.lineTo(t*.55,r-200*i),e.stroke()})]},harborDock(e){return[WA(`#bfe3f2`,`#eaf6fb`),J(.4,(e,t,n,r,i)=>{e.fillStyle=`#3f8fb5`,e.fillRect(-500,r-20*i,t+1e3,n)}),KA(`#8a6a45`,20),J(.3,(e,t,n,r,i)=>{e.strokeStyle=`#c9553f`,e.lineWidth=6*i,e.strokeRect(t*.6,r-150*i,6*i,150*i)})]},weatherStorm(e){return[WA(`#4a5361`,`#6a7484`),J(.2,(t,n,r,i,a)=>{let o=oO(`ws`+e);t.strokeStyle=`rgba(220,230,240,.4)`,t.lineWidth=2;for(let e=0;e<60;e++){let e=o()*n,i=o()*r;t.beginPath(),t.moveTo(e,i),t.lineTo(e-6*a,i+18*a),t.stroke()}}),KA(`#3c4450`)]}}),XA={day:{skyTop:`#7fb2e0`,skyBot:`#cfe6f5`,far:`#b8cdde`,mid:`#7f93a8`,ground:`#6d8196`,near:`#4f6172`,occluder:`#26323f`},goldenHour:{skyTop:`#f0a35a`,skyBot:`#f7d79a`,far:`#d8b58a`,mid:`#b5876a`,ground:`#8f6a4f`,near:`#5f4636`,occluder:`#2a1c14`},dusk:{skyTop:`#e98a5b`,skyBot:`#f4c78d`,far:`#caa088`,mid:`#9c6f6a`,ground:`#7a5b57`,near:`#513f4a`,occluder:`#241826`},night:{skyTop:`#0b1430`,skyBot:`#26325c`,far:`#33406a`,mid:`#26314f`,ground:`#1b2740`,near:`#141d33`,occluder:`#060a16`},dawn:{skyTop:`#b98db5`,skyBot:`#f3d0c9`,far:`#c9b3c4`,mid:`#9e8ba0`,ground:`#7d7085`,near:`#55495e`,occluder:`#221c2b`},overcast:{skyTop:`#b8bfc6`,skyBot:`#d8dde1`,far:`#b3bcc4`,mid:`#97a2ad`,ground:`#808b95`,near:`#5e6771`,occluder:`#333a42`},desert:{skyTop:`#e6c98a`,skyBot:`#f4ead0`,far:`#dcc59a`,mid:`#c9a56f`,ground:`#b98d5a`,near:`#9a6f45`,occluder:`#4a3520`},arctic:{skyTop:`#a9c9e0`,skyBot:`#eef7fb`,far:`#cddfe9`,mid:`#b6cdd8`,ground:`#cfe0e6`,near:`#93b0bd`,occluder:`#35505e`},underwater:{skyTop:`#1f6f8f`,skyBot:`#0d3f4f`,far:`#2f7f8a`,mid:`#266b70`,ground:`#1b4f52`,near:`#143a3a`,occluder:`#08201f`},space:{skyTop:`#05060f`,skyBot:`#10132a`,far:`#1e2340`,mid:`#191d38`,ground:`#12162c`,near:`#0c0f20`,occluder:`#04050c`},neonNight:{skyTop:`#14082a`,skyBot:`#2a1050`,far:`#7a3fb0`,mid:`#b03f8a`,ground:`#2a1a4a`,near:`#16102e`,occluder:`#080416`},sepiaPast:{skyTop:`#cdb488`,skyBot:`#e6d4ad`,far:`#c4ac82`,mid:`#a98d64`,ground:`#8a7150`,near:`#5f4c34`,occluder:`#2f2419`}},ZA=Object.keys(XA),QA={day:`light`,goldenHour:`light`,dusk:`light`,night:`dark`,dawn:`light`,overcast:`light`,desert:`light`,arctic:`light`,underwater:`dark`,space:`dark`,neonNight:`dark`,sepiaPast:`light`},$A=(e,t,n,r,i,a=0)=>J(e,(e,o,s,c,l)=>{let u=oO(t),d=[];for(let e=0;e<=16;e++)d.push((i+u()*r)*(1+a*.45*(e/8-1)));e.fillStyle=n,e.beginPath(),e.moveTo(-500,c);for(let t=0;t<=16;t++){let n=-200+t/16*(o+400);e.lineTo(n,c-d[t]*l)}e.lineTo(o+500,c),e.closePath(),e.fill()}),ej=(e,t)=>J(.9,(n,r,i,a,o,s=0)=>{let c=1+Math.sin(s*.55+(e<0?0:1.7))*.02,l=Math.sin(s*.12+e)*22*o,u=r*.24*c,d=e<0?-60+l:r-u+60+l;n.save(),n.globalAlpha=.97,n.fillStyle=t.occluder,n.beginPath(),n.moveTo(d,-60),n.lineTo(d+u,-60),n.lineTo(d+u-26*o,i*.42),n.lineTo(d+u+10*o,i*.64),n.lineTo(d+u-34*o,i+60),n.lineTo(d-60,i+60),n.closePath(),n.fill(),n.restore()}),tj={dioramaDay:PA(`day`),dioramaDusk:PA(`dusk`),dioramaNight:PA(`night`),dioramaDesert:PA(`desert`),dioramaArctic:PA(`arctic`)},Object.assign(UA,tj),Object.keys(tj),nj=e=>J(0,(t,n,r)=>{let i=t.createLinearGradient(0,0,0,r);i.addColorStop(0,e.skyTop),i.addColorStop(1,e.skyBot),t.fillStyle=i,t.fillRect(-500,-500,n+1e3,r+1e3)}),rj=(e,t,n,r,i,a=0)=>J(e,(e,o,s,c,l)=>{let u=oO(t);e.fillStyle=n,e.beginPath(),e.moveTo(-500,c);for(let t=0;t<=9;t++){let n=-200+t/9*(o+400),s=(t%2?i+u()*r:i*.28)*(1+a*.45*(t/4.5-1));e.lineTo(n,c-s*l)}e.lineTo(o+500,c),e.closePath(),e.fill()}),ij=(e,t,n,r,i,a=0)=>J(e,(t,o,s,c,l)=>{t.fillStyle=n,t.beginPath(),t.moveTo(-500,c);for(let n=-200;n<=o+400;n+=22){let s=(n+200)/(o+400);t.lineTo(n,c-(i+Math.abs(Math.sin(n*.004+e*3))*r)*(1+a*.45*(s*2-1))*l)}t.lineTo(o+500,c),t.closePath(),t.fill()}),aj=(e,t,n,r,i,a=0)=>J(e,(e,o,s,c,l)=>{let u=oO(t);e.fillStyle=n;let d=-80;for(;d<o+80;){let t=d/o,n=(r+u()*(i-r))*(1+a*.45*(t*2-1))*l,s=(40+u()*60)*l;e.fillRect(d,c-n,s,n+300),d+=s+(6+u()*14)*l}}),oj=(e,t,n,r,i)=>J(e,(e,a,o,s,c)=>{let l=oO(t);e.fillStyle=n;let u=-40;for(;u<a+40;){let t=(r+l()*i)*c;e.beginPath(),e.arc(u,s-t*.5,t*.5,0,7),e.fill(),e.fillRect(u-t*.14,s-t*.5,t*.28,t*.5+200),u+=(30+l()*22)*c}}),sj=(e,t)=>J(e,(e,n,r,i,a)=>{e.fillStyle=t,e.fillRect(-500,i-10*a,n+1e3,r),e.strokeStyle=`rgba(255,255,255,.16)`,e.lineWidth=1.5*a;for(let t=0;t<4;t++){e.beginPath();for(let r=-500;r<n+500;r+=26)e.lineTo(r,i+t*22*a+Math.sin(r*.03+t)*3*a);e.stroke()}}),cj={field:[[`rolling`,60,110],[`rolling`,48,64],[`rolling`,36,28]],hills:[[`rolling`,110,150],[`rolling`,80,88],[`rolling`,56,38]],ridge:[[`jagged`,150,150],[`jagged`,110,86],[`jagged`,78,40]],valley:[[`rolling`,120,150],[`rolling`,44,58],[`rolling`,80,44]],dunes:[[`dune`,70,110],[`dune`,54,66],[`dune`,40,30]],mesa:[[`jagged`,110,150],[`jagged`,84,84],[`jagged`,60,40]],coast:[[`rolling`,56,100],[`water`,0,0],[`rolling`,40,28]],harbor:[[`skyline`,70,140],[`water`,0,0],[`skyline`,56,86]],forest:[[`rolling`,70,110],[`tree`,64,40],[`tree`,48,30]],city:[[`skyline`,90,170],[`skyline`,110,150],[`skyline`,78,110]],plaza:[[`skyline`,80,150],[`rolling`,28,44],[`skyline`,60,84]]},lj=(e,t,n,r)=>{let[i,a,o]=e,s=r.bias||0;return i===`jagged`?rj(t,n,r.col,a,o,s):i===`dune`?ij(t,n,r.col,a,o,s):i===`skyline`?aj(t,n,r.col,o,o+a,s):i===`tree`?oj(t,n,r.col,o,a):i===`water`?sj(t,r.col):$A(t,n,r.col,a,o,s)},uj=e=>1+Math.sin(e*.55)*.02,dj=(e,t)=>Math.sin(e*.12+t)*16,fj={curtain:(e,t)=>J(.88,(n,r,i,a,o,s=0)=>{let c=r*.15*uj(s),l=dj(s,t)*o,u=t<0?-40+l:r-c+40+l;n.save(),n.globalAlpha=.9,n.fillStyle=e.occluder,n.beginPath(),n.moveTo(u,-60),n.lineTo(u+c,-60),n.lineTo(u+c-20*o,i*.5),n.lineTo(u+c-30*o,i+60),n.lineTo(u-40,i+60),n.closePath(),n.fill(),n.restore()}),foliage:(e,t)=>J(.9,(n,r,i,a,o,s=0)=>{let c=dj(s,t)*o,l=t<0?-16+c:r+16+c,u=t<0?1:-1;n.save(),n.globalAlpha=.9,n.fillStyle=e.occluder;for(let e=0;e<5;e++){let t=l+u*e*42*o,r=(18+e*22)*o+Math.sin(s*.5+e)*4*o;n.beginPath(),n.arc(t,r,(48-e*4)*o,0,7),n.fill()}n.restore()}),pillar:(e,t)=>J(.88,(n,r,i,a,o,s=0)=>{let c=dj(s,t)*o*.3,l=r*.085,u=t<0?r*.05+c:r*.865+c;n.save(),n.globalAlpha=.94,n.fillStyle=e.occluder,n.fillRect(u,-40,l,i+80),n.fillStyle=sO(e.occluder,1.35),n.fillRect(u,-40,l*.32,i+80),n.restore()}),archTop:e=>J(.9,(t,n,r,i,a,o=0)=>{let s=uj(o);t.save(),t.globalAlpha=.94,t.fillStyle=e.occluder,t.beginPath(),t.moveTo(-60,-60),t.lineTo(n+60,-60),t.lineTo(n+60,r*.2*s),t.quadraticCurveTo(n*.5,r*.44*s,-60,r*.2*s),t.closePath(),t.fill(),t.restore()}),ledge:e=>J(.9,(t,n,r,i,a,o=0)=>{let s=uj(o);t.save(),t.globalAlpha=.94,t.fillStyle=e.occluder,t.fillRect(-60,r-58*a*s,n+120,90*a),t.restore()}),rocks:(e,t)=>J(.9,(n,r,i,a,o)=>{let s=t<0?r*.03:r*.8;n.save(),n.globalAlpha=.94,n.fillStyle=e.occluder,n.beginPath(),n.moveTo(s-70,i+60),n.lineTo(s,i-66*o),n.lineTo(s+52*o,i-40*o),n.lineTo(s+112*o,i-92*o),n.lineTo(s+190*o,i+60),n.closePath(),n.fill(),n.restore()}),kelp:(e,t)=>J(.9,(n,r,i,a,o,s=0)=>{let c=t<0?r*.07:r*.9;n.save(),n.globalAlpha=.78,n.strokeStyle=e.occluder,n.lineWidth=13*o,n.lineCap=`round`;for(let e=0;e<2;e++){let t=c+e*24*o;n.beginPath(),n.moveTo(t,i+40);for(let r=i;r>i*.3;r-=28)n.lineTo(t+Math.sin(r*.02+s*.6+e)*20*o,r);n.stroke()}n.restore()}),beam:(e,t)=>J(.88,(n,r,i,a,o)=>{let s=t<0?1:-1,c=t<0?-40:r+40;n.save(),n.globalAlpha=.9,n.strokeStyle=e.occluder,n.lineWidth=22*o,n.beginPath(),n.moveTo(c,-40),n.lineTo(c+s*r*.5,i*.7),n.stroke(),n.restore()}),crowdFg:e=>J(.92,(t,n,r,i,a,o=0)=>{t.save(),t.globalAlpha=.9,t.fillStyle=e.occluder;for(let e=0;e<7;e++){let i=(e+.5)*(n/7)+Math.sin(o*.6+e)*4*a;t.beginPath(),t.arc(i,r+34*a,44*a,Math.PI,0),t.fill(),t.beginPath(),t.arc(i,r-18*a,20*a,0,7),t.fill()}t.restore()})},pj={genericRoom:[{kind:`pillar`,side:1}],office:[{kind:`beam`,side:-1}],classroom:[{kind:`pillar`,side:-1}],workshop:[{kind:`beam`,side:1}],kitchen:[{kind:`ledge`}],stagePodium:[{kind:`curtain`,side:-1},{kind:`curtain`,side:1}],corridor:[{kind:`archTop`}],storeInterior:[{kind:`pillar`,side:1}],labGeneric:[],controlRoom:[{kind:`pillar`,side:-1}],courtroomGeneric:[{kind:`pillar`,side:1}],hospitalWard:[],throneHall:[{kind:`pillar`,side:-1},{kind:`pillar`,side:1}],street:[{kind:`curtain`,side:1}],park:[{kind:`foliage`,side:-1}],forest:[{kind:`foliage`,side:-1},{kind:`foliage`,side:1}],mountain:[{kind:`rocks`,side:-1}],desertPlain:[],coastBeach:[{kind:`rocks`,side:1}],farmField:[],skylineWide:[{kind:`curtain`,side:1}],rooftop:[{kind:`ledge`}],roadHighway:[],rooftopNight:[{kind:`ledge`}],ruins:[{kind:`rocks`,side:1}],cave:[{kind:`archTop`}],oceanSurface:[],underwater:[{kind:`kelp`,side:-1},{kind:`kelp`,side:1}],harborDock:[{kind:`beam`,side:1}],skyClouds:[],spacePlanet:[],arcticIce:[{kind:`rocks`,side:-1}],weatherStorm:[{kind:`curtain`,side:-1}],crowdScene:[{kind:`crowdFg`}],marketplace:[{kind:`crowdFg`}],marketStreetDense:[{kind:`crowdFg`}],stadium:[{kind:`crowdFg`}],constructionSite:[{kind:`beam`,side:-1}],openField:[],rollingHills:[{kind:`foliage`,side:-1}],mountainRidge:[{kind:`rocks`,side:1}],valleyStage:[],pineForest:[{kind:`foliage`,side:-1},{kind:`foliage`,side:1}],sandDunes:[],mesaFlats:[{kind:`rocks`,side:-1}],seaCoast:[{kind:`ledge`}],portHarbor:[{kind:`beam`,side:1}],cityscape:[{kind:`curtain`,side:1}],townPlaza:[{kind:`pillar`,side:-1}],interiorRoom:[{kind:`pillar`,side:1}]},[`studioPlain`,`gradientAbstract`,`gridBoard`,`mapStage`,`chartStage`,`timelineBand`,`splitVersus`,`iconField`,`blueprint`,`spotlightDark`].forEach(e=>{pj[e]=[]}),mj={genericRoom:{focal:`left`,bias:1},office:{focal:`right`,bias:-1},classroom:{focal:`right`,bias:-1},workshop:{focal:`left`,bias:1},kitchen:{focal:`center`,bias:0},stagePodium:{focal:`center`,bias:0},corridor:{focal:`center`,bias:0},storeInterior:{focal:`left`,bias:1},labGeneric:{focal:`right`,bias:-1},controlRoom:{focal:`right`,bias:-1},courtroomGeneric:{focal:`left`,bias:1},hospitalWard:{focal:`center`,bias:0},throneHall:{focal:`center`,bias:0},street:{focal:`left`,bias:1},park:{focal:`right`,bias:-1},forest:{focal:`center`,bias:0},mountain:{focal:`right`,bias:1},desertPlain:{focal:`left`,bias:1},coastBeach:{focal:`left`,bias:-1},farmField:{focal:`right`,bias:-1},skylineWide:{focal:`left`,bias:1},rooftop:{focal:`center`,bias:0},roadHighway:{focal:`center`,bias:0},rooftopNight:{focal:`right`,bias:-1},ruins:{focal:`left`,bias:1},cave:{focal:`center`,bias:0},oceanSurface:{focal:`left`,bias:1},underwater:{focal:`center`,bias:0},harborDock:{focal:`left`,bias:1},skyClouds:{focal:`center`,bias:0},spacePlanet:{focal:`right`,bias:-1},arcticIce:{focal:`right`,bias:-1},weatherStorm:{focal:`right`,bias:-1},crowdScene:{focal:`center`,bias:0},marketplace:{focal:`right`,bias:-1},marketStreetDense:{focal:`left`,bias:1},stadium:{focal:`center`,bias:0},constructionSite:{focal:`right`,bias:-1},openField:{focal:`right`,bias:-1},rollingHills:{focal:`right`,bias:-1},mountainRidge:{focal:`left`,bias:1},valleyStage:{focal:`center`,bias:0},pineForest:{focal:`center`,bias:0},sandDunes:{focal:`left`,bias:1},mesaFlats:{focal:`right`,bias:-1},seaCoast:{focal:`left`,bias:1},portHarbor:{focal:`left`,bias:1},cityscape:{focal:`left`,bias:1},townPlaza:{focal:`right`,bias:-1},interiorRoom:{focal:`left`,bias:1}},[`studioPlain`,`gradientAbstract`,`gridBoard`,`mapStage`,`chartStage`,`timelineBand`,`splitVersus`,`iconField`,`blueprint`,`spotlightDark`].forEach(e=>{mj[e]={focal:`center`,bias:0}}),hj=(e,t)=>(pj[e]||[]).map(e=>fj[e.kind]?fj[e.kind](t,e.side||-1):null).filter(Boolean),gj={openField:`field`,rollingHills:`hills`,mountainRidge:`ridge`,valleyStage:`valley`,sandDunes:`dunes`,mesaFlats:`mesa`,seaCoast:`coast`,portHarbor:`harbor`,pineForest:`forest`,cityscape:`city`,townPlaza:`plaza`,interiorRoom:`room`},_j=Object.keys(gj),Object.keys(gj).forEach(e=>{UA[e]=FA(gj[e],e)}),vj=(e,t=.18)=>J(t,(t,n,r,i)=>{t.fillStyle=e.mid,t.fillRect(-500,-500,n+1e3,i+500)}),yj=e=>J(.66,(t,n,r,i,a)=>{t.fillStyle=e.near,t.fillRect(-500,i-12*a,n+1e3,12*a)}),bj=(e,t,n)=>J(0,(r,i,a)=>{let o=n?r.createLinearGradient(0,0,i,a):r.createLinearGradient(0,0,0,a);o.addColorStop(0,e),o.addColorStop(1,t),r.fillStyle=o,r.fillRect(-500,-500,i+1e3,a+1e3)}),xj=(e,t)=>[GA(e.skyBot),vj(e),J(.3,t(e)),KA(e.ground),yj(e)],Sj=(e,t,n,r,i,a,o=0)=>[nj(e),lj(n,.14,`f`+t,{col:e.far,bias:o}),lj(r,.3,`m`+t,{col:e.mid,bias:o}),J(.46,(t,n,r,i,o,s)=>{t.fillStyle=e.ground,t.fillRect(-500,i,n+1e3,r-i+500),a&&a(e)(t,n,r,i,o,s)}),lj(i,.66,`n`+t,{col:e.near,bias:o})],Cj={window:e=>(t,n,r)=>{t.fillStyle=e.far,t.fillRect(n*.34,r*.15,n*.32,r*.34),t.fillStyle=e.skyTop,t.fillRect(n*.36,r*.17,n*.28,r*.3),t.strokeStyle=e.occluder,t.lineWidth=3,t.beginPath(),t.moveTo(n*.5,r*.17),t.lineTo(n*.5,r*.49),t.moveTo(n*.36,r*.32),t.lineTo(n*.64,r*.32),t.stroke()},monitors:e=>(t,n,r)=>{for(let i=0;i<4;i++)t.fillStyle=e.near,t.fillRect(n*(.16+i*.19),r*.24,n*.13,r*.16),t.fillStyle=e.skyTop,t.fillRect(n*(.165+i*.19),r*.25,n*.12,r*.14)},board:e=>(t,n,r)=>{t.fillStyle=`#2f5240`,t.fillRect(n*.22,r*.16,n*.56,r*.34),t.strokeStyle=e.ground,t.lineWidth=6,t.strokeRect(n*.22,r*.16,n*.56,r*.34),t.strokeStyle=`rgba(255,255,255,.4)`,t.lineWidth=2,t.beginPath(),t.moveTo(n*.28,r*.3),t.lineTo(n*.5,r*.3),t.stroke()},pegboard:e=>(t,n,r)=>{t.fillStyle=e.near;for(let e=0;e<6;e++)t.fillRect(n*(.2+e*.1),r*.2,n*.03,r*.22)},counter:e=>(t,n,r,i,a)=>{t.fillStyle=e.near,t.fillRect(-500,i-60*a,n+1e3,14*a),t.fillStyle=e.far;for(let e=0;e<4;e++)t.fillRect(n*(.2+e*.16),r*.2,n*.11,r*.16)},spotlight:e=>(e,t,n,r)=>{let i=e.createRadialGradient(t/2,r-130,20,t/2,r-130,t*.55);i.addColorStop(0,`rgba(255,250,230,.28)`),i.addColorStop(1,`rgba(255,250,230,0)`),e.fillStyle=i,e.fillRect(0,0,t,n)},perspective:e=>(t,n,r)=>{t.strokeStyle=e.near,t.lineWidth=3;for(let e=-3;e<=3;e++)t.beginPath(),t.moveTo(n/2+e*n*.16,0),t.lineTo(n/2+e*n*.04,r),t.stroke()},shelves:e=>(t,n,r,i,a)=>{t.fillStyle=e.near;for(let i=0;i<3;i++){t.fillRect(n*.14,r*(.22+i*.1),n*.72,8*a);for(let o=0;o<8;o++)t.fillStyle=e.far,t.fillRect(n*(.16+o*.088),r*(.22+i*.1)-14*a,n*.05,14*a),t.fillStyle=e.near}},panels:e=>(t,n,r)=>{for(let i=0;i<6;i++)t.fillStyle=i%2?e.far:e.near,t.globalAlpha=.8,t.fillRect(n*(.15+i*.12),r*(.2+i%2*.05),n*.09,r*.14),t.globalAlpha=1},screens:e=>(t,n,r)=>{for(let i=0;i<8;i++)t.fillStyle=[e.skyTop,e.far,e.mid][i%3],t.globalAlpha=.8,t.fillRect(n*(.1+i%4*.21),r*(.18+Math.floor(i/4)*.16),n*.17,r*.12),t.globalAlpha=1},bench:e=>(t,n,r,i,a)=>{t.fillStyle=e.near,t.fillRect(n*.3,i-90*a,n*.4,60*a),t.fillStyle=e.far,t.fillRect(n*.44,r*.2,n*.12,r*.2)},beds:e=>(t,n,r,i,a)=>{for(let r=0;r<3;r++)t.fillStyle=e.near,t.fillRect(n*(.14+r*.28),i-44*a,n*.2,44*a),t.fillStyle=`#e8edf1`,t.fillRect(n*(.14+r*.28),i-44*a,n*.2,16*a)},columns:e=>(t,n,r,i,a)=>{for(let a=0;a<5;a++)t.fillStyle=e.far,t.fillRect(n*(.1+a*.2),r*.1,n*.05,i-r*.1);t.fillStyle=e.near,t.fillRect(n*.42,i-80*a,n*.16,80*a)}},wj=cj,Tj=(e,t)=>J(.16,(n,r,i,a,o,s=0)=>{let c=oO(`cl`+t);n.fillStyle=e.far;for(let e=0;e<6;e++){let t=c()*r+Math.sin(s*.1+e)*10,a=i*(.12+c()*.3),l=(24+c()*26)*o;n.globalAlpha=.85,n.beginPath(),n.arc(t,a,l,0,7),n.arc(t+l,a+4,l*.8,0,7),n.arc(t-l,a+4,l*.8,0,7),n.fill()}n.globalAlpha=1}),Ej=(e,t)=>J(.1,(n,r,i)=>{let a=oO(`st`+t);n.fillStyle=`#fdfbe8`;for(let e=0;e<90;e++)n.globalAlpha=.4+a()*.6,n.fillRect(a()*r,a()*i*.8,2,2);n.globalAlpha=1,n.fillStyle=e.near,n.beginPath(),n.arc(r*.76,i*.3,54,0,7),n.fill(),n.fillStyle=e.far,n.globalAlpha=.5,n.beginPath(),n.arc(r*.72,i*.26,54,0,7),n.fill(),n.globalAlpha=1}),Dj=(e,t,n,r,i)=>J(e,(e,t,a,o,s,c=0)=>{let l=oO(`cw`+n);e.fillStyle=r;for(let n=0;n<22;n++){let r=l()*(t+80)-40,a=(i+l()*20)*s,u=Math.sin(c*1.2+n)*2;e.fillRect(r+u,o-a,15*s,a),e.beginPath(),e.arc(r+u+7.5*s,o-a,9*s,0,7),e.fill()}}),Oj=(e,t,n,r)=>J(e,(e,i,a,o,s)=>{oO(`mk`+n);for(let n=0;n<r;n++){let a=40+i/r*n;e.fillStyle=[t.far,t.mid,t.near][n%3],e.fillRect(a,o-80*s,i/r*.7,18*s),e.fillStyle=t.near,e.fillRect(a+4*s,o-62*s,6*s,62*s),e.fillRect(a+i/r*.7-10*s,o-62*s,6*s,62*s)}}),kj={genericRoom:e=>xj(e,Cj.window),office:e=>xj(e,Cj.monitors),classroom:e=>xj(e,Cj.board),workshop:e=>xj(e,Cj.pegboard),kitchen:e=>xj(e,Cj.counter),stagePodium:e=>xj(e,Cj.spotlight),corridor:e=>xj(e,Cj.perspective),storeInterior:e=>xj(e,Cj.shelves),labGeneric:e=>xj(e,Cj.panels),controlRoom:e=>xj(e,Cj.screens),street:(e,t,n)=>Sj(e,t,wj.city[0],wj.city[1],[`skyline`,60,90],e=>(e,t,n,r,i)=>{e.strokeStyle=`#e6c34a`,e.lineWidth=3*i,e.setLineDash([20*i,18*i]),e.beginPath(),e.moveTo(-500,r+(n-r)*.5),e.lineTo(t+500,r+(n-r)*.5),e.stroke(),e.setLineDash([])},n),park:(e,t,n)=>Sj(e,t,wj.field[0],[`tree`,60,40],[`tree`,46,30],null,n),forest:(e,t,n)=>Sj(e,t,[`tree`,70,50],[`tree`,60,44],[`tree`,50,34],null,n),mountain:(e,t,n)=>Sj(e,t,wj.ridge[0],wj.ridge[1],wj.ridge[2],null,n),desertPlain:(e,t,n)=>Sj(e,t,wj.dunes[0],wj.dunes[1],wj.dunes[2],null,n),coastBeach:(e,t,n)=>Sj(e,t,wj.coast[0],[`water`,0,0],wj.coast[2],null,n),farmField:(e,t,n)=>Sj(e,t,wj.field[0],wj.field[1],wj.field[2],e=>(t,n,r,i,a)=>{t.strokeStyle=e.near,t.lineWidth=2*a;for(let e=0;e<6;e++)t.beginPath(),t.moveTo(-500,i+e*18*a),t.lineTo(n+500,i+e*18*a),t.stroke()},n),skylineWide:(e,t,n)=>Sj(e,t,[`skyline`,90,150],[`skyline`,110,130],[`skyline`,70,100],null,n),rooftop:(e,t,n)=>Sj(e,t,[`skyline`,80,140],[`skyline`,100,120],[`skyline`,60,90],null,n),roadHighway:(e,t,n)=>Sj(e,t,wj.field[0],[`rolling`,30,40],wj.field[2],e=>(e,t,n,r,i)=>{e.fillStyle=`#5c636e`,e.beginPath(),e.moveTo(t*.38,r),e.lineTo(t*.5,n),e.lineTo(t*.62,r),e.fill(),e.strokeStyle=`#eef2f4`,e.lineWidth=3*i,e.setLineDash([26*i,22*i]),e.beginPath(),e.moveTo(t*.5,r),e.lineTo(t*.5,n),e.stroke(),e.setLineDash([])},n),oceanSurface:(e,t,n)=>[nj(e),lj(wj.coast[0],.14,`f`+t,{col:e.far,bias:n}),sj(.4,e.mid),KA(e.ground)],underwater:(e,t)=>[bj(e.skyTop,e.occluder),J(.2,(e,n,r)=>{let i=oO(`uw`+t);e.fillStyle=`rgba(255,255,255,.16)`;for(let t=0;t<26;t++)e.beginPath(),e.arc(i()*n,i()*r,2+i()*6,0,7),e.fill()}),KA(e.ground)],skyClouds:(e,t)=>[nj(e),Tj(e,t),Tj(e,t+`b`)],spacePlanet:(e,t)=>[bj(e.skyTop,e.skyBot),Ej(e,t)],arcticIce:(e,t,n)=>Sj(e,t,[`jagged`,90,120],[`jagged`,70,80],[`jagged`,50,40],null,n),studioPlain:e=>[bj(e.skyBot,sO(e.skyBot,.92))],gradientAbstract:e=>[bj(e.skyTop,e.mid,!0)],gridBoard:e=>[GA(e.skyBot),J(.2,(e,t,n,r,i)=>{e.strokeStyle=`rgba(0,0,0,.08)`,e.lineWidth=1;for(let r=0;r<t;r+=40*i)e.beginPath(),e.moveTo(r,0),e.lineTo(r,n),e.stroke();for(let r=0;r<n;r+=40*i)e.beginPath(),e.moveTo(0,r),e.lineTo(t,r),e.stroke()})],mapStage:(e,t)=>[GA(e.skyBot),J(.2,(n,r,i)=>{let a=oO(`mp`+t);n.fillStyle=e.mid,n.globalAlpha=.8,n.beginPath(),n.moveTo(r*.2,i*.3);for(let e=0;e<10;e++)n.lineTo(r*(.2+a()*.6),i*(.2+a()*.6));n.closePath(),n.fill(),n.globalAlpha=1})],chartStage:e=>[GA(e.skyBot),J(.2,(t,n,r)=>{t.strokeStyle=e.near,t.lineWidth=2,t.beginPath(),t.moveTo(n*.15,r*.2),t.lineTo(n*.15,r*.8),t.lineTo(n*.85,r*.8),t.stroke()})],timelineBand:e=>[GA(e.skyBot),J(.3,(t,n,r)=>{t.fillStyle=e.mid,t.globalAlpha=.5,t.fillRect(0,r*.46,n,r*.08),t.globalAlpha=1})],splitVersus:e=>[J(0,(t,n,r)=>{t.fillStyle=e.skyTop,t.fillRect(0,0,n/2,r),t.fillStyle=e.mid,t.fillRect(n/2,0,n/2,r),t.strokeStyle=e.near,t.lineWidth=3,t.beginPath(),t.moveTo(n/2,0),t.lineTo(n/2,r),t.stroke()})],iconField:(e,t)=>[GA(e.skyBot),J(.2,(n,r,i)=>{let a=oO(`if`+t);n.fillStyle=e.mid,n.globalAlpha=.4;for(let e=0;e<24;e++)n.beginPath(),n.arc(a()*r,a()*i,10,0,7),n.fill();n.globalAlpha=1})],blueprint:e=>[GA(e.occluder),J(.2,(e,t,n,r,i)=>{e.strokeStyle=`rgba(255,255,255,.22)`,e.lineWidth=1;for(let r=0;r<t;r+=34*i)e.beginPath(),e.moveTo(r,0),e.lineTo(r,n),e.stroke();for(let r=0;r<n;r+=34*i)e.beginPath(),e.moveTo(0,r),e.lineTo(t,r),e.stroke()})],spotlightDark:e=>[GA(e.occluder),J(.1,(e,t,n,r)=>{let i=e.createRadialGradient(t/2,r-120,30,t/2,r-120,t*.6);i.addColorStop(0,`rgba(255,255,255,.16)`),i.addColorStop(1,`rgba(255,255,255,0)`),e.fillStyle=i,e.fillRect(0,0,t,n)}),KA(e.near)],crowdScene:(e,t)=>[nj(e),Dj(.2,e,t+`a`,e.far,40),KA(e.ground),Dj(.55,e,t+`b`,e.near,54)],marketplace:(e,t,n)=>[nj(e),lj([`skyline`,60,80],.14,`f`+t,{col:e.far,bias:n}),KA(e.ground),Oj(.5,e,t,5)],constructionSite:(e,t,n)=>[nj(e),lj([`skyline`,70,110],.14,`f`+t,{col:e.far,bias:n}),KA(e.ground),J(.5,(e,t,n,r,i)=>{e.strokeStyle=`#e0a52e`,e.lineWidth=6*i,e.strokeRect(t*.3,r-200*i,6*i,200*i),e.beginPath(),e.moveTo(t*.3,r-200*i),e.lineTo(t*.58,r-200*i),e.stroke(),e.beginPath(),e.moveTo(t*.55,r-200*i),e.lineTo(t*.55,r-120*i),e.stroke()})],harborDock:(e,t,n)=>[nj(e),lj([`skyline`,60,90],.14,`f`+t,{col:e.far,bias:n}),sj(.4,e.mid),KA(e.ground)],weatherStorm:(e,t)=>[bj(e.occluder,e.mid),J(.2,(e,n,r)=>{let i=oO(`ws`+t);e.strokeStyle=`rgba(220,230,240,.35)`,e.lineWidth=2;for(let t=0;t<50;t++){let t=i()*n,a=i()*r;e.beginPath(),e.moveTo(t,a),e.lineTo(t-6,a+18),e.stroke()}}),KA(e.near)],stadium:(e,t)=>[nj(e),J(.14,(t,n,r,i,a)=>{t.fillStyle=e.far;for(let e=0;e<4;e++)t.fillRect(-500,i-(140-e*30)*a,n+1e3,26*a)}),Dj(.3,e,t,e.mid,18),KA(e.ground)],courtroomGeneric:e=>xj(e,Cj.bench),hospitalWard:e=>xj(e,Cj.beds),throneHall:e=>xj(e,Cj.columns),cave:e=>[GA(e.occluder),J(.2,(t,n,r,i)=>{let a=t.createRadialGradient(n/2,i-80,40,n/2,i-80,n*.5);a.addColorStop(0,e.skyBot),a.addColorStop(1,e.occluder),t.fillStyle=a,t.beginPath(),t.ellipse(n/2,i-40,n*.3,r*.4,0,0,7),t.fill()}),KA(e.near)],ruins:(e,t,n)=>[nj(e),lj([`rolling`,50,90],.14,`f`+t,{col:e.far,bias:n}),J(.4,(n,r,i,a,o)=>{let s=oO(`ru`+t);n.fillStyle=e.mid;for(let e=0;e<5;e++){let t=(60+s()*90)*o;n.fillRect(r*(.12+e*.19),a-t,20*o,t)}}),KA(e.ground)],rooftopNight:(e,t,n)=>Sj(e,t,[`skyline`,100,160],[`skyline`,120,140],[`skyline`,70,100],null,n),marketStreetDense:(e,t)=>[nj(e),lj([`skyline`,70,110],.14,`f`+t,{col:e.far}),Oj(.3,e,t+`a`,6),KA(e.ground),Oj(.58,e,t+`b`,4)]},Aj=Object.keys(kj),Object.keys(kj).forEach(e=>{let t=kj[e];UA[e]=(n=7,r=`day`)=>{let i=XA[r]||XA.day,a=(mj[e]||{}).bias||0;return[...t(i,`:`+r+n,a),...hj(e,i)]}}),jj=e=>Object.prototype.hasOwnProperty.call(kj,e)||Object.prototype.hasOwnProperty.call(gj,e),Object.assign(UA,{mapBoard:uA,warRoomTable:dA}),Mj=[`groundL`,`groundC`,`groundR`,`midL`,`midR`,`skyL`,`skyR`,`skyBand`],Nj={plain:[`center.c`],skyDay:[`sky.c`,`ground.c`],skyNight:[`sky.c`,`ground.c`],city:[`ground.c`,`wall.a`,`wall.b`],nature:[`ground.c`,`tree.a`],interior:[`wall.a`,`wall.b`,`wall.c`,`table.c`],abstract:[`center.c`],dioramaDay:Mj,dioramaDusk:Mj,dioramaNight:Mj,dioramaDesert:Mj,dioramaArctic:Mj,mapBoard:[`center.c`],warRoomTable:[`tableFrontL`,`tableFrontR`,`tableBack`,`tableMap`]},_j.forEach(e=>{Nj[e]=Mj}),Aj.forEach(e=>{Nj[e]=Mj}),Pj={plain:`light`,skyDay:`light`,skyNight:`dark`,city:`light`,nature:`light`,interior:`light`,abstract:`dark`,stagePodium:`dark`,controlRoom:`dark`,underwater:`dark`,spacePlanet:`dark`,blueprint:`dark`,spotlightDark:`dark`,weatherStorm:`dark`,gradientAbstract:`dark`,dioramaDay:`light`,dioramaDusk:`light`,dioramaNight:`dark`,dioramaDesert:`light`,dioramaArctic:`light`,mapBoard:`dark`,warRoomTable:`dark`},Fj={"center.c":{x:.5,y:300,z:.5},"ground.c":{x:.5,y:520,z:.5},"table.c":{x:.5,y:470,z:.42},"wall.a":{x:.28,y:180,z:.62},"wall.b":{x:.5,y:168,z:.62},"wall.c":{x:.72,y:180,z:.62},"sky.c":{x:.5,y:120,z:.85},"tree.a":{x:.72,y:430,z:.55},left:{x:.2,y:300,z:.5},right:{x:.8,y:300,z:.5},hover:{x:.5,y:250,z:.5},lowerThird:{x:.5,y:500,z:.5},skyBand:{x:.5,y:110,z:.9},groundL:{x:.22,y:500,z:.45},groundC:{x:.5,y:500,z:.45},groundR:{x:.78,y:500,z:.45},midL:{x:.3,y:430,z:.62},midR:{x:.7,y:430,z:.62},skyL:{x:.28,y:150,z:.82},skyR:{x:.72,y:150,z:.82},tableFrontL:{x:.4,y:560,z:.42},tableFrontR:{x:.6,y:560,z:.42},tableBack:{x:.5,y:470,z:.6},tableMap:{x:.5,y:500,z:.45}},Ij=[`center.c`,`ground.c`,`left`,`right`],Lj=Object.keys(UA),Rj=e=>Object.prototype.hasOwnProperty.call(UA,e)||MA(e),zj=e=>e<=.12?`sky`:e<=.3?`back`:e<=.5?`mid`:`near`}));function Vj(e,t,n){let r=typeof e==`string`?e:e&&e.type,i=Yj[r];return i?i(typeof e==`object`?e:{type:r},t,n):``}var Hj,Uj,Wj,Gj,Kj,qj,Jj,Yj,Xj=o((()=>{pO(),Hj=640,Uj=Math.sin,Wj=Math.cos,Gj=Math.floor,Kj=e=>{let t=Uj(e*127.1)*43758.5453;return t-Gj(t)},qj=[`rain`,`snow`,`wind`,`fog`,`heatShimmer`,`lightning`],Jj=e=>e.intensity===`storm`||typeof e.intensity==`number`&&e.intensity>.6,Yj={rain(e,t,n){let r=Jj(e),i=r?92:54,a=r?34:24,o=r?1180:820,s=r?9:4,c=``;for(let e=0;e<i;e++){let r=Kj(e)*(n+80)-40,i=(Kj(e+9)*700+t*o)%700-30,l=r+i/Hj*s*3;c+=`M${l.toFixed(1)} ${i.toFixed(1)} l${s} ${a} `}let l=``;for(let e=0;e<(r?16:9);e++){let r=Kj(e+40)*n,i=(t*3+Kj(e+40)*5)%1,a=i*11;l+=`<circle cx="${r.toFixed(1)}" cy="598" r="${a.toFixed(1)}" fill="none" stroke="rgba(200,220,235,${(.5*(1-i)).toFixed(2)})" stroke-width="1.5"/>`}return`${r?`<rect x="0" y="0" width="${n}" height="${Hj}" fill="#20303f" opacity="0.16"/>`:``}<path d="${c}" stroke="rgba(190,214,232,${r?.52:.4})" stroke-width="${r?2:1.5}" stroke-linecap="round"/>${l}`},snow(e,t,n){let r=Jj(e)?96:68,i=``;for(let e=0;e<r;e++){let r=(Kj(e+3)*680+t*(56+Kj(e)*64))%680-20,a=Kj(e+7)*n+Uj(t*(.6+Kj(e))+e)*18,o=1.5+Kj(e+5)*2.4;i+=`<circle cx="${a.toFixed(1)}" cy="${r.toFixed(1)}" r="${o.toFixed(1)}" fill="rgba(255,255,255,${(.55+Kj(e+1)*.4).toFixed(2)})"/>`}return`<rect x="0" y="0" width="${n}" height="${Hj}" fill="#dfeaf2" opacity="0.10"/><rect x="0" y="614" width="${n}" height="26" fill="#f2f7fb" opacity="0.5"/>${i}`},wind(e,t,n){let r=n+140,i=``;for(let e=0;e<28;e++){let n=(Kj(e+2)*r+t*(250+Kj(e)*180))%r-70,a=110+Kj(e+4)*410+Uj(t*3+e)*16,o=(t*200+e*63)%360;i+=`<g transform="translate(${n.toFixed(1)} ${a.toFixed(1)}) rotate(${o.toFixed(0)})"><path d="M0 0 q6 -5 12 0 q-6 5 -12 0Z" fill="${[`#c98b52`,`#9bb06a`,`#b9863f`][e%3]}" opacity="0.85"/></g>`}let a=``;for(let e=0;e<6;e++){let r=90+Hj/7*e,i=(t*420+e*210)%(n+320)-160;a+=`<path d="M${i.toFixed(1)} ${r.toFixed(1)} q60 -8 140 0" stroke="rgba(232,237,242,0.22)" stroke-width="2" fill="none"/>`}return a+i},fog(e,t,n){let r=Uj(t*.3)*34,i=Wj(t*.22)*44,a=Jj(e)?.4:.28;return`<rect x="0" y="0" width="${n}" height="${Hj}" fill="#c9d4dc" opacity="${a.toFixed(2)}"/><ellipse cx="${(n*.35+r).toFixed(1)}" cy="${Hj*.72}" rx="${(n*.6).toFixed(0)}" ry="120" fill="#dde5eb" opacity="0.35"/><ellipse cx="${(n*.7+i).toFixed(1)}" cy="${Hj*.86}" rx="${(n*.7).toFixed(0)}" ry="150" fill="#eef3f6" opacity="0.4"/>`},heatShimmer(e,t,n){let r=``;for(let e=0;e<9;e++){let i=Hj*.48+e*18,a=Uj(t*3+e*.7)*7;r+=`<rect x="${a.toFixed(1)}" y="${i.toFixed(0)}" width="${n}" height="11" fill="rgba(255,246,214,0.06)"/>`}return r},lightning(e,t,n){let r=3.2,i=t%r/r;if(i>.16)return``;let a=K(i<.05?i/.05:1-(i-.05)/.11,0,1),o=``;if(i<.09){let e=n*(.3+Kj(Gj(t/r))*.4),i=`M${e.toFixed(1)} 0`,s=0,c=e;for(;s<Hj*.62;)s+=40+Kj(s)*30,c+=(Kj(s+1)-.5)*64,i+=` L${c.toFixed(1)} ${s.toFixed(1)}`;o=`<path d="${i}" stroke="#fdfbef" stroke-width="3" fill="none" opacity="${a.toFixed(2)}"/>`}return`<rect x="0" y="0" width="${n}" height="${Hj}" fill="#f4f2e2" opacity="${(a*.5).toFixed(2)}"/>${o}`}}}));function Zj(e){let t=e>>>0;return function(){t|=0,t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}function Qj(e,t,n,r,i){let a=i*i,o=a*i;return .5*(2*t+(-e+n)*i+(2*e-5*t+4*n-r)*a+(-e+3*t-3*n+r)*o)}function $j(e,t,n,r){let i=e[Math.max(0,t-1)][r],a=e[t][r],o=e[Math.min(e.length-1,t+1)][r],s=e[Math.min(e.length-1,t+2)][r];return Qj(i,a,o,s,n)}function eM(e,t){let n=[...e].sort((e,t)=>e.time-t.time);if(!n.length)throw Error(`PanMaster requires at least one camera point.`);return n[0].time>0&&n.unshift({...n[0],time:0}),n[n.length-1].time<t&&n.push({...n[n.length-1],time:t}),n.map((e,t)=>({time:e.time,x:e.x??0,y:e.y??0,scale:e.scale??1,rotation:e.rotation??0,subjectId:e.subjectId??null,ease:e.ease||`smoother`,index:t}))}function tM({duration:e=5,subjects:t=[],seed:n=1,viewW:r=1920,viewH:i=1080,worldW:a=2800,worldH:o=1700,style:s=`editorial`,styleCustom:c=null}={}){let l=Zj(n),u=r*.22,d=i*.2,f={editorial:{zoom:[1,1.22],rot:[-1.2,1.2],wander:150},calm:{zoom:[1.02,1.14],rot:[-.6,.6],wander:90},energetic:{zoom:[1.04,1.32],rot:[-2.2,2.2],wander:210},dramatic:{zoom:[1.08,1.42],rot:[-2.8,2.8],wander:170}},p=s===`custom`&&c?{zoom:c.zoom,rot:c.rot,wander:c.wander}:f[s]||f.editorial,m=t.length?t:[{id:`center`,x:a/2,y:o/2,importance:1}],h=Math.max(4,Math.min(7,Math.round(e*1.05))),g=[];for(let t=0;t<h;t++){let n=t/(h-1),r=m[t%m.length],i=t%2==0?1:-1,s=Math.sin(n*Math.PI*1.7)*p.wander*i,c=(l()-.5)*p.wander*.55,f=(l()-.5)*p.wander*.38,_=sM(r.x+s+c,u,a-u),v=sM(r.y+Math.cos(n*Math.PI*1.6)*p.wander*.42+f,d,o-d),y=Math.sin(n*Math.PI*2.1)*.5+.5,b=cM(p.zoom[0],p.zoom[1],.28+.72*y)*(r.importance||1),x=cM(p.rot[0],p.rot[1],l());g.push({time:n*e,x:_,y:v,scale:b,rotation:x,subjectId:r.id})}return g[0].scale=Math.min(g[0].scale,1.08),g[g.length-1].rotation*=.25,{duration:e,points:eM(g,e),viewW:r,viewH:i,worldW:a,worldH:o,seed:n,style:s}}function nM(e,t){let n=e.points,r=e.duration,i=sM(t,0,r),a=0;for(;a<n.length-2&&i>n[a+1].time;)a++;let o=n[a],s=n[Math.min(a+1,n.length-1)],c=Math.max(1e-4,s.time-o.time),l=sM((i-o.time)/c);return l=o.ease===`linear`?l:o.ease===`smooth`?lM(l):uM(l),{x:$j(n,a,l,`x`),y:$j(n,a,l,`y`),scale:$j(n,a,l,`scale`),rotation:$j(n,a,l,`rotation`),subjectId:l<.5?o.subjectId:s.subjectId,progress:i/r}}function rM(e,t=1,n=1920,r=1080){let i=sM(t,0,1.6),a=1+(e.scale-1)*i,o=cM(n/2,e.x,i),s=cM(r/2,e.y,i),c=e.rotation*i*.55;return`translate(${n/2} ${r/2}) rotate(${-c}) scale(${a}) translate(${-o} ${-s})`}function iM({duration:e,points:t=[],viewW:n=1920,viewH:r=1080,worldW:i=2800,worldH:a=1700,zoomMin:o=dM,zoomMax:s=3}){let c=[];for(let e of t){let t=sM(e.zoom==null?e.scale==null?1:e.scale:e.zoom,o,s),n={time:e.time,x:e.x,y:e.y,scale:t,rotation:e.rotation||0,ease:e.ease||`smoother`,subjectId:e.subjectId??null};c.push(n),e.hold&&c.push({...n,time:e.time+e.hold})}let l=e??Math.max(...c.map(e=>e.time),.001);return{duration:l,points:eM(c,l),viewW:n,viewH:r,worldW:i,worldH:a,mode:`manual`}}function aM(e,t=[]){let n=tM(e),r=n.points.map(e=>({time:e.time,x:e.x,y:e.y,zoom:e.scale,rotation:e.rotation,ease:e.ease,subjectId:e.subjectId}));return t.forEach(e=>{e.index!=null&&r[e.index]&&Object.assign(r[e.index],e)}),iM({duration:n.duration,points:r,viewW:n.viewW,viewH:n.viewH,worldW:n.worldW,worldH:n.worldH})}function oM(e,t={}){let n=t.worldW==null?e.worldW||2800:t.worldW,r=t.worldH==null?e.worldH||1700:t.worldH,i=t.viewW==null?e.viewW||1920:t.viewW,a=t.viewH==null?e.viewH||1080:t.viewH,o=e.duration==null?t.duration:e.duration;return e.mode===`manual`?iM({duration:o,points:e.points||[],viewW:i,viewH:a,worldW:n,worldH:r,zoomMin:e.zoomMin,zoomMax:e.zoomMax}):e.mode===`hybrid`?aM({duration:o,subjects:e.subjects||t.subjects||[],seed:e.seed||1,viewW:i,viewH:a,worldW:n,worldH:r,style:e.style||`editorial`,styleCustom:e.styleCustom},e.edits||[]):tM({duration:o,subjects:e.subjects||t.subjects||[],seed:e.seed||1,viewW:i,viewH:a,worldW:n,worldH:r,style:e.style||`editorial`,styleCustom:e.styleCustom})}var sM,cM,lM,uM,dM,fM=o((()=>{sM=(e,t=0,n=1)=>Math.max(t,Math.min(n,e)),cM=(e,t,n)=>e+(t-e)*n,lM=e=>e*e*(3-2*e),uM=e=>e*e*e*(e*(e*6-15)+10),dM=.5}));function pM(e){let t=e.type,n=jM.includes(t)?null:e.swapWindow||IM[t]||[.45,.55];return{type:t,durationMs:e.durationMs==null?1200:e.durationMs,ease:MM.includes(e.ease)?e.ease:`smoother`,direction:e.direction||LM[t]||`L2R`,colorMode:e.colorMode||`bridge`,colors:e.colors||[],swapWindow:n,carrySubject:e.carrySubject||null,params:{...FM[t]||{},...e.params||{}}}}function mM(e,t,n=0){let r=t.bridge&&t.bridge[0]||`#141c24`,i=t.bridge&&t.bridge[1]||`#0d1220`;return e.colorMode===`custom`&&e.colors.length?e.colors[CM(n,e.colors.length-1)]:e.colorMode===`token`?`#0d1220`:e.colorMode===`incoming`?i:cO(r,i,.5)}function hM(e,t,n){let r=t>0?K(e/t,0,1):1,i=n<1?K((e-n)/(1-n),0,1):0;return CM(r,1-i)}function gM(e,t,n,r,i,a=1){return`<rect x="${e.toFixed(1)}" y="${t.toFixed(1)}" width="${n.toFixed(1)}" height="${r.toFixed(1)}" fill="${i}" opacity="${a}"/>`}function _M(e,t,n,r){if(!e.carrySubject)return null;let i=n.subjectFrom||{x:r*.5,y:Y*.6},a=n.subjectTo||{x:r*.5,y:Y*.6};return{x:lO(i.x,a.x,t),y:lO(i.y,a.y,t)}}function vM(e,t,n={}){let r=pM(e),i=n.VBW||1138,a=K(t,0,1),o=PM[r.ease](a),s=RM[r.type],c=s?s(r,o,a,n,i):{svg:``,alpha:0},l,u,d=1,f=1,p=null,m=null,h=null,g=null;if(r.swapWindow)h=r.swapWindow[0],l=a<h,u=a>=h;else if(r.type===`fade`)l=!0,u=!0,d=1-o,f=o;else{l=!0,u=!0;let e=r.direction===`R2L`||r.direction===`B2T`?-1:1,t=(HM[r.type]||HM.carryTravel)(o,e,i,Y,r.params,n.subject);p=t.fromT,m=t.toT,g={blur:t.blur||0,flip:!!t.flip,split:t.split,axis:t.axis,over:!!t.over,shadow:!!t.shadow,dir:e},t.flip&&(l=a<.5,u=a>=.5)}return{resolved:r,cover:c.svg,coverAlpha:c.alpha,fromShown:l,toShown:u,fromOpacity:d,toOpacity:f,fromTransform:p,toTransform:m,motion:g,swapWindow:r.swapWindow,swapAt:h,subject:_M(r,o,n,i)}}var Y,yM,bM,xM,SM,CM,wM,TM,EM,DM,OM,kM,AM,jM,MM,NM,PM,FM,IM,LM,RM,zM,BM,VM,HM,UM=o((()=>{pO(),Y=640,yM=Math.sin,bM=Math.cos,xM=Math.PI,SM=Math.hypot,CM=Math.min,wM=Math.max,TM=.1,EM=[`fade`,`irisObject`,`strokeSweep`,`slabWipe`,`curtainFall`,`lightWash`,`bandWipe`,`carryTravel`],DM=[`blindsFlip`,`checkerFlip`,`inkBlot`,`smokeConceal`,`particleStorm`,`paperTear`,`shapeStampede`,`typeMask`,`silhouetteWalkWipe`,`pushOff`,`slideOver`,`splitBarn`,`whipPan`,`spinCard`,`zoomThrough`,`pullBackReveal`,`elevatorRise`],OM=[`flashImpact`,`dipToColor`,`silhouettePass`,`dayNightSweep`,`spotlightShift`,`matchMorph`,`pixelMosaic`,`lineArtRebuild`,`stackShuffle`,`ripplePortal`,`doorPass`,`waveCrash`,`pageFlip`,`lightSpeedStreak`,`glitchCut`],kM=[...EM,...DM,...OM],AM=[`carryTravel`,`pushOff`,`slideOver`,`splitBarn`,`whipPan`,`spinCard`,`zoomThrough`,`pullBackReveal`,`elevatorRise`,`stackShuffle`],jM=[`fade`,...AM],MM=[`linear`,`smooth`,`smoother`],NM=e=>kM.includes(e),PM={linear:e=>e,smooth:e=>e*e*(3-2*e),smoother:e=>e*e*e*(e*(e*6-15)+10)},FM={fade:{mode:`direct`},irisObject:{shape:`circle`,origin:`center`,grow:`out`},strokeSweep:{pathPreset:`arc`,glow:!0},slabWipe:{edge:`straight`},curtainFall:{pairedPaletteShift:!0},lightWash:{mode:`radial`,origin:`center`},bandWipe:{bands:3,staggerPct:.08,slantDeg:14,edgeProfile:`straight`},carryTravel:{vector:`L2R`,ms:1200},blindsFlip:{slats:8,axis:`h`},checkerFlip:{grid:6,order:`sweep`},inkBlot:{blobs:3,wobble:.25},smokeConceal:{density:1},particleStorm:{particleType:`confetti`},paperTear:{tearJaggedness:22},shapeStampede:{iconRef:`coin`,count:40},typeMask:{text:`NEXT`},silhouetteWalkWipe:{castRef:null,scale:1,action:`walk`},pushOff:{},slideOver:{shadowEdge:!0},splitBarn:{axis:`v`},whipPan:{blurPx:9},spinCard:{axis:`y`,perspectiveFake:!0},zoomThrough:{targetElement:null,overshoot:1},pullBackReveal:{frameElement:null},elevatorRise:{},flashImpact:{tint:`#ffffff`},dipToColor:{color:null,holdMs:200},silhouettePass:{holdMs:200},dayNightSweep:{},spotlightShift:{origin:`subject`},matchMorph:{fromRef:null,toRef:null},pixelMosaic:{blockPx:48,order:`random`},lineArtRebuild:{strokeColor:`#243038`},stackShuffle:{cardShadow:!0},ripplePortal:{origin:`center`,rings:5},doorPass:{portalElement:null},waveCrash:{foam:!0},pageFlip:{corner:`tr`},lightSpeedStreak:{streakColor:`#bcd4ff`},glitchCut:{intensity:1}},IM={irisObject:[.42,.58],strokeSweep:[.44,.56],slabWipe:[.46,.56],curtainFall:[.46,.56],lightWash:[.42,.58],bandWipe:[.48,.62]},LM={curtainFall:`T2B`,bandWipe:`L2R`,slabWipe:`L2R`,carryTravel:`L2R`},RM={fade(e,t,n,r,i){if(e.params.mode===`toColor`){let t=yM(K(n,0,1)*xM),a=i*TM;return{svg:gM(-a,-64,i+2*a,768,e.colors[0]||mM(e,r),t),alpha:t}}return{svg:``,alpha:0}},irisObject(e,t,n,r,i){let a=e.swapWindow[0],o=e.swapWindow[1],s=hM(n,a,o),c=mM(e,r),l=e.params.origin===`subject`&&r.subject?r.subject:{x:i/2,y:Y/2},u=SM(i,Y)*.5*1.2,d=(e.params.grow===`in`?1-s:s)*u;if(e.params.shape!==`circle`){let e=d/120;return{svg:`<path transform="translate(${l.x.toFixed(1)} ${l.y.toFixed(1)}) scale(${e.toFixed(3)})" d="M0 -120 C70 -120 120 -60 120 10 C120 80 60 120 0 120 C-60 120 -120 80 -120 10 C-120 -60 -70 -120 0 -120 Z" fill="${c}"/>`,alpha:s}}return{svg:`<circle cx="${l.x.toFixed(1)}" cy="${l.y.toFixed(1)}" r="${d.toFixed(1)}" fill="${c}"/>`,alpha:s}},strokeSweep(e,t,n,r,i){let a=e.swapWindow[0],o=e.swapWindow[1],s=hM(n,a,o),c=mM(e,r),l=s*SM(i,Y)*1.15,u=e.params.pathPreset,d=u===`S`?`M -60 ${Y*.2} C ${i*.4} 0, ${i*.6} ${Y} , ${i+60} ${Y*.8}`:u===`bolt`?`M -60 ${Y*.1} L ${i*.45} ${Y*.5} L ${i*.35} ${Y*.55} L ${i+60} ${Y*.95}`:u===`wave`?`M -60 ${Y/2} Q ${i*.25} ${Y*.1}, ${i*.5} ${Y/2} T ${i+60} ${Y/2}`:`M -60 ${Y*.85} Q ${i/2} -224, ${i+60} ${Y*.85}`;return{svg:(e.params.glow?`<path d="${d}" fill="none" stroke="${c}" stroke-width="${(l*1.25).toFixed(1)}" stroke-linecap="round" opacity="0.35"/>`:``)+`<path d="${d}" fill="none" stroke="${c}" stroke-width="${l.toFixed(1)}" stroke-linecap="round"/>`,alpha:s}},slabWipe(e,t,n,r,i){let a=e.swapWindow[0],o=e.swapWindow[1],s=a>0?K(n/a,0,1):1,c=o<1?K((n-o)/(1-o),0,1):0,l=mM(e,r),u=e.direction!==`T2B`&&e.direction!==`B2T`,d=e.direction===`R2L`||e.direction===`B2T`,f=s,p=c,m=d?1-f:p,h=d?1-p:f,g=e.params.edge===`rounded`?26:0,_=i*TM,v=f-p;if(u){let e=m<=1e-6?-_:m*i,t=h>=1-1e-6?i+_:h*i;return{svg:`<rect x="${e.toFixed(1)}" y="${(-64).toFixed(1)}" width="${(t-e).toFixed(1)}" height="${768 .toFixed(1)}" rx="${g}" fill="${l}"/>`,alpha:v}}let y=m<=1e-6?-64:m*Y,b=h>=1-1e-6?704:h*Y;return{svg:`<rect x="${(-_).toFixed(1)}" y="${y.toFixed(1)}" width="${(i+2*_).toFixed(1)}" height="${(b-y).toFixed(1)}" rx="${g}" fill="${l}"/>`,alpha:v}},curtainFall(e,t,n,r,i){let a=e.swapWindow[0],o=e.swapWindow[1],s=a>0?K(n/a,0,1):1,c=o<1?K((n-o)/(1-o),0,1):0,l=e.direction===`B2T`,u=e.params.pairedPaletteShift?cO(mM(e,r),`#0a1020`,.4):mM(e,r),d=s,f=c,p=l?1-d:f,m=l?1-f:d,h=i*TM,g=p<=1e-6?-64:p*Y,_=m>=1-1e-6?704:m*Y;return{svg:`<rect x="${(-h).toFixed(1)}" y="${CM(g,_).toFixed(1)}" width="${(i+2*h).toFixed(1)}" height="${Math.abs(_-g).toFixed(1)}" fill="${u}"/>`,alpha:s-c}},lightWash(e,t,n,r,i){let a=e.swapWindow[0],o=e.swapWindow[1],s=hM(n,a,o),c=e.colors[0]||mM(e,r),l=i*TM;if(e.params.mode===`linear`)return{svg:gM(-l,-64,i+2*l,768,c,s),alpha:s};let u=e.params.origin===`subject`&&r.subject?r.subject:{x:i/2,y:Y/2},d=SM(i,Y)*(.34+.75*s);return{svg:`<defs><radialGradient id="lw" cx="${(u.x/i).toFixed(3)}" cy="${(u.y/Y).toFixed(3)}" r="0.8"><stop offset="0" stop-color="${c}" stop-opacity="${s.toFixed(3)}"/><stop offset="1" stop-color="${c}" stop-opacity="${(s*s).toFixed(3)}"/></radialGradient></defs><circle cx="${u.x.toFixed(1)}" cy="${u.y.toFixed(1)}" r="${d.toFixed(1)}" fill="url(#lw)"/>${gM(-l,-64,i+2*l,768,c,s*s*.9)}`,alpha:s}},bandWipe(e,t,n,r,i){let a=e.swapWindow[0],o=e.swapWindow[1],s=K(e.params.bands|0||3,2,5),c=e.params.staggerPct||.08,l=(e.params.slantDeg||0)*xM/180,u=Math.tan(l)*Y,d=o<1?K((n-o)/(1-o),0,1):0,f=r.bridge&&r.bridge[0]||`#141c24`,p=r.bridge&&r.bridge[1]||`#0d1220`,m=i*TM,h=768/s,g=``,_=1;for(let t=0;t<s;t++){let r=t*c,o=a-r>0?K((n-r)/(a-r),0,1):1,l=CM(o,1-d);_=CM(_,l);let v=e.direction===`R2L`?-1:1,y=l*(i+2*m+Math.abs(u)),b=cO(f,p,s>1?t/(s-1):.5),x=v>0?-m-Math.abs(u):i+m-y+Math.abs(u),S=-64+t*h;g+=`<path d="M ${x.toFixed(1)} ${S.toFixed(1)} l ${y.toFixed(1)} 0 l ${u.toFixed(1)} ${h.toFixed(1)} l ${(-y).toFixed(1)} 0 Z" fill="${b}"/>`}return{svg:g,alpha:_}},carryTravel(e,t,n,r,i){return{svg:``,alpha:0}}},zM=e=>{let t=yM(e*91.7)*43758.5453;return t-Math.floor(t)},BM=(e,t,n,r,i,a=1,o=0)=>`<rect x="${e.toFixed(1)}" y="${t.toFixed(1)}" width="${n.toFixed(1)}" height="${r.toFixed(1)}" rx="${o}" fill="${i}" opacity="${a}"/>`,Object.assign(RM,{blindsFlip(e,t,n,r,i){let a=hM(n,e.swapWindow[0],e.swapWindow[1]),o=mM(e,r),s=K(e.params.slats||8,4,16),c=(e.params.axis||`h`)!==`v`,l=i*TM,u=``,d=(c?768:i+2*l)/s;for(let e=0;e<s;e++){let t=d*a;u+=c?BM(-l,-64+e*d+d/2-t/2,i+2*l,t,o):BM(-l+e*d+d/2-t/2,-64,t,768,o)}return{svg:u,alpha:a}},checkerFlip(e,t,n,r,i){let a=mM(e,r),o=K(e.params.grid||6,3,10),s=i/o,c=Y/o,l=hM(n,e.swapWindow[0],e.swapWindow[1]),u=``,d=1;for(let t=0;t<o;t++)for(let n=0;n<o;n++){let r=e.params.order===`spiral`?(Math.abs(n-(o-1)/2)+Math.abs(t-(o-1)/2))/o:e.params.order===`random`?zM(n*7+t*13+1):(n+t)/(2*o),i=K(l*1.7-r*.7,0,1);d=CM(d,i),u+=BM(n*s+s/2-s*i/2,t*c+c/2-c*i/2,s*i,c*i,a)}return{svg:u,alpha:d}},inkBlot(e,t,n,r,i){let a=hM(n,e.swapWindow[0],e.swapWindow[1]),o=mM(e,r),s=K(e.params.blobs||3,1,6),c=e.params.wobble==null?.25:e.params.wobble,l=BM(-i*TM,-640*TM,i*1.2,Y*1.2,o,a*a*.5);for(let e=0;e<s;e++){let t=i*(.2+.6*zM(e+1)),n=Y*(.25+.5*zM(e+5)),r=a*SM(i,Y)*.5,s=`M ${(t+r).toFixed(1)} ${n.toFixed(1)}`;for(let i=1;i<=12;i++){let a=i/12*2*xM,o=r*(1+c*(zM(e*20+i)-.5));s+=` L ${(t+bM(a)*o).toFixed(1)} ${(n+yM(a)*o).toFixed(1)}`}l+=`<path d="${s} Z" fill="${o}"/>`}return{svg:l,alpha:a}},smokeConceal(e,t,n,r,i){let a=hM(n,e.swapWindow[0],e.swapWindow[1]),o=mM(e,r),s=``;for(let e=0;e<14;e++){let t=i*zM(e+2),n=Y*zM(e+8),r=a*SM(i,Y)*(.24+.14*zM(e));s+=`<circle cx="${t.toFixed(1)}" cy="${n.toFixed(1)}" r="${r.toFixed(1)}" fill="${o}" opacity="${(.5+.5*a).toFixed(2)}"/>`}return{svg:s+BM(-i*TM,-640*TM,i*1.2,Y*1.2,o,a*a),alpha:a}},particleStorm(e,t,n,r,i){let a=hM(n,e.swapWindow[0],e.swapWindow[1]),o=Math.round(120*a),s=e.params.particleType===`snow`?[`#fff`,`#e8eef4`]:e.params.particleType===`debris`?[`#6b5a44`,`#413424`]:[mM(e,r),`#f2b134`,`#ff6b5e`,`#5b6ce0`],c=BM(-i*TM,-640*TM,i*1.2,Y*1.2,mM(e,r),a*a*.85);for(let e=0;e<o;e++){let t=i*zM(e+1),n=Y*zM(e*3+2),r=4+5*zM(e);c+=BM(t,n,r,r,s[e%s.length],.9,2)}return{svg:c,alpha:a}},paperTear(e,t,n,r,i){let a=e.swapWindow[0],o=e.swapWindow[1],s=a>0?K(n/a,0,1):1,c=o<1?K((n-o)/(1-o),0,1):0,l=mM(e,r),u=e.params.tearJaggedness==null?22:e.params.tearJaggedness,d=e.direction===`R2L`,f=(d?1-s:s)*i,p=d?`M ${i+i*TM} ${-640*TM} L ${f} ${-640*TM}`:`M ${-i*TM} ${-640*TM} L ${f} ${-640*TM}`;for(let e=0;e<=Y;e+=24)p+=` L ${(f+(zM(e)-.5)*u).toFixed(1)} ${e}`;return p+=d?` L ${i+i*TM} 704 Z`:` L ${-i*TM} 704 Z`,{svg:`<path d="${p}" fill="${l}"/>`,alpha:s-c}},shapeStampede(e,t,n,r,i){let a=hM(n,e.swapWindow[0],e.swapWindow[1]),o=mM(e,r),s=e.params.iconRef||`coin`,c=Math.round((e.params.count||40)*a),l=BM(-i*TM,-640*TM,i*1.2,Y*1.2,o,a*a*.7);for(let e=0;e<c;e++){let t=i*zM(e+1),n=Y*zM(e*5+3),r=14+8*zM(e);l+=s===`star`?`<path transform="translate(${t.toFixed(0)} ${n.toFixed(0)})" d="M0 -${r} L${r*.3} -${r*.3} L${r} 0 L${r*.3} ${r*.3} L0 ${r} L-${r*.3} ${r*.3} L-${r} 0 L-${r*.3} -${r*.3} Z" fill="#f2b134"/>`:`<circle cx="${t.toFixed(0)}" cy="${n.toFixed(0)}" r="${r.toFixed(0)}" fill="#f2b134" stroke="${VM(o)}" stroke-width="2"/>`}return{svg:l,alpha:a}},typeMask(e,t,n,r,i){let a=hM(n,e.swapWindow[0],e.swapWindow[1]),o=mM(e,r),s=e.params.text||`NEXT`,c=e.direction===`R2L`?-1:1,l=i/2+c*(1-a)*i*.7;return{svg:BM(-i*TM,-640*TM,i*1.2,Y*1.2,o,a*a)+`<text x="${l.toFixed(1)}" y="${(Y*.62).toFixed(0)}" text-anchor="middle" font-family="Nunito,system-ui" font-weight="900" font-size="${(Y*.7*(.6+.4*a)).toFixed(0)}" fill="${o}">${s}</text>`,alpha:a}},silhouetteWalkWipe(e,t,n,r,i){let a=e.swapWindow[0],o=e.swapWindow[1],s=a>0?K(n/a,0,1):1,c=o<1?K((n-o)/(1-o),0,1):0,l=mM(e,r),u=(e.direction===`R2L`?-1:1)>0?-i*.4+s*i*1.4:i*1.4-s*i*1.4,d=i*.9;return{svg:(s>=1&&c<1?BM(-i*TM,-640*TM,i*1.2,Y*1.2,l,1-c):``)+`<g transform="translate(${u.toFixed(1)} 0)"><ellipse cx="0" cy="${Y*.28}" rx="${d*.28}" ry="${d*.3}" fill="${l}"/><rect x="${-d*.32}" y="${Y*.42}" width="${d*.64}" height="${Y*.7}" rx="${d*.2}" fill="${l}"/></g>`,alpha:wM(hM(n,a,o),s*.7)}},flashImpact(e,t,n,r,i){let a=hM(n,e.swapWindow[0],e.swapWindow[1]);return{svg:BM(-i*TM,-640*TM,i*1.2,Y*1.2,e.params.tint||`#ffffff`,a**.5),alpha:a}},dipToColor(e,t,n,r,i){let a=hM(n,e.swapWindow[0],e.swapWindow[1]);return{svg:BM(-i*TM,-640*TM,i*1.2,Y*1.2,e.params.color||e.colors[0]||mM(e,r),a),alpha:a}},silhouettePass(e,t,n,r,i){let a=hM(n,e.swapWindow[0],e.swapWindow[1]);return{svg:BM(-i*TM,-640*TM,i*1.2,Y*1.2,`#1b2230`,a),alpha:a}},dayNightSweep(e,t,n,r,i){let a=mM(e,r),o=e.swapWindow[0],s=e.swapWindow[1],c=o>0?K(n/o,0,1):1,l=s<1?K((n-s)/(1-s),0,1):0,u=l*i,d=c*i;return{svg:`<defs><linearGradient id="dns"><stop offset="0" stop-color="${a}"/><stop offset="1" stop-color="${cO(a,`#0a1020`,.5)}"/></linearGradient></defs>`+BM(u,-640*TM,d-u,Y*1.2,`url(#dns)`),alpha:c-l}},spotlightShift(e,t,n,r,i){let a=hM(n,e.swapWindow[0],e.swapWindow[1]),o=e.params.origin===`subject`&&r.subject?r.subject:{x:i/2,y:Y*.45},s=(1-a)*SM(i,Y)*.4+30;return{svg:`<defs><radialGradient id="sp" cx="${(o.x/i).toFixed(3)}" cy="${(o.y/Y).toFixed(3)}" r="${(s/i+.001).toFixed(3)}" gradientUnits="userSpaceOnUse" fx="${o.x}" fy="${o.y}" r="${s}"><stop offset="0.7" stop-color="#000" stop-opacity="0"/><stop offset="1" stop-color="#050810" stop-opacity="${(.4+.6*a).toFixed(2)}"/></radialGradient></defs><rect x="${-i*TM}" y="${-640*TM}" width="${i*1.2}" height="${Y*1.2}" fill="#050810" opacity="${(a*a).toFixed(2)}"/>`,alpha:a}},matchMorph(e,t,n,r,i){let a=hM(n,e.swapWindow[0],e.swapWindow[1]),o=mM(e,r),s=i/2,c=Y/2,l=40+a*SM(i,Y)*.55,u=a>.5?l*(1-(a-.5)*1.2):l;return{svg:`<rect x="${(s-l).toFixed(1)}" y="${(c-l).toFixed(1)}" width="${(2*l).toFixed(1)}" height="${(2*l).toFixed(1)}" rx="${Math.max(0,u).toFixed(1)}" fill="${o}"/>`,alpha:a}},pixelMosaic(e,t,n,r,i){let a=mM(e,r),o=K(e.params.blockPx||48,20,120),s=Math.ceil(i/o),c=Math.ceil(Y/o),l=hM(n,e.swapWindow[0],e.swapWindow[1]),u=``,d=1;for(let e=0;e<c;e++)for(let t=0;t<s;t++){let n=zM(t*3+e*7+1),r=+(l*1.5-n*.5>=.5);d=CM(d,l>=.99?1:r),r&&(u+=BM(t*o,e*o,o+1,o+1,a))}return{svg:u,alpha:l}},lineArtRebuild(e,t,n,r,i){let a=hM(n,e.swapWindow[0],e.swapWindow[1]),o=mM(e,r),s=e.params.strokeColor||`#243038`,c=BM(-i*TM,-640*TM,i*1.2,Y*1.2,o,a*a);for(let e=0;e<8;e++){let t=Y*(e+.5)/8,n=i*a;c+=`<line x1="0" y1="${t.toFixed(1)}" x2="${n.toFixed(1)}" y2="${t.toFixed(1)}" stroke="${s}" stroke-width="2" opacity="${(.5+.5*(1-a)).toFixed(2)}"/>`}return{svg:c,alpha:a}},ripplePortal(e,t,n,r,i){let a=hM(n,e.swapWindow[0],e.swapWindow[1]),o=mM(e,r),s=e.params.origin&&r.subject?r.subject:{x:i/2,y:Y/2},c=K(e.params.rings||5,2,8),l=`<circle cx="${s.x}" cy="${s.y}" r="${(a*SM(i,Y)*.6).toFixed(1)}" fill="${o}"/>`;for(let e=0;e<c;e++){let t=a*SM(i,Y)*.6+e*26;l+=`<circle cx="${s.x}" cy="${s.y}" r="${t.toFixed(1)}" fill="none" stroke="${cO(o,`#fff`,.3)}" stroke-width="3" opacity="${(.6*(1-a)).toFixed(2)}"/>`}return{svg:l,alpha:a}},doorPass(e,t,n,r,i){let a=e.swapWindow[0],o=e.swapWindow[1],s=a>0?K(n/a,0,1):1,c=o<1?K((n-o)/(1-o),0,1):0,l=mM(e,r);i/2*(1-c)*s;let u=i/2*c;return{svg:BM(-i*TM,-640*TM,i/2*s+i*TM-u,Y*1.2,l)+BM(i/2+u,-640*TM,i/2*s+i*TM-u,Y*1.2,l),alpha:s-c}},waveCrash(e,t,n,r,i){let a=e.swapWindow[0],o=e.swapWindow[1],s=a>0?K(n/a,0,1):1,c=o<1?K((n-o)/(1-o),0,1):0,l=cO(mM(e,r),`#2b6cb0`,.5),u=s*760-60,d=c*760-60,f=`M ${-i*TM} ${d.toFixed(1)}`;for(let e=0;e<=i;e+=40)f+=` L ${e} ${(u+yM(e/i*6+n*6)*26).toFixed(1)}`;f+=` L ${i+i*TM} ${d.toFixed(1)} Z`;let p=e.params.foam===!1?``:`<path d="${f.replace(/Z$/,``)}" fill="none" stroke="#eaf4ff" stroke-width="6" opacity="0.6"/>`;return{svg:`<path d="${f}" fill="${l}"/>${p}`,alpha:s-c}},pageFlip(e,t,n,r,i){let a=hM(n,e.swapWindow[0],e.swapWindow[1]),o=mM(e,r),s=a*(i+Y);return{svg:`<path d="M ${i} 0 L ${(i-s).toFixed(1)} 0 L ${i} ${s.toFixed(1)} Z" fill="${o}"/><path d="M ${(i-s).toFixed(1)} 0 L ${i} ${s.toFixed(1)} L ${(i-s*.7).toFixed(1)} ${(s*.7).toFixed(1)} Z" fill="${cO(o,`#fff`,.25)}"/>`,alpha:a}},lightSpeedStreak(e,t,n,r,i){let a=hM(n,e.swapWindow[0],e.swapWindow[1]),o=e.params.streakColor||`#bcd4ff`,s=i/2,c=Y/2,l=BM(-i*TM,-640*TM,i*1.2,Y*1.2,`#050813`,a*a);for(let e=0;e<40;e++){let t=zM(e+1)*2*xM,n=20+zM(e)*40,r=n+a*SM(i,Y)*.7;l+=`<line x1="${(s+bM(t)*n).toFixed(1)}" y1="${(c+yM(t)*n).toFixed(1)}" x2="${(s+bM(t)*r).toFixed(1)}" y2="${(c+yM(t)*r).toFixed(1)}" stroke="${o}" stroke-width="2" opacity="${(.4+.6*a).toFixed(2)}"/>`}return{svg:l,alpha:a}},glitchCut(e,t,n,r,i){let a=hM(n,e.swapWindow[0],e.swapWindow[1]),o=e.params.intensity||1,s=(zM(Math.floor(n*30))-.5)*20*o,c=BM(-i*TM,-640*TM,i*1.2,Y*1.2,mM(e,r),a*(.4+.6*zM(Math.floor(n*40))));for(let e=0;e<6;e++){let t=Y*zM(e*3+1),n=8+30*zM(e);c+=BM(s,t,i,n,e%2?`#ff2d6a`:`#2dffea`,.35*a)}return{svg:c,alpha:a}}}),VM=e=>cO(e,`#000`,.4),HM={carryTravel:(e,t,n,r)=>({fromT:`translate(${(-t*e*n).toFixed(1)} 0)`,toT:`translate(${(t*(1-e)*n).toFixed(1)} 0)`}),pushOff:(e,t,n,r)=>({fromT:`translate(${(-t*e*n).toFixed(1)} 0)`,toT:`translate(${(t*(1-e)*n).toFixed(1)} 0)`}),slideOver:(e,t,n,r)=>({fromT:``,toT:`translate(${(t*(1-e)*n).toFixed(1)} 0)`,over:!0}),whipPan:(e,t,n,r,i)=>({fromT:`translate(${(-t*e*n*1.25).toFixed(1)} 0)`,toT:`translate(${(t*(1-e)*n*1.25).toFixed(1)} 0)`,blur:yM(e*xM)*(i.blurPx||9)}),spinCard:(e,t,n,r)=>{let i=bM(e*xM);return{fromT:`translate(${n/2} ${r/2}) scale(${e<.5?Math.max(.001,i).toFixed(3):.001} 1) translate(${-n/2} ${-r/2})`,toT:`translate(${n/2} ${r/2}) scale(${e>=.5?Math.max(.001,-i).toFixed(3):.001} 1) translate(${-n/2} ${-r/2})`,flip:!0}},zoomThrough:(e,t,n,r,i,a)=>{let o=a?a.x:n/2,s=a?a.y:r*.42;return{fromT:`translate(${o} ${s}) scale(${(1+e*5).toFixed(3)}) translate(${-o} ${-s})`,toT:`translate(${n/2} ${r/2}) scale(${(.15+.85*e).toFixed(3)}) translate(${-n/2} ${-r/2})`,flip:!0}},pullBackReveal:(e,t,n,r)=>({fromT:`translate(${n/2} ${r/2}) scale(${(1-e*.86).toFixed(3)}) translate(${-n/2} ${-r/2})`,toT:`translate(${n/2} ${r/2}) scale(${(1.7-.7*e).toFixed(3)}) translate(${-n/2} ${-r/2})`,flip:!0}),elevatorRise:(e,t,n,r)=>({fromT:`translate(0 ${(t*e*r).toFixed(1)})`,toT:`translate(0 ${(t*(1-e)*r-t*r).toFixed(1)})`}),stackShuffle:(e,t,n,r,i)=>({fromT:`translate(${(t*e*n).toFixed(1)} ${(e*40).toFixed(1)}) rotate(${(t*e*4).toFixed(1)} ${n/2} 200)`,toT:``,shadow:i.cardShadow!==!1}),splitBarn:(e,t,n,r,i)=>({split:e,axis:i.axis||`v`})}}));function WM(e){e=K(e,0,1);for(let t=0;t<KM.length-1;t++)if(e<=KM[t+1]){let n=(e-KM[t])/(KM[t+1]-KM[t]);return lO(qM[t],qM[t+1],n)}return qM[qM.length-1]}function GM(e,t){return t===`2d`?{scale:1,yShift:0,opacity:1,blur:0,w:WM(.5)}:{scale:JM(e),yShift:YM(e),opacity:XM(e),blur:ZM(e),w:WM(e)}}var KM,qM,JM,YM,XM,ZM,QM=o((()=>{pO(),KM=[0,.25,.5,.75,1],qM=[1.45,1.28,1,.24,.15],JM=e=>1+(.5-e)*.72,YM=e=>-(e-.5)*165,XM=e=>1-K(e-.42,0,.58)*.78,ZM=e=>K(e-.55,0,.45)*6}));function $M(e,t){let n=t/2/Math.max(.001,e.zoom);return n>=t/2?{...e,cx:t/2}:{...e,cx:K(e.cx,n,t-n)}}function eN(e,t,n,r,i){let a=i*i,o=a*i;return .5*(2*t+(-e+n)*i+(2*e-5*t+4*n-r)*a+(-e+3*t-3*n+r)*o)}function tN(e,t){if(e.length===1)return e[0];let n=K(Math.floor(t),0,e.length-2),r=t-n,i=e[Math.max(0,n-1)],a=e[n],o=e[n+1],s=e[Math.min(e.length-1,n+2)];return eN(i,a,o,s,r)}function nN(e,t,n,r,i,a,o){let s=pN[o]||pN.editorial,c=t.zoom;if(e===`locked`)return{...t};if(e===`drift`)return{cx:t.cx+40*s.amp*Math.sin(n*.25*s.speed),cy:t.cy,zoom:c};let l=oO(i+`:cam`),u=a&&a.length?a:[{rigX:t.cx}],d=[t.cx],f=[c],p=Math.max(3,Math.min(6,u.length+2));for(let e=0;e<p;e++){let e=u[Math.floor(l()*u.length)];d.push(t.cx+(e.rigX-t.cx)*s.amp+(l()-.5)*60*s.amp),f.push(c+l()*.08*s.amp)}d.push(t.cx),f.push(c);let m=n/Math.max(.001,r)*(d.length-1)*s.speed%(d.length-1);return{cx:tN(d,m),cy:t.cy-6,zoom:tN(f,m)}}function rN(e,t){let n=fN(t.VBW,t.frame),r=(e||[]).find(e=>e.idle)||{idle:`focusFlow`},i=[],a=n,o=(e||[]).filter(e=>e.directive&&(e.atPhrase!=null||e.atMs!=null)).map(e=>({d:e,t:e.atMs==null?t.phrases[e.atPhrase].t:e.atMs/1e3})).sort((e,t)=>e.t-t.t),s=t.frame&&t.frame.cy>350;return o.forEach((e,r)=>{let c=e.d,l=e.t,u=r+1<o.length?o[r+1].t:t.sceneT1,d=(c.ms||(c.directive===`snapZoom`?280:c.directive===`punchTo`?620:1100))/1e3,f=lN[c.ease]||(s?fO:dO),p=(c.hold||0)/1e3,m=a,h={...n};if(c.directive===`panTo`){let e=t.resolveTarget(c.target);h={cx:e.x+(c.offset&&c.offset.x||0),cy:e.y+(c.offset&&c.offset.y||0),zoom:c.zoom||1.3}}else if(c.directive===`punchTo`){let e=t.resolveTarget(c.target);h={cx:e.x+(c.offset&&c.offset.x||0),cy:e.y+(c.offset&&c.offset.y||0),zoom:c.zoom||1.55}}else if(c.directive===`snapZoom`){let e=t.resolveTarget(c.target);h={cx:e.x+(c.offset&&c.offset.x||0),cy:e.y+(c.offset&&c.offset.y||0),zoom:c.zoom||1.75}}else if(c.directive===`orbitLite`){let e=t.resolveTarget(c.target);h={cx:e.x,cy:e.y,zoom:c.zoom||1.2}}else if(c.directive===`zoomOut`||c.directive===`establish`)h=fN(t.VBW,t.frame);else if(c.directive===`follow`)h=m;else if(c.directive===`travel`)h={cx:m.cx+(c.viewportWidths||1)*t.VBW*.6,cy:m.cy,zoom:c.zoom||m.zoom||1};else if(c.directive===`hop`){let e=t.resolveTarget((c.targets||[])[0]);e&&(h={cx:e.x,cy:e.y,zoom:c.zoom||1.3})}i.push({d:c,t0:l,tNext:u,ms:d,ease:f,hold:p,from:m,to:h}),a=c.then===`return`?n:h}),{base:n,idle:r,shots:i}}function iN(e,t,n){n={...n,frame:n.frame||dN(e)};let r=rN(e.camera,n),i=null;for(let e of r.shots)t>=e.t0-1e-9&&t<e.tNext&&(i=e);let a;if(i){let e=i.d,o=t-i.t0;if(i._dir=e.directive,e.directive===`follow`){let t=n.resolveTarget(e.target),i=K(e.tightness==null?.6:e.tightness,.05,1),o=e.leadRoom?40:0;a={cx:lO(r.base.cx,t.x+o,i),cy:r.base.cy,zoom:e.zoom||1.15,active:!0}}else if(e.directive===`hop`&&e.targets&&e.targets.length){let t=(e.dwell||900)/1e3,r=e.targets.length*t,i=K(Math.floor(o%r/t),0,e.targets.length-1),s=(o%r-i*t)/t,c=n.resolveTarget(e.targets[i]),l=n.resolveTarget(e.targets[Math.min(i+1,e.targets.length-1)]),u=dO(K(s*2,0,1));a={cx:lO(c.x,l.x,u),cy:lO(c.y,l.y,u),zoom:e.zoom||1.3,active:!0}}else if(e.directive===`orbitLite`){let t=n.resolveTarget(e.target),i=(e.deg||8)/8*n.VBW*.06,s=Math.sin(o*(e.speed||.8));a={cx:t.x+s*i,cy:r.base.cy,zoom:e.zoom||1.2,active:!0}}else{let t=i.ease(K(o/i.ms,0,1)),n=lO(i.from.cx,i.to.cx,t),s=lO(i.from.cy,i.to.cy,t),c=lO(i.from.zoom,i.to.zoom,t);if(e.then===`return`){let e=i.tNext-i.t0,t=Math.min(i.ms,e*.5),a=Math.max(i.ms,e-t);if(o>=a){let e=i.ease(K((o-a)/t,0,1));n=lO(i.to.cx,r.base.cx,e),s=lO(i.to.cy,r.base.cy,e),c=lO(i.to.zoom,r.base.zoom,e)}}a={cx:n,cy:s,zoom:c,active:!0},e.directive===`snapZoom`&&(a.whip=K(1-o/.28,0,1))}}else{let e=r.base;for(let n of r.shots)t>=n.t0&&(e=n.d.then===`return`?r.base:n.to);a={...nN(r.idle.idle||`focusFlow`,e,t-n.sceneT0,n.sceneT1-n.sceneT0,n.seed,n.cast,r.idle.stylePreset),active:!1}}return a.directive=i?i.d.directive:`idle`,$M(a,n.VBW)}function aN(e,t){let n=rN(e.camera,t),r=new Set(n.shots.map(e=>e.d.directive)),i=n.shots.map(e=>e.to.zoom).concat([1]),a=Math.max(...i)-Math.min(...i);return K(r.size*.22+n.shots.length*.1+a*.6,0,1)}function oN(e,t){let n=e.rotation?` rotate(${(-e.rotation).toFixed(3)})`:``;return`translate(${(t/2).toFixed(2)} 300)${n} scale(${e.zoom.toFixed(4)}) translate(${(-e.cx).toFixed(2)} ${(-e.cy+300).toFixed(2)})`}function sN(e,t){return{pan:(t/2-e.cx)*(960/t),scale:e.zoom-1}}function cN(e,t){let n=rN(e.camera,t),r=Math.max(.001,t.sceneT1-t.sceneT0),i=0;return n.shots.forEach(e=>{let t=Math.min(e.tNext,e.t0+e.ms+e.hold);i+=Math.max(0,t-e.t0)}),K(i/r,0,1)}var lN,uN,dN,fN,pN,mN=o((()=>{pO(),lN={linear:uO,smooth:dO,smoother:fO},uN={default:{cy:300,zoom:1},warfilm:{cy:560,zoom:1}},dN=e=>{let t=null;return(e&&e.camera||[]).forEach(e=>{e.stylePreset&&(t=e.stylePreset)}),uN[t]||uN.default},fN=(e,t=uN.default)=>({cx:e/2,cy:t.cy,zoom:t.zoom}),pN={editorial:{amp:1,zoom:1.06,speed:1},energetic:{amp:1.7,zoom:1.13,speed:1.6},calm:{amp:.5,zoom:1.03,speed:.6},doc:{amp:.8,zoom:1.05,speed:.8},documentary:{amp:.8,zoom:1.05,speed:.8},dramatic:{amp:1.2,zoom:1.18,speed:.7},warfilm:{amp:1.5,zoom:1.02,speed:1.4}}}));function hN(e,t,n){let r=wN[e.type];return r?r(e,K(t,0,1),n):``}var gN,_N,vN,yN,bN,xN,SN,CN,X,wN,TN,EN,DN=o((()=>{pO(),gN=`#243038`,_N=`#2BB3A3`,vN=`#FF6B5E`,yN=`#8794a0`,bN=`#F2B134`,xN=`#5B6CE0`,SN=(e,t,n=`#fff`)=>`<rect x="${-e/2}" y="${-t/2}" width="${e}" height="${t}" rx="${t/2}" fill="${n}" stroke="rgba(20,40,50,.08)"/>`,CN=(e,t)=>`<rect x="${-e/2}" y="${-t/2}" width="${e}" height="${t}" rx="14" fill="#fff" stroke="rgba(20,40,50,.08)"/>`,X=(e,t,n,r,i=gN,a=800,o=`middle`)=>`<text x="${e}" y="${t}" font-family="Nunito,system-ui,sans-serif" font-size="${n}" font-weight="${a}" text-anchor="${o}" fill="${i}">${r}</text>`,wN={counter(e,t){let n=fO(t),r=e.value==null?0:e.value,i=(Number.isInteger(r)?Math.round(r*n):(r*n).toFixed(1))+(e.unit||``);return e.variant===`chip`?`${SN(Math.max(90,i.length*22+40),56)}${X(0,9,30,(e.label?e.label+` `:``)+i,gN,900)}`:`${X(0,6,62,i,_N,900)}${e.label?X(0,40,20,e.label,yN,800):``}`},proportionFill(e,t){let n=K(e.value||0,0,100),r=n/100*260*fO(t);return`${CN(296,74)}${e.label?X(0,-18,20,e.label,gN,800):``}<rect x="-130" y="2" width="260" height="18" rx="9" fill="#e7edf1"/><rect x="-130" y="2" width="${r}" height="18" rx="9" fill="${_N}"/>${X(134,17,18,Math.round(n*fO(t))+`%`,gN,900,800,`start`)}`},barsCompare(e,t){let n=e.values||[40,70,55],r=e.labels||[],i=[_N,xN,vN,bN],a=Math.max(...n,1),o=n.length*60,s=fO(t),c=n.map((e,t)=>{let n=e/a*120*s,c=-o/2+t*60+10;return`<rect x="${c}" y="${-n}" width="40" height="${n}" rx="6" fill="${i[t%4]}"/>${r[t]?X(c+20,22,15,r[t],yN,800):``}`}).join(``);return`<line x1="${-o/2-6}" y1="0" x2="${o/2+6}" y2="0" stroke="#d7dee3" stroke-width="2"/>${c}`},trendLine(e,t){let n=e.points||[30,42,38,58,74,68,90],r=fO(t),i=n.length,a=Math.max(...n,1),o=n.map((e,t)=>[-130+t/(i-1)*260,-(e/a)*90]),s=Math.max(2,Math.round(2+(i-2)*r)),c=o.slice(0,s).map((e,t)=>(t?`L`:`M`)+e[0].toFixed(1)+` `+e[1].toFixed(1)).join(` `),l=o[s-1];return`${CN(300,150)}<polyline points="${o.map(e=>e.join(`,`)).join(` `)}" fill="none" stroke="#e7edf1" stroke-width="2"/><path d="${c}" fill="none" stroke="${_N}" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><circle cx="${l[0].toFixed(1)}" cy="${l[1].toFixed(1)}" r="5" fill="${_N}"/>${e.label?X(0,67,18,e.label,gN,800):``}`},labelChip(e,t){let n=.6+.4*fO(t),r=(e.text||`label`).length*12+34;return`<g transform="scale(${n})" opacity="${t.toFixed(2)}">${SN(r,44,e.tone===`accent`?vN:`#fff`)}${X(0,7,20,e.text||`label`,e.tone===`accent`?`#fff`:gN,900)}</g>`},mapLite(e,t){let n=(1-fO(t))*40;return`<path d="M-70 20 Q-80 -30 -30 -40 Q10 -60 50 -34 Q86 -20 70 20 Q30 44 -20 40 Q-56 40 -70 20 Z" fill="#cfe3d3" stroke="#a9c6ad" stroke-width="2"/><g transform="translate(${e.px||20} ${-10-n})" opacity="${K(t*1.4,0,1).toFixed(2)}"><path d="M0 0 C-14 -18 -10 -34 0 -34 C10 -34 14 -18 0 0 Z" fill="${vN}"/><circle cx="0" cy="-24" r="5" fill="#fff"/></g>`},timelineStrip(e,t){let n=e.count||5,r=fO(t),i=Math.round(n*r),a=`<line x1="-130" y1="0" x2="130" y2="0" stroke="#d7dee3" stroke-width="3"/><line x1="-130" y1="0" x2="${-130+260*r}" y2="0" stroke="${_N}" stroke-width="3"/>`;for(let e=0;e<n;e++){let t=-130+e/(n-1)*260;a+=`<circle cx="${t}" cy="0" r="7" fill="${e<i?_N:`#e7edf1`}" stroke="#fff" stroke-width="2"/>`}return a},iconBurst(e,t){let n=fO(t),r=``;for(let e=0;e<8;e++){let t=e/8*Math.PI*2,i=20+34*n;r+=`<circle cx="${(Math.cos(t)*i).toFixed(1)}" cy="${(Math.sin(t)*i).toFixed(1)}" r="${(5*n+2).toFixed(1)}" fill="${[_N,bN,vN,xN][e%4]}" opacity="${(1-n*.5).toFixed(2)}"/>`}return`<circle cx="0" cy="0" r="16" fill="${bN}"/>${r}`},gauge(e,t){let n=K(e.value||0,0,100),r=fO(t),i=Math.PI,a=Math.PI-n/100*Math.PI*r,o=(e,t,n,r)=>{let i=Math.cos(e)*70,a=-Math.sin(e)*70,o=Math.cos(t)*70,s=-Math.sin(t)*70;return`<path d="M${i.toFixed(1)} ${a.toFixed(1)} A70 70 0 0 1 ${o.toFixed(1)} ${s.toFixed(1)}" fill="none" stroke="${n}" stroke-width="${r}" stroke-linecap="round"/>`};return`${o(i,0,`#e7edf1`,14)}${o(i,a,_N,14)}${X(0,-6,40,Math.round(n*r)+(e.unit||``),gN,900)}${e.label?X(0,24,18,e.label,yN,800):``}`},quoteCard(e,t){return`<g opacity="${t.toFixed(2)}">${CN(300,110)}${X(-132,-15,44,`“`,_N,900,800,`start`)}<foreignObject x="-110" y="-41" width="240" height="86"><div xmlns="http://www.w3.org/1999/xhtml" style="font:800 17px Nunito,system-ui;color:${gN};line-height:1.25">${e.text||``}</div></foreignObject></g>`},xOut(e,t){let n=fO(t);return`<circle cx="0" cy="0" r="34" fill="none" stroke="${vN}" stroke-width="6"/><line x1="${-34*.7*n}" y1="${-34*.7*n}" x2="${34*.7*n}" y2="${34*.7*n}" stroke="${vN}" stroke-width="7" stroke-linecap="round"/><line x1="${34*.7*n}" y1="${-34*.7*n}" x2="${-34*.7*n}" y2="${34*.7*n}" stroke="${vN}" stroke-width="7" stroke-linecap="round"/>`},connectionLink(e,t){let n=-110+220*fO(t);return`<circle cx="-110" cy="0" r="9" fill="${_N}"/><line x1="-110" y1="0" x2="${n}" y2="0" stroke="${_N}" stroke-width="4" stroke-dasharray="2 8" stroke-linecap="round"/><circle cx="110" cy="0" r="9" fill="${t>.9?_N:`#e7edf1`}"/>`},morph(e,t){return`<rect x="-40" y="-40" width="80" height="80" rx="${(40-32*fO(t)).toFixed(1)}" fill="${_N}"/>`},pieSlice(e,t){let n=K(e.value==null?60:e.value,0,100)/100*fO(t),r=n*2*Math.PI,i=Math.sin(r)*40,a=-Math.cos(r)*40;return`<circle cx="0" cy="0" r="40" fill="#e7edf1"/><path d="M0 0 L0 -40 A40 40 0 ${+(n>.5)} 1 ${i.toFixed(1)} ${a.toFixed(1)} Z" fill="${_N}"/>${X(0,6,20,Math.round(n*100)+`%`,gN,900)}`},statCallout(e,t){let n=e.value==null?``:Math.round(e.value*fO(t));return`${X(0,-2,52,n+(e.unit||``),_N,900)}${e.label?X(0,30,18,e.label,yN,800):``}`},checklist(e,t){let n=e.count||3,r=Math.round(n*fO(t)),i=``;for(let t=0;t<n;t++){let a=-n*15+t*30;i+=`<rect x="-96" y="${a-13}" width="192" height="26" rx="7" fill="#fff" stroke="rgba(20,40,50,.08)"/><circle cx="-78" cy="${a}" r="9" fill="${t<r?_N:`#e7edf1`}"/>${t<r?`<path d="M-82 ${a} l3 4 l7 -8" stroke="#fff" stroke-width="2.5" fill="none"/>`:``}${X(-60,a+5,15,e.labels&&e.labels[t]||`item `+(t+1),gN,800,800,`start`)}`}return i},arrow(e,t){let n=fO(t),r=-70+140*n;return`<line x1="-70" y1="0" x2="${r.toFixed(1)}" y2="0" stroke="${vN}" stroke-width="6" stroke-linecap="round"/><path d="M${r.toFixed(1)} 0 l-14 -9 M${r.toFixed(1)} 0 l-14 9" stroke="${vN}" stroke-width="6" fill="none" stroke-linecap="round" opacity="${n.toFixed(2)}"/>`},highlightRing(e,t){return`<circle cx="0" cy="0" r="${(30+8*Math.sin(t*Math.PI)).toFixed(1)}" fill="none" stroke="${bN}" stroke-width="5"/>`},badge(e,t){return`<g transform="scale(${(.7+.3*fO(t)).toFixed(2)})"><path d="M0 -44 L38 -30 L38 6 Q38 34 0 46 Q-38 34 -38 6 L-38 -30 Z" fill="${_N}"/>${X(0,6,22,e.text||`A+`,`#fff`,900)}</g>`},ratingStars(e,t){let n=K(e.value==null?4:e.value,0,5)*fO(t),r=(e,t)=>`<path transform="translate(${e} 0) scale(0.85)" d="M0 -16 L5 -5 L17 -4 L8 4 L11 16 L0 9 L-11 16 L-8 4 L-17 -4 L-5 -5 Z" fill="${t}"/>`,i=``;for(let e=0;e<5;e++)i+=r(-88+e*44,e<n?bN:`#e7edf1`);return i},deltaBadge(e,t){let n=(e.value||0)>=0,r=Math.abs(Math.round((e.value||0)*fO(t)));return`${SN(130,52,n?`#e6f7f0`:`#fdecea`)}${X(-32,8,24,n?`▲`:`▼`,n?_N:vN,900)}${X(20,8,24,r+(e.unit||``),n?_N:vN,900)}`},keyValue(e,t){return`${CN(230,60)}${X(-100,7,18,e.label||`key`,yN,800,800,`start`)}${X(100,7,22,(e.text==null?e.value||``:e.text)+(e.unit||``),gN,900,800,`end`)}`},progressRing(e,t){let n=K(e.value||0,0,100)/100*fO(t),r=2*Math.PI*40;return`<circle cx="0" cy="0" r="40" fill="none" stroke="#e7edf1" stroke-width="10"/><circle cx="0" cy="0" r="40" fill="none" stroke="${_N}" stroke-width="10" stroke-linecap="round" stroke-dasharray="${r.toFixed(1)}" stroke-dashoffset="${(r*(1-n)).toFixed(1)}" transform="rotate(-90)"/>${X(0,7,24,Math.round(n*100)+`%`,gN,900)}`},flowStep(e,t){let n=Math.min(2,Math.floor(fO(t)*3)),r=``;for(let t=0;t<3;t++){let i=-100+t*100;r+=`<rect x="${i-34}" y="-22" width="68" height="44" rx="8" fill="${t<=n?_N:`#e7edf1`}"/>${X(i,7,16,e.labels&&e.labels[t]||`step `+(t+1),t<=n?`#fff`:yN,800)}${t<2?`<path d="M${i+40} 0 l16 0 M${i+52} -5 l6 5 l-6 5" stroke="#c7d0d6" stroke-width="3" fill="none"/>`:``}`}return r},tally(e,t){let n=Math.round((e.value||7)*fO(t)),r=``;for(let e=0;e<n;e++){let t=Math.floor(e/5),n=e%5,i=-90+t*46+n*8;r+=n===4?`<line x1="${i-34}" y1="-16" x2="${i-2}" y2="16" stroke="${gN}" stroke-width="3"/>`:`<line x1="${i}" y1="-16" x2="${i}" y2="16" stroke="${gN}" stroke-width="3"/>`}return r},thermometer(e,t){let n=K(e.value||0,0,100)/100*fO(t);return`<rect x="-12" y="-110" width="24" height="110" rx="12" fill="#e7edf1"/><rect x="-12" y="${(-110*n).toFixed(1)}" width="24" height="${(110*n).toFixed(1)}" rx="12" fill="${vN}"/><circle cx="0" cy="14" r="18" fill="${vN}"/>${X(30,-110*n+6,18,Math.round(n*100)+`%`,gN,900,800,`start`)}`},sparkbars(e,t){let n=e.points||[3,6,4,8,5,9,7],r=fO(t),i=Math.max(...n,1),a=``;return n.forEach((e,t)=>{let o=e/i*60*r,s=-n.length*15/2+t*15;a+=`<rect x="${s}" y="${-o}" width="12" height="${o}" rx="3" fill="${_N}"/>`}),a},ribbon(e,t){return`<g transform="scale(${(.7+.3*fO(t)).toFixed(2)})"><circle cx="0" cy="-20" r="26" fill="${bN}"/><circle cx="0" cy="-20" r="18" fill="#fff" opacity=".85"/>${X(0,-13,22,e.text||`1`,gN,900)}<path d="M-14 0 L-20 40 L-6 30 L0 42 L6 30 L20 40 L14 0 Z" fill="${vN}"/></g>`},calloutBox(e,t){return`<g opacity="${t.toFixed(2)}">${CN(220,70)}<path d="M-14 35 l14 18 l14 -18 Z" fill="#fff"/>${X(0,6,18,e.text||``,gN,800)}</g>`},comparisonBar(e,t){let n=K(e.value==null?60:e.value,0,100),r=fO(t),i=n/100*260*r;return`<rect x="-130" y="-12" width="260" height="24" rx="12" fill="${xN}"/><rect x="-130" y="-12" width="${i.toFixed(1)}" height="24" rx="12" fill="${_N}"/>${X(-122,7,16,Math.round(n*r)+`%`,`#fff`,900,800,`start`)}${X(122,7,16,100-Math.round(n*r)+`%`,`#fff`,900,800,`end`)}`}},wN.highlightRegion=function(e,t,n){let r=fO(t),i=e.tint||bN,a=(26+18*(.5+.5*Math.sin((n||0)*3)))*r,o=e.label?`<g transform="translate(0 -50)">${SN(e.label.length*12+30,38)}${X(0,6,18,e.label,gN,900)}</g>`:``;return`<circle r="${a.toFixed(1)}" fill="none" stroke="${i}" stroke-width="3" opacity="${(.7*r).toFixed(2)}"/><circle r="${(12*r).toFixed(1)}" fill="${i}" opacity="0.9"/>${o}`},wN.sweepArrow=function(e,t){let n=e.bx==null?160:e.bx,r=e.by==null?-60:e.by,i=fO(t),a=e.tint||vN,o=n*.5,s=Math.min(0,r)-90,c=2*(1-i)*i*o+i*i*n,l=2*(1-i)*i*s+i*i*r,u=`<path d="M 0 0 Q ${o.toFixed(1)} ${s.toFixed(1)} ${c.toFixed(1)} ${l.toFixed(1)}" fill="none" stroke="${a}" stroke-width="5" stroke-linecap="round"/>`,d=``;if(i>.82){let e=Math.atan2(l-s,c-o);d=`<path d="M ${c.toFixed(1)} ${l.toFixed(1)} L ${(c+Math.cos(e+2.6)*18).toFixed(1)} ${(l+Math.sin(e+2.6)*18).toFixed(1)} M ${c.toFixed(1)} ${l.toFixed(1)} L ${(c+Math.cos(e-2.6)*18).toFixed(1)} ${(l+Math.sin(e-2.6)*18).toFixed(1)}" stroke="${a}" stroke-width="5" stroke-linecap="round" fill="none"/>`}return u+d},wN.dropPlate=function(e,t){let n=(1-fO(t))*-24,r=e.label||e.text||`REGION`,i=r.length*14+78;return`<g transform="translate(0 ${n.toFixed(1)})" opacity="${t.toFixed(2)}"><rect x="${(-i/2).toFixed(1)}" y="-26" width="${i.toFixed(1)}" height="52" rx="12" fill="#fff" stroke="rgba(20,40,50,.1)"/><circle cx="${(-i/2+28).toFixed(1)}" cy="0" r="16" fill="${e.tint||vN}"/><circle cx="${(-i/2+28).toFixed(1)}" cy="0" r="16" fill="none" stroke="rgba(0,0,0,.14)"/>${X((-i/2+52).toFixed(1),7,21,r,gN,900,800,`start`)}</g>`},wN.entrantPlate=function(e,t){let n=(1-fO(t))*-140,r=e.label||e.text||`ENTRANT`,i=r.length*20+116;return`<g transform="translate(${n.toFixed(1)} 0)" opacity="${t.toFixed(2)}"><rect x="${(-i/2).toFixed(1)}" y="-34" width="${i.toFixed(1)}" height="68" rx="14" fill="#1b2432" stroke="rgba(255,255,255,.14)"/><circle cx="${(-i/2+36).toFixed(1)}" cy="0" r="22" fill="${e.tint||vN}"/><circle cx="${(-i/2+36).toFixed(1)}" cy="0" r="22" fill="none" stroke="rgba(255,255,255,.22)"/>`+X((-i/2+68).toFixed(1),e.value==null?8:-4,26,r,`#fff`,900,800,`start`)+(e.value==null?``:X((-i/2+68).toFixed(1),20,15,e.value+(e.unit||``),`#9fb0c4`,800,800,`start`))+`</g>`},wN.vsCard=function(e,t){let n=fO(t),r=e.labels||[`A`,`B`],i=70*n,a=r[0].length*16+54,o=r[1].length*16+54;return`<g opacity="${t.toFixed(2)}"><g transform="translate(${(-70-i).toFixed(1)} 0)">${SN(a,62,`#dfeaf6`)}${X(0,8,24,r[0],gN,900)}</g><g transform="translate(${(70+i).toFixed(1)} 0)">${SN(o,62,`#f6e3df`)}${X(0,8,24,r[1],gN,900)}</g><circle r="26" fill="${vN}"/><circle r="26" fill="none" stroke="#fff" stroke-width="2"/>${X(0,9,24,`VS`,`#fff`,900)}</g>`},wN.rangeBand=function(e,t){let n=fO(t),r=e.min==null?0:e.min,i=e.max==null?100:e.max,a=K(e.value==null?(r+i)/2:e.value,r,i),o=-140+280*((a-r)/(i-r||1));return`${e.label?X(0,-30,20,e.label,gN,800):``}<rect x="-140" y="-8" width="280" height="16" rx="8" fill="#e7edf1"/><rect x="${(-50.39999999999999).toFixed(1)}" y="-8" width="${100.8.toFixed(1)}" height="16" rx="8" fill="#cdeee7"/><g transform="translate(${(-140+(o+140)*n).toFixed(1)} 0)"><line x1="0" y1="-20" x2="0" y2="20" stroke="${_N}" stroke-width="4" stroke-linecap="round"/><circle cx="0" cy="0" r="7" fill="${_N}"/></g>`+X(-140,34,14,``+r,yN,800)+X(140,34,14,``+i,yN,800,`middle`)+X(0,34,15,Math.round(a*n)+(e.unit||``),gN,900)},wN.podium=function(e,t){let n=fO(t),r=e.labels||[`1st`,`2nd`,`3rd`],i=e.values||[],a=r.map((e,t)=>({label:e,val:i[t]}));i.length&&(a=a.slice().sort((e,t)=>(t.val||0)-(e.val||0))),a=a.slice(0,3);let o=[1,0,2],s=[130,96,74],c=[bN,yN,`#c98b52`];return a.map((t,r)=>{let i=o[r],a=s[r]*n,l=-66+i*66,u=r+1;return`<rect x="${l}" y="${-a}" width="62" height="${a}" rx="6" fill="${c[r]}"/>${X(l+31,-a+30,26,``+u,`#fff`,900)}`+(t.label?X(l+31,24,14,t.label,gN,800):``)+(t.val==null?``:X(l+31,-a-10,16,t.val+(e.unit||``),gN,900))}).join(``)},wN.rankBadge=function(e,t){let n=.7+.3*fO(t),r=e.value==null?1:e.value,i=r===1?bN:r===2?`#b8c0c8`:r===3?`#c98b52`:_N;return`<g transform="scale(${n.toFixed(2)})"><circle cx="0" cy="0" r="34" fill="${i}"/><circle cx="0" cy="0" r="27" fill="#fff" opacity=".9"/>${X(0,3,30,`#`+r,gN,900)}<path d="M-16 26 L-22 58 L-8 48 L0 60 L8 48 L22 58 L16 26 Z" fill="${i}"/>${e.label?X(0,-46,16,e.label,yN,800):``}</g>`},wN.progressRail=function(e,t){let n=fO(t),r=e.count||(e.labels?e.labels.length:4),i=e.value==null?n:K(e.value,0,100)/100,a=-140+280*i,o=`<rect x="-140" y="-4" width="280" height="8" rx="4" fill="#e7edf1"/><rect x="-140" y="-4" width="${(280*i).toFixed(1)}" height="8" rx="4" fill="${_N}"/>`;for(let t=0;t<r;t++){let n=-140+t/(r-1)*280,i=n<=a+1;o+=`<circle cx="${n.toFixed(1)}" cy="0" r="6" fill="${i?_N:`#fff`}" stroke="${i?_N:`#d7dee3`}" stroke-width="2"/>${e.labels&&e.labels[t]?X(n,26,13,e.labels[t],i?gN:yN,800):``}`}return o+`<g transform="translate(${a.toFixed(1)} 0)"><circle cx="0" cy="0" r="11" fill="${_N}" stroke="#fff" stroke-width="3"/></g>`},wN.ticker=function(e,t,n){let r=(e.labels||[e.text||`BREAKING`]).join(` • `)+` • `,i=r.length*9.2,a=-((n||0)*70%i),o=e.label||`LIVE`;return`<clipPath id="tk"><rect x="-160" y="-20" width="320" height="40" rx="8"/></clipPath><rect x="-160" y="-20" width="320" height="40" rx="8" fill="#1b2432"/><g clip-path="url(#tk)"><text x="${(-148+a).toFixed(1)}" y="6" font-family="Nunito,system-ui" font-size="18" font-weight="800" fill="#fff">${r}${r}</text></g><rect x="-160" y="-20" width="74" height="40" rx="8" fill="${vN}"/>${X(-123,6,16,o,`#fff`,900)}<g opacity="${t.toFixed(2)}"></g>`},wN.scoreboard=function(e,t){let n=e.labels||[`HOME`,`AWAY`],r=e.values||[0,0],i=fO(t),a=Math.round(r[0]*i),o=Math.round(r[1]*i);return`<g opacity="${t.toFixed(2)}"><rect x="-150" y="-42" width="300" height="84" rx="12" fill="#1b2432"/><rect x="-150" y="-42" width="8" height="84" fill="${_N}"/><rect x="142" y="-42" width="8" height="84" fill="${vN}"/>`+X(-90,-12,18,n[0],`#9fb0c4`,900)+X(-90,24,40,``+a,`#fff`,900)+X(90,-12,18,n[1],`#9fb0c4`,900)+X(90,24,40,``+o,`#fff`,900)+`<line x1="0" y1="-30" x2="0" y2="30" stroke="rgba(255,255,255,.14)" stroke-width="2"/>`+(e.text?X(0,-8,16,e.text,bN,900):X(0,8,26,`:`,`#fff`,900))+`</g>`},wN.checkmark=function(e,t){let n=fO(t),r=46*(1-n);return`<circle cx="0" cy="0" r="30" fill="${_N}" opacity="${(.15+.85*n).toFixed(2)}"/><path d="M-14 1 l9 11 l19 -22" fill="none" stroke="#fff" stroke-width="6" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="46" stroke-dashoffset="${r.toFixed(1)}"/>${e.label?X(0,54,18,e.label,gN,900):``}`},wN.bracketSync=function(e,t){let n=fO(t),r=e.labels||[`Seed A`,`Seed B`,`Winner`],i=K(n*1.4,0,1),a=(e,t,n,r)=>`<g transform="translate(${e} ${t})">${SN(96,40,r?`#dfeff6`:`#fff`)}${X(0,6,16,n,gN,900)}</g>`;return a(-96,-40,r[0],!0)+a(-96,40,r[1],!0)+`<path d="M-48 -40 H-20 V40 H-48 M-20 0 H48" fill="none" stroke="${_N}" stroke-width="3" stroke-dasharray="220" stroke-dashoffset="${(220*(1-n)).toFixed(1)}"/><g opacity="${i.toFixed(2)}">${a(96,0,r[2],!0)}</g>`},wN.lowerThird=function(e,t){let n=(1-fO(t))*-260,r=e.text||`Name`,i=e.label||``,a=Math.max(r.length,i.length)*13+90;return`<g transform="translate(${n.toFixed(1)} 0)" opacity="${K(t*1.4,0,1).toFixed(2)}"><rect x="${-a/2}" y="-30" width="${a}" height="60" rx="8" fill="#1b2432"/><rect x="${-a/2}" y="-30" width="7" height="60" fill="${_N}"/>`+X(-a/2+22,-2,24,r,`#fff`,900,800,`start`)+(i?X(-a/2+22,20,15,i,_N,800,800,`start`):``)+`</g>`},wN.annotationArrow=function(e,t){let n=fO(t),r=e.dir||`up`,i={up:[0,-96],down:[0,96],left:[-120,0],right:[120,0]}[r]||[0,-96],a=i[0]*.6+(r===`up`||r===`down`?40:0),o=i[1]*.6+(r===`left`||r===`right`?-34:0),s=2*(1-n)*n*a+n*n*i[0],c=2*(1-n)*n*o+n*n*i[1],l=``;if(n>.85){let e=Math.atan2(c-o,s-a);l=`<path d="M${s.toFixed(1)} ${c.toFixed(1)} L${(s+Math.cos(e+2.6)*16).toFixed(1)} ${(c+Math.sin(e+2.6)*16).toFixed(1)} M${s.toFixed(1)} ${c.toFixed(1)} L${(s+Math.cos(e-2.6)*16).toFixed(1)} ${(c+Math.sin(e-2.6)*16).toFixed(1)}" stroke="${vN}" stroke-width="5" stroke-linecap="round" fill="none"/>`}let u=e.text?`<g transform="translate(${(-i[0]*.1).toFixed(1)} ${(-i[1]*.1).toFixed(1)})">${SN(e.text.length*11+28,38,`#fff`)}${X(0,6,17,e.text,gN,900)}</g>`:``;return`<path d="M0 0 Q${a.toFixed(1)} ${o.toFixed(1)} ${s.toFixed(1)} ${c.toFixed(1)}" fill="none" stroke="${vN}" stroke-width="5" stroke-linecap="round"/>${l}${u}`},wN.circleHighlight=function(e,t,n){let r=fO(t),i=e.value==null?52:e.value,a=i*.74,o=300*(1-r);return`<g transform="rotate(-8) scale(${(1+.02*Math.sin((n||0)*4)).toFixed(3)})"><path d="M${i} -6 C${i} ${-a*1.1} ${-i*.4} ${-a*1.25} ${-i} ${-a*.3} C${-i*1.3} ${a*.7} ${-i*.3} ${a*1.25} ${i*.5} ${a} C${i*1.25} ${a*.75} ${i*1.05} ${-a*.2} ${i*.9} ${-a*.9}" fill="none" stroke="${e.tint||bN}" stroke-width="5" stroke-linecap="round" stroke-dasharray="300" stroke-dashoffset="${o.toFixed(1)}"/></g>${e.label?X(0,a+30,18,e.label,gN,900):``}`},wN.floorPlanBoard=function(e,t){let n=(1-fO(t))*28,r=`<g transform="translate(${e.px==null?0:e.px} ${((e.py==null?-30:e.py)-20-n).toFixed(1)})" opacity="${K(t*1.4,0,1).toFixed(2)}"><path d="M0 0 C-13 -17 -9 -32 0 -32 C9 -32 13 -17 0 0 Z" fill="${e.tint||vN}"/><circle cx="0" cy="-22" r="5" fill="#fff"/></g>`,i=e.label?`<g transform="translate(0 -110)">${SN(e.label.length*12+28,38)}${X(0,6,18,e.label,gN,900)}</g>`:``;return`<g opacity="${t.toFixed(2)}"><rect x="-140" y="-90" width="280" height="180" rx="10" fill="#f4f7f8" stroke="#c7d3d9" stroke-width="3"/><line x1="0" y1="-90" x2="0" y2="50" stroke="#c7d3d9" stroke-width="3"/><line x1="-140" y1="10" x2="0" y2="10" stroke="#c7d3d9" stroke-width="3"/><line x1="0" y1="-20" x2="140" y2="-20" stroke="#c7d3d9" stroke-width="3"/><rect x="-8" y="86" width="16" height="8" fill="#f4f7f8" stroke="none"/>${i}</g>${r}`},wN.titleCard=function(e,t){return`<g transform="translate(0 ${((1-fO(t))*22).toFixed(1)})" opacity="${K(t*1.3,0,1).toFixed(2)}"><line x1="-290" y1="-56" x2="290" y2="-56" stroke="${_N}" stroke-width="3"/>`+X(0,6,62,e.text||`Title`,gN,900)+(e.label?X(0,52,24,e.label,yN,800):``)+`<line x1="-290" y1="86" x2="290" y2="86" stroke="${_N}" stroke-width="3"/></g>`},wN.chapterCard=function(e,t){let n=fO(t),r=K(n*1.2,0,1),i=e.value==null?1:e.value;return`<g opacity="${t.toFixed(2)}"><rect x="-280" y="-58" width="${(560*r).toFixed(1)}" height="116" rx="12" fill="#1b2432"/>`+X(-234,18,68,``+i,_N,900,800,`start`)+(r>.6?X(-160,-6,20,`CHAPTER`,`#9fb0c4`,900,800,`start`)+X(-160,26,30,e.text||``,`#fff`,900,800,`start`):``)+`</g>`},wN.ctaCard=function(e,t,n){let r=fO(t),i=1+.03*Math.sin((n||0)*4),a=Math.max(320,(e.text||`Get started`).length*20+120);return`<g transform="scale(${(r*i).toFixed(3)})" opacity="${t.toFixed(2)}">`+(e.label?X(0,-58,24,e.label,gN,800):``)+`<rect x="${-a/2}" y="-34" width="${a}" height="68" rx="34" fill="${vN}"/>${X(0,9,28,e.text||`Get started`,`#fff`,900)}<path d="M${a/2-44} -8 l16 8 l-16 8" stroke="#fff" stroke-width="4" fill="none" stroke-linecap="round" stroke-linejoin="round"/></g>`},wN.endCard=function(e,t){let n=fO(t);return`<g opacity="${K(t*1.3,0,1).toFixed(2)}"><circle cx="0" cy="-64" r="${(30*n).toFixed(1)}" fill="${_N}"/>${n>.5?`<path d="M-11 -64 l7 8 l14 -16" stroke="#fff" stroke-width="5" fill="none" stroke-linecap="round" stroke-linejoin="round"/>`:``}`+X(0,8,52,e.text||`The End`,gN,900)+(e.label?X(0,48,22,e.label,yN,800):``)+`<line x1="-220" y1="76" x2="220" y2="76" stroke="#e7edf1" stroke-width="2"/></g>`},wN.recapCarousel=function(e,t){let n=e.labels||[`One`,`Two`,`Three`],r=Math.min(n.length,4),i=fO(t),a=r*150+(r-1)*18,o=e.label?X(0,-96,24,e.label,gN,900):``;for(let e=0;e<r;e++){let t=K(i*r-e,0,1),s=-a/2+75+e*168,c=(1-t)*16;o+=`<g transform="translate(${s.toFixed(1)} ${c.toFixed(1)})" opacity="${t.toFixed(2)}"><rect x="-75" y="-56" width="150" height="112" rx="12" fill="#fff" stroke="rgba(20,40,50,.1)"/><circle cx="0" cy="-22" r="16" fill="${[_N,bN,vN,xN][e%4]}"/>${X(0,-15,18,``+(e+1),`#fff`,900)}`+X(0,30,16,n[e],gN,800)+`</g>`}return o},TN=Object.keys(wN),EN=[`titleCard`,`chapterCard`,`ctaCard`,`endCard`,`recapCarousel`]}));function ON(e){return VN[(e||``).toLowerCase()]||VN.default}function kN(e,t){return{dx:Math.sin(e*.18+t)*26,dy:Math.sin(e*.9+t)*6}}function AN(e){let[t,n]=zN[e.size]||zN.M,r=e.depthScale==null?1:e.depthScale,i=t*r,a=n*r,o=e.tint||ON(e.label),s=e.silhouette==null?e.z!=null&&e.z>.72:e.silhouette,c=Math.min(16*r,a*.18),l=s?0:Math.min(12*r,a*.16),u=e.shadow===!1?``:`<ellipse cx="0" cy="4" rx="${(i*.56).toFixed(1)}" ry="${(9*r).toFixed(1)}" fill="#000" opacity="${s?.1:.16}"/>`,d=`<rect x="${(-i/2).toFixed(1)}" y="${(-a).toFixed(1)}" width="${i.toFixed(1)}" height="${a.toFixed(1)}" rx="${c.toFixed(1)}" fill="${s?sO(o,.42):o}"/>`,f=l?`<rect x="${(-i/2+3).toFixed(1)}" y="${(-a+2).toFixed(1)}" width="${(i-6).toFixed(1)}" height="${l.toFixed(1)}" rx="${(c*.5).toFixed(1)}" fill="${sO(o,1.24)}" opacity="0.85"/>`:``,p=s?``:`<rect x="${(-i/2).toFixed(1)}" y="${(-a*.28).toFixed(1)}" width="${i.toFixed(1)}" height="${(a*.28).toFixed(1)}" rx="${c.toFixed(1)}" fill="${sO(o,.78)}" opacity="0.5"/>`,m=K(Math.round(15*r),8,22);return`${u}${d}${p}${f}${s?``:`<text x="0" y="${(-a/2).toFixed(1)}" text-anchor="middle" dominant-baseline="central" font-family="Nunito,system-ui,sans-serif" font-weight="800" font-size="${m}" fill="#f2f5f8" opacity="0.92" letter-spacing="0.5">${(e.label||``).toString().slice(0,12).toUpperCase()}</text>`}`}function jN(e,t){let[n,r]=zN[e.size]||zN.M,i=e.depthScale==null?1:e.depthScale,a=n*i,o=r*i,s=e.silhouette==null?e.z!=null&&e.z>.72:e.silhouette,c=e.shadow===!1?``:`<ellipse cx="0" cy="4" rx="${(a*.56).toFixed(1)}" ry="${(9*i).toFixed(1)}" fill="#000" opacity="${s?.1:.16}"/>`,l=`0 0 ${t.w||100} ${t.h||100}`,u=s?` style="filter:brightness(0.28) saturate(0.4)"`:``;return`${c}${`<svg x="${(-a/2).toFixed(1)}" y="${(-o).toFixed(1)}" width="${a.toFixed(1)}" height="${o.toFixed(1)}" viewBox="${l}" preserveAspectRatio="xMidYMax meet" overflow="visible"${u}>${t.inner}</svg>`}`}function MN(e){let[t,n]=zN[e.size]||zN.M,r=e.depthScale==null?1:e.depthScale,i=t*r,a=n*r;return{muzzle:{dx:i*.5,dy:-a*.62},smoke:{dx:0,dy:-a},center:{dx:0,dy:-a*.5}}}function NN(e){let t=e.depthScale||1,n=(WN[e.size]||94)*t/2,r=e.tint||ON(e.label),i=e.silhouette,a=(e.label||``).toString().slice(0,5).toUpperCase();return qN(t,n*.9,e.shadow)+`<circle cx="0" cy="${-n}" r="${n.toFixed(1)}" fill="${i?sO(r,.45):r}"/><circle cx="0" cy="${-n}" r="${n.toFixed(1)}" fill="none" stroke="rgba(0,0,0,.16)"/>`+(i?``:`<text x="0" y="${(-n+KN(t)*.36).toFixed(1)}" text-anchor="middle" dominant-baseline="middle" font-family="Nunito,system-ui,sans-serif" font-weight="900" font-size="${KN(t,16)}" fill="#fff">${a}</text>`)}function PN(e){let t=e.depthScale||1,n=(WN[e.size]||94)*t/2,r=e.tint||`#8aa0b5`,i=e.silhouette,a=GN(e.label);return qN(t,n*.9,e.shadow)+`<circle cx="0" cy="${-n}" r="${(n+3*t).toFixed(1)}" fill="none" stroke="${i?sO(r,.5):r}" stroke-width="${(3.5*t).toFixed(1)}"/><circle cx="0" cy="${-n}" r="${n.toFixed(1)}" fill="${i?sO(`#c9b7a6`,.5):`#d9c7b6`}"/>`+(i?``:`<text x="0" y="${(-n+KN(t)*.36).toFixed(1)}" text-anchor="middle" dominant-baseline="middle" font-family="Nunito,system-ui,sans-serif" font-weight="900" font-size="${KN(t,18)}" fill="${r}">${a}</text>`)}function FN(e){let[t,n]=zN[e.size]||zN.M,r=e.depthScale||1,i=t*r,a=n*r,o=e.tint||`#7a8794`,s=e.silhouette,c=(e.label||`IMAGE`).toString().slice(0,12).toUpperCase(),l=`<rect x="${-i/2}" y="${-a}" width="${i.toFixed(1)}" height="${a.toFixed(1)}" rx="6" fill="${s?sO(o,.42):`#eef1f4`}" stroke="${s?sO(o,.3):o}" stroke-width="${(3*r).toFixed(1)}"/>`,u=s?``:`<line x1="${-i/2+6}" y1="-6" x2="${i/2-6}" y2="${-a+8}" stroke="${o}" stroke-width="1.5" opacity="0.5"/><line x1="${-i/2+6}" y1="${-a+8}" x2="${i/2-6}" y2="-6" stroke="${o}" stroke-width="1.5" opacity="0.5"/><rect x="${-i/2}" y="${-a*.26}" width="${i.toFixed(1)}" height="${(a*.26).toFixed(1)}" rx="0" fill="${o}" opacity="0.9"/><text x="0" y="${(-a*.1).toFixed(1)}" text-anchor="middle" font-family="Nunito,system-ui,sans-serif" font-weight="800" font-size="${KN(r,13)}" fill="#fff">${c}</text>`;return qN(r,i*.5,e.shadow)+l+u}function IN(e){let t=e.depthScale||1,n=(WN[e.size]||94)*.7*t,r=e.tint||ON(e.label),i=e.silhouette,a=GN(e.label).slice(0,1)||`A`;return qN(t,n*.6,e.shadow)+`<rect x="${-n/2}" y="${-n}" width="${n.toFixed(1)}" height="${n.toFixed(1)}" rx="${(n*.22).toFixed(1)}" fill="${i?sO(r,.45):r}"/>`+(i?``:`<text x="0" y="${(-n/2+KN(t)*.36).toFixed(1)}" text-anchor="middle" dominant-baseline="middle" font-family="Nunito,system-ui,sans-serif" font-weight="900" font-size="${KN(t,22)}" fill="#fff">${a}</text>`)}function LN(e){switch(e.face){case`flagRoundel`:return NN(e);case`portraitCircle`:return PN(e);case`imageFrame`:return FN(e);case`logoTile`:return IN(e);default:return AN(e)}}function RN(e){if(!e.face||e.face===`assetBox`)return MN(e);let t=e.depthScale==null?1:e.depthScale;if(e.face===`imageFrame`){let[n,r]=zN[e.size]||zN.M,i=n*t,a=r*t;return{muzzle:{dx:i*.5,dy:-a*.5},smoke:{dx:0,dy:-a},center:{dx:0,dy:-a*.5}}}let n=(WN[e.size]||94)*t,r=n/2;return{muzzle:{dx:r*.8,dy:-r},smoke:{dx:0,dy:-n},center:{dx:0,dy:-r}}}var zN,BN,VN,HN,UN,WN,GN,KN,qN,JN=o((()=>{pO(),zN={S:[78,54],M:[128,88],L:[198,134]},BN=[`ground`,`hover`,`mounted`],VN={default:`#4a5a6b`,tank:`#59636f`,jet:`#6b7686`,hq:`#6a5a72`,monument:`#7a6a54`,ship:`#496072`,arty:`#6b5a4a`,wall:`#5c5750`,truck:`#5a6a5a`},HN=[`assetBox`,`flagRoundel`,`portraitCircle`,`imageFrame`,`logoTile`],UN=e=>HN.includes(e),WN={S:64,M:94,L:132},GN=e=>(e||``).toString().trim().split(/\s+/).map(e=>e[0]||``).join(``).slice(0,3).toUpperCase()||(e||`?`).slice(0,2).toUpperCase(),KN=(e,t=15,n=8,r=22)=>K(Math.round(t*e),n,r),qN=(e,t,n)=>n===!1?``:`<ellipse cx="0" cy="4" rx="${t.toFixed(1)}" ry="${(8*e).toFixed(1)}" fill="#000" opacity="0.14"/>`}));function YN(e,t,n){let r=nP[e.type];return r?r(e,t,n):``}var XN,ZN,QN,$N,eP,tP,nP,rP=o((()=>{XN=[`flashImpact`,`smokeColumn`,`emberField`,`tracerArc`,`burst`,`speedLines`,`muzzleFlash`,`dustPuff`,`splash`,`ripple`,`glowPulse`,`shockwaveRing`,`confetti`,`sparkleGlint`,`coinBurst`,`heartsPuff`,`steamWisp`],ZN=[`burst`,`flashImpact`,`shockwaveRing`],QN={flashImpact:`screen`,speedLines:`screen`},$N={flashImpact:.16,muzzleFlash:.22,burst:.75,tracerArc:.7,smokeColumn:4,emberField:4,speedLines:1.5,dustPuff:.6,splash:.6,ripple:.9,glowPulse:2,shockwaveRing:.5,confetti:1.8,sparkleGlint:.7,coinBurst:.9,heartsPuff:1.6,steamWisp:3},eP=e=>QN[e]||`world`,tP=(e,t=.12,n=.25)=>Math.max(0,Math.min(1,e/t,(1-e)/n)),nP={smokeColumn(e,t,n){let r=e.tint||`#8b909a`,i=e.scale||1,a=tP(t,.15,.35),o=``;for(let e=0;e<6;e++){let t=(n*.4+e/6)%1,s=-t*160*i,c=(10+t*34)*i,l=a*(1-t)*.5;o+=`<circle cx="${(Math.sin(t*3+e)*10*i).toFixed(1)}" cy="${s.toFixed(1)}" r="${c.toFixed(1)}" fill="${r}" opacity="${l.toFixed(3)}"/>`}return o},emberField(e,t,n){let r=e.scale||1,i=tP(t,.2,.4),a=``;for(let e=0;e<14;e++){let t=(n*.6+e*.137)%1,o=(Math.sin(e*2.3)*40+Math.sin(n+e)*6)*r,s=-t*180*r,c=i*(1-t);a+=`<circle cx="${o.toFixed(1)}" cy="${s.toFixed(1)}" r="${((2+Math.sin(e)*1)*r).toFixed(1)}" fill="#ffb24a" opacity="${c.toFixed(3)}"/>`}return a},tracerArc(e,t){let n=e.bx==null?120:e.bx,r=e.by==null?-40:e.by,i=Math.min(1,t/.6),a=n*.5,o=Math.min(0,r)-70,s=2*(1-i)*i*a+i*i*n,c=2*(1-i)*i*o+i*i*r,l=1-Math.max(0,(t-.6)/.4);return`<path d="M 0 0 Q ${a.toFixed(1)} ${o.toFixed(1)} ${s.toFixed(1)} ${c.toFixed(1)}" stroke="#ffe07a" stroke-width="3" fill="none" opacity="${l.toFixed(3)}" stroke-linecap="round"/>`+(t>.6?`<circle cx="${n.toFixed(1)}" cy="${r.toFixed(1)}" r="${(6+(t-.6)*44).toFixed(1)}" fill="#fff6c8" opacity="${(1-(t-.6)/.4).toFixed(3)}"/>`:``)},burst(e,t){let n=1-t,r=e.scale||1,i=`<circle r="${((6+t*70)*r).toFixed(1)}" fill="none" stroke="#ffcaa0" stroke-width="${(4*n).toFixed(1)}" opacity="${(n*.8).toFixed(3)}"/>`;for(let e=0;e<10;e++){let a=e/10*6.283,o=(20+t*90)*r;i+=`<line x1="${(Math.cos(a)*10*r).toFixed(1)}" y1="${(Math.sin(a)*10*r).toFixed(1)}" x2="${(Math.cos(a)*o).toFixed(1)}" y2="${(Math.sin(a)*o).toFixed(1)}" stroke="#ffd85e" stroke-width="${(3*n).toFixed(1)}" opacity="${n.toFixed(3)}"/>`}return i},muzzleFlash(e,t){let n=Math.max(0,1-t*3),r=e.scale||1;return n<=0?``:`<circle r="${((10+t*6)*r).toFixed(1)}" fill="#fff2b0" opacity="${n.toFixed(3)}"/><path d="M0 0 L ${(28*r).toFixed(1)} ${(-4*r).toFixed(1)} L ${(30*r).toFixed(1)} ${(4*r).toFixed(1)} Z" fill="#ffd85e" opacity="${n.toFixed(3)}"/>`},flashImpact(e,t){let n=Math.max(0,1-t*1.4);return`<rect x="-80" y="-80" width="${(e.VBW||1138)+160}" height="800" fill="${e.tint||`#ffffff`}" opacity="${(n*(e.intensity||.9)).toFixed(3)}"/>`},speedLines(e,t,n){let r=tP(t,.1,.3),i=e.VBW||1138,a=``;for(let e=0;e<9;e++){let t=e/9*640+20,o=(n*320+e*61)%(i+200);a+=`<line x1="${(o-180).toFixed(1)}" y1="${t.toFixed(1)}" x2="${o.toFixed(1)}" y2="${t.toFixed(1)}" stroke="#ffffff" stroke-width="2" opacity="${(r*.32).toFixed(3)}"/>`}return a}},Object.assign(nP,{dustPuff(e,t){let n=1-t,r=e.scale||1,i=``;for(let e=0;e<5;e++){let a=e/5*6.283,o=(10+t*46)*r;i+=`<circle cx="${(Math.cos(a)*o).toFixed(1)}" cy="${(-Math.sin(a)*o*.5).toFixed(1)}" r="${((10+t*16)*r).toFixed(1)}" fill="#b9ad97" opacity="${(n*.5).toFixed(2)}"/>`}return i},splash(e,t){let n=e.scale||1,r=1-t,i=`<path d="M ${(-24*n).toFixed(1)} 0 Q 0 ${(-30*(1-Math.abs(t-.4))*n).toFixed(1)} ${(24*n).toFixed(1)} 0" fill="none" stroke="#8fd0e0" stroke-width="${(3*r).toFixed(1)}" opacity="${r.toFixed(2)}"/>`;for(let e=0;e<6;e++){let a=e/6*Math.PI,o=(14+t*40)*n;i+=`<circle cx="${(Math.cos(a)*o).toFixed(1)}" cy="${(-Math.sin(a)*o).toFixed(1)}" r="${(3*r).toFixed(1)}" fill="#7fb2e0" opacity="${r.toFixed(2)}"/>`}return i},ripple(e,t){let n=e.scale||1,r=``;for(let e=0;e<3;e++){let i=t-e*.18;i<=0||(r+=`<ellipse cx="0" cy="0" rx="${(i*70*n).toFixed(1)}" ry="${(i*24*n).toFixed(1)}" fill="none" stroke="#9fd0e8" stroke-width="2" opacity="${((1-i)*.7).toFixed(2)}"/>`)}return r},glowPulse(e,t){let n=.5+.5*Math.sin(t*Math.PI*4),r=(26+n*14)*(e.scale||1),i=e.tint||`#ffe07a`;return`<circle r="${r.toFixed(1)}" fill="${i}" opacity="${(.18+n*.16).toFixed(2)}"/><circle r="${(r*.5).toFixed(1)}" fill="${i}" opacity="${(.2+n*.2).toFixed(2)}"/>`},shockwaveRing(e,t){let n=e.scale||1,r=1-t;return`<circle r="${(t*130*n).toFixed(1)}" fill="none" stroke="#ffffff" stroke-width="${(8*r).toFixed(1)}" opacity="${(r*.8).toFixed(2)}"/>`},confetti(e,t,n){let r=e.scale||1,i=[`#ff6b5e`,`#2bb3a3`,`#f2b134`,`#5b6ce0`,`#ff7ab0`],a=``;for(let e=0;e<16;e++){let o=(e*37%100-50)*r,s=(-40+t*120+e%5*8)*r,c=(n*6+e)%6.283;a+=`<rect x="${o.toFixed(1)}" y="${s.toFixed(1)}" width="${(7*r).toFixed(1)}" height="${(11*r).toFixed(1)}" fill="${i[e%5]}" transform="rotate(${(c*57).toFixed(0)} ${o.toFixed(1)} ${s.toFixed(1)})" opacity="${(1-t*.6).toFixed(2)}"/>`}return a},sparkleGlint(e,t,n){let r=e.scale||1,i=``;for(let e=0;e<4;e++){let a=e/4*6.283,o=22*r,s=.5+.5*Math.sin(n*8+e*2),c=(5+s*5)*r,l=Math.cos(a)*o,u=Math.sin(a)*o;i+=`<path transform="translate(${l.toFixed(1)} ${u.toFixed(1)})" d="M0 ${-c} L ${c*.3} ${-c*.3} L ${c} 0 L ${c*.3} ${c*.3} L 0 ${c} L ${-c*.3} ${c*.3} L ${-c} 0 L ${-c*.3} ${-c*.3} Z" fill="#fff2b0" opacity="${(s*(1-t)).toFixed(2)}"/>`}return i},coinBurst(e,t,n){let r=e.scale||1,i=``;for(let e=0;e<8;e++){let a=e/8*6.283,o=Math.sin(t*Math.PI),s=Math.cos(a)*t*60*r,c=(-o*70+t*40)*r;i+=`<ellipse cx="${s.toFixed(1)}" cy="${c.toFixed(1)}" rx="${((7+3*Math.sin(n*8+e))*r).toFixed(1)}" ry="${(9*r).toFixed(1)}" fill="#f2b134" stroke="#c98a3a" stroke-width="1" opacity="${(1-t*.7).toFixed(2)}"/>`}return i},heartsPuff(e,t,n){let r=e.scale||1,i=``;for(let e=0;e<5;e++){let a=(t+e*.18)%1,o=(Math.sin(n+e*2)*20+(e-2)*12)*r,s=-a*90*r;i+=`<path transform="translate(${o.toFixed(1)} ${s.toFixed(1)}) scale(${((.5+(1-a)*.5)*r).toFixed(2)})" d="M0 3 C -7 -8 -20 0 0 14 C 20 0 7 -8 0 3 Z" fill="#ff6b8a" opacity="${(1-a).toFixed(2)}"/>`}return i},steamWisp(e,t,n){let r=e.scale||1,i=tP(t,.2,.4),a=``;for(let e=0;e<2;e++){let t=(e?12:-12)*r;a+=`<path d="M ${t} 0 ${[0,1,2,3].map(i=>`Q ${(t+Math.sin(n*1.2+i+e)*14*r).toFixed(1)} ${(-20*(i+.5)*r).toFixed(1)} ${(t+Math.sin(n*1.2+i+1+e)*10*r).toFixed(1)} ${(-20*(i+1)*r).toFixed(1)}`).join(` `)}" fill="none" stroke="#dfeaf2" stroke-width="${(6*r).toFixed(1)}" stroke-linecap="round" opacity="${(i*.4).toFixed(2)}"/>`}return a}})}));function iP(e,t){let n=[],r=Math.max(1,t|0);if(e===`column`){for(let e=0;e<r;e++)n.push({nx:e%2?.16:-.16,row:e,depthRank:r>1?e/(r-1):0});return n}if(e===`line`){for(let e=0;e<r;e++)n.push({nx:r>1?e/(r-1)*2-1:0,row:0,depthRank:0});return n}if(e===`wedge`){let e=0,t=0;for(;e<r;){let i=t*2+1;for(let a=0;a<i&&e<r;a++)n.push({nx:i>1?a/(i-1)*2-1:0,row:t,depthRank:0}),e++;t++}let i=t-1;return n.forEach(e=>e.depthRank=i>0?e.row/i:0),n}let i=Math.ceil(Math.sqrt(r)),a=Math.ceil(r/i);for(let e=0;e<r;e++){let t=e%i,r=Math.floor(e/i);n.push({nx:i>1?t/(i-1)*2-1:0,row:r,depthRank:a>1?r/(a-1):0})}return n}function aP(e,t){let n=e.depthScale||1,r=e.tier===`far`,i=e.cycle||`march`,a=t*(i===`run`||i===`flee`?8:i===`idle`?1.5:5)+(e.phase||0),o=i===`idle`?2:i===`cheer`?1:i===`run`||i===`flee`?20:13,s=Math.sin(a)*o,c=Math.sin(a+Math.PI)*o,l=i===`cheer`,u=i===`flee`?22:i===`idle`?3:9,d=Math.sin(a+Math.PI)*u,f=Math.sin(a)*u,p=i===`run`||i===`flee`?6:0,m=i===`flee`?-3*n:0,h=108*n,g=-h*.42,_=-h*.72,v=-h*.86,y=6*n,b=r?`#2b333f`:oP(`#5c6b52`,e.tone||0),x=r?b:oP(`#c99a6a`,(e.tone||0)*.5),S=Math.max(2,7*n),C=Math.max(2,5.5*n),w=(e,t)=>`<line x1="${e.toFixed(1)}" y1="${g.toFixed(1)}" x2="${(e+t*n+p*n).toFixed(1)}" y2="0" stroke="${b}" stroke-width="${S.toFixed(1)}" stroke-linecap="round"/>`,T=(e,t)=>l?`<line x1="${e.toFixed(1)}" y1="${(_+3*n).toFixed(1)}" x2="${(e+Math.sign(e)*10*n).toFixed(1)}" y2="${(_-20*n).toFixed(1)}" stroke="${b}" stroke-width="${C.toFixed(1)}" stroke-linecap="round"/>`:`<line x1="${e.toFixed(1)}" y1="${(_+3*n).toFixed(1)}" x2="${(e+t*n).toFixed(1)}" y2="${(_+24*n).toFixed(1)}" stroke="${b}" stroke-width="${C.toFixed(1)}" stroke-linecap="round"/>`,E=`<ellipse cx="0" cy="2" rx="${(15*n).toFixed(1)}" ry="${(4*n).toFixed(1)}" fill="#000" opacity="0.12"/>`,D=`<rect x="${(-9*n).toFixed(1)}" y="${_.toFixed(1)}" width="${(18*n).toFixed(1)}" height="${(g-_+4*n).toFixed(1)}" rx="${(6*n).toFixed(1)}" fill="${b}"/>`,O=`<circle cx="${m.toFixed(1)}" cy="${v.toFixed(1)}" r="${(9*n).toFixed(1)}" fill="${x}"/>`+(r?``:`<path d="M ${(m-10*n).toFixed(1)} ${(v-3*n).toFixed(1)} q ${(10*n).toFixed(1)} ${(-12*n).toFixed(1)} ${(20*n).toFixed(1)} 0 z" fill="${b}"/>`);return`<g opacity="${(e.opacity==null?1:e.opacity).toFixed(3)}">${E}${w(-y,s)}${w(y,c)}${D}${T(-10*n,d)}${T(10*n,f)}${O}</g>`}var oP,sP=o((()=>{pO(),oP=(e,t)=>sO(e,1+t)}));function cP(e,t){return(e||[]).map(e=>mP[e]?mP[e](t):``).join(``)}var lP,uP,dP,fP,pP,mP,hP=o((()=>{lP=[`wet`,`cold`,`hot`,`dirty`,`sleepy`,`inLove`,`confused`,`injured`],uP=(e,t=1)=>e.toFixed(t),dP=(e,t,n,r,i=`#ff6b8a`)=>`<path transform="translate(${uP(e)} ${uP(t)}) scale(${uP(n,3)})" d="M0 3 C -7 -8 -20 0 0 14 C 20 0 7 -8 0 3 Z" fill="${i}" opacity="${uP(r,2)}"/>`,fP=(e,t,n,r,i)=>`<line x1="${uP(e)}" y1="${uP(t)}" x2="${uP(e)}" y2="${uP(t+n)}" stroke="${r}" stroke-width="3" stroke-linecap="round" opacity="${uP(i,2)}"/>`,pP=(e,t,n,r,i,a=1)=>`<text x="${uP(e)}" y="${uP(t)}" font-family="Nunito,system-ui,sans-serif" font-weight="900" font-size="${uP(n)}" text-anchor="middle" fill="${i}" opacity="${uP(a,2)}">${r}</text>`,mP={wet:e=>{let t=``;for(let n=0;n<5;n++){let r=(e*.8+n*.2)%1,i=-34+n*17;t+=fP(i,30+r*70,8,`#7fb2e0`,1-r)}return t},cold:e=>{let t=e*.55%1;return`<ellipse cx="20" cy="6" rx="${uP(5+t*12)}" ry="${uP(3+t*7)}" fill="#e6eef4" opacity="${uP(.55*(1-t),2)}"/>`+fP(-24,-34,6,`#bcd7e4`,.8)+fP(24,-30,6,`#bcd7e4`,.8)},hot:e=>{let t=``;for(let n=0;n<2;n++){let r=(e*.7+n*.5)%1;t+=`<path transform="translate(${uP(n?26:-26)} ${uP(-24+r*30)})" d="M0 -6 C 5 0 5 8 0 8 C -5 8 -5 0 0 -6 Z" fill="#8fd0e0" opacity="${uP(1-r,2)}"/>`}return t},dirty:()=>{let e=``;return[[-20,34,10],[16,46,8],[-6,60,7],[24,30,6]].forEach(([t,n,r])=>e+=`<circle cx="${t}" cy="${n}" r="${r}" fill="#6b5a45" opacity="0.5"/>`),e},sleepy:e=>{let t=``;for(let n=0;n<3;n++){let r=(e*.5+n*.33)%1;t+=pP(18+r*30,-30-r*40,12+r*10,`Z`,`#5b6ce0`,1-r)}return t},inLove:e=>{let t=``;for(let n=0;n<3;n++){let r=(e*.6+n*.34)%1;t+=dP(-14+n*16+Math.sin(e*2+n)*6,-26-r*50,.7+(1-r)*.5,1-r)}return t},confused:e=>pP(0,-38+Math.sin(e*2.5)*4,30,`?`,`#c98a3a`)+`<circle cx="14" cy="-14" r="3" fill="#c98a3a" opacity="${uP(.5+.5*Math.sin(e*4),2)}"/>`,injured:()=>`<rect x="-18" y="-16" width="36" height="12" rx="3" fill="#e8dcc0" transform="rotate(-16)"/><rect x="-3" y="-22" width="6" height="12" fill="#c05050" transform="rotate(-16)"/><rect x="-9" y="-16" width="12" height="4" fill="#c05050" transform="rotate(-16)"/>`}}));function gP(e,t,n,r){let i=e.enter;if(!i||i.type===`carryOver`)return{};let a=i.type,o=i.atPhrase==null?n:t[i.atPhrase].t,s=o+IP,c=e.pos&&e.pos.x||.5,l=a===`walkIn`||a===`runIn`;if(r<o)return l?{opacity:1,xOverride:LP(i.from),forceWalk:a===`walkIn`,forceRun:a===`runIn`}:a===`dropIn`?{opacity:0,yOverride:-280}:a===`riseFrom`?{opacity:0,yOverride:220}:{opacity:0};if(r>=s)return{};let u=dO((r-o)/IP);if(l)return{opacity:1,xOverride:lO(LP(i.from),c,u),forceWalk:a===`walkIn`,forceRun:a===`runIn`};if(a===`popIn`){let e=dO(K((r-o)/.3,0,1));return{opacity:e,scaleMul:.55+.45*e+Math.max(0,Math.sin(e*Math.PI))*.15}}return a===`dropIn`?{opacity:K(u*2,0,1),yOverride:lO(-280,0,u)}:a===`riseFrom`?{opacity:K(u*2,0,1),yOverride:lO(220,0,u)}:{opacity:u}}function _P(e,t){let n=aO(e||`x`),r=7+n%5,i=.5+.5*Math.sin(t*(2.3+n%3)),a=K(i*(.55+.45*Math.sin(t*r))*(Math.sin(t*1.9+n%7)>-.4?1:.15),0,1);return{mOpen:1+a*14,mWidth:12+a*16,mCurve:2+Math.sin(t*4.6)*5}}function vP(e){if(!e||!Array.isArray(e.phrases))throw new UP(`audio.phrases must be an array`);let t=e.phrases.map((e,t)=>{if(typeof e==`string`){let n=e.match(/^(\d+):(\d+(?:\.\d+)?)\s+(.*)$/);if(!n)throw new UP(`phrase ${t} is not "M:SS.d text": ${JSON.stringify(e)}`);return{t:n[1]*60+parseFloat(n[2]),text:n[3]}}if(e&&typeof e==`object`&&typeof e.t==`number`&&typeof e.text==`string`)return{t:e.t,text:e.text};throw new UP(`phrase ${t} must be "M:SS.d text" or {t:Number,text:String}`)});if(t.sort((e,t)=>e.t-t.t),!t.length)throw new UP(`audio.phrases is empty`);return t}function yP(e,t){return e.meta&&typeof e.meta.durationMs==`number`?e.meta.durationMs/1e3:t[t.length-1].t+HP}function bP(e,t){let n=0;for(let r=0;r<e.length;r++)e[r].t<=t+1e-9&&(n=r);return n}function xP(e,t,n){let r=e.map((e,t)=>({s:e,i:t})).sort((e,t)=>e.s.startPhrase-t.s.startPhrase);return r.map((e,i)=>{let a=t[e.s.startPhrase].t,o=i+1<r.length?t[r[i+1].s.startPhrase].t:n;return{scene:e.s,t0:a,t1:o}})}function SP(e,t){let n=oO(e),r=1.2+n()*2;for(;r<=t+.14;){if(t>=r&&t<r+.14)return Math.sin(Math.PI*(t-r)/.14);r+=2.64+n()*3}return 0}function CP(e,t,n,r){let i=`idle`,a=r,o=`idle`,s=r,c=null,l=(e.track||[]).filter(e=>e.action).sort((e,t)=>e.atPhrase-t.atPhrase);for(let e of l)e.atPhrase<=n&&(o=i,s=a,i=e.action,a=t[e.atPhrase].t,c=e);let u={};return c&&(c.speed&&(u.speed=c.speed),c.intensity&&(u.intensity=c.intensity),c.target!=null&&(u.target=c.target)),{action:i,start:a,prevAction:o,prevStart:s,opts:u}}function wP(e,t,n,r){let i=e.facing||`front`,a=-99,o=(e.track||[]).slice().sort((e,t)=>e.atPhrase-t.atPhrase);for(let e of o)if(e.atPhrase<=n&&(e.facing||e.action===`turn`)){let n=e.facing||i;(n!==i||e.action===`turn`)&&(n!==i&&(i=n),a=t[e.atPhrase].t)}let s=Math.abs(r-a),c=a>=0&&s<zP?.15+s/zP*.85:1;return{facing:i,squash:c}}function TP(e,t,n,r,i){let a=UN(e.face)?e.face:`assetBox`,o=e.plane==null?.5:e.plane,s=GM(o,r),c=e.x==null?.5:e.x,l=BN.includes(e.placement)?e.placement:`ground`,u=c*n,d;if(l===`hover`){let n=kN(t,aO(e.label||`x`)%20*.31);u+=n.dx,d=205+s.yShift*.35+n.dy}else d=l===`mounted`?480+s.yShift:MP+s.yShift;let f={kind:`placeholder`,face:a,id:e.id||null,label:e.label||``,size:e.size||`M`,placement:l,source:e.source||`placeholder`,z:o,x:u,y:d,depthScale:s.scale,opacity:s.opacity,blur:s.blur,tint:e.tint||(a===`assetBox`||a===`flagRoundel`||a===`logoTile`?ON(e.label):null),silhouette:o>.72},p=RN({face:a,size:f.size,depthScale:f.depthScale});return f.anchors={muzzle:{x:u+p.muzzle.dx,y:d+p.muzzle.dy},smoke:{x:u+p.smoke.dx,y:d+p.smoke.dy},center:{x:u+p.center.dx,y:d+p.center.dy}},f.emits=e.emits||[],f}function EP(e,t,n,r,i){let a=K(e.count|0,1,60),o=NP.includes(e.shape)?e.shape:`grid`,s=PP.includes(e.cycle)?e.cycle:`march`,c=e.plane==null?.6:e.plane,l=e.x==null?.5:e.x,u=(e.width==null?.55:e.width)*n,d=oO(i+`:form:`+(e.id||e.ref||`s`)),f=iP(o,a).map(e=>{let t=K(c+e.depthRank*.16,0,.98),i=GM(t,r),a=1+(d()-.5)*.08,o=(d()-.5)*.16,f=l*n+e.nx*u*.5*(1-e.depthRank*.14)+(d()-.5)*12,p=MP+i.yShift-e.depthRank*6,m=t>.72?`far`:t>.52?`mid`:`near`;return{x:f,y:p,z:t,depthScale:i.scale*a,opacity:i.opacity,phase:d()*6.283,cycle:s,tone:o,tier:m}}).sort((e,t)=>t.z-e.z);return{kind:`formation`,z:f.reduce((e,t)=>e+t.z,0)/Math.max(1,f.length),id:e.id||null,count:f.length,cycle:s,units:f}}function DP(e,t,n,r,i){let a=K(e.count|0,1,50),o=e.plane==null?.62:e.plane,s=e.dir===`left`?-1:1,c=(e.speed||1)*42,l=n*1.3,u=-n*.15,d=PP.includes(e.cycle)?e.cycle:`march`,f=oO(i+`:flow:`+(e.id||e.ref||`f`)),p=[];for(let e=0;e<a;e++){let e=((f()*l+t*c*s)%l+l)%l,n=u+e,i=K(Math.min(e/(l*.08),(l-e)/(l*.08),1),0,1),a=K(o+(f()-.5)*.08,0,.98),m=GM(a,r);p.push({x:n,y:MP+m.yShift,z:a,depthScale:m.scale*(1+(f()-.5)*.06),opacity:m.opacity*i,phase:f()*6.283,cycle:d,tone:(f()-.5)*.16,tier:a>.72?`far`:a>.52?`mid`:`near`})}return p.sort((e,t)=>t.z-e.z),{kind:`formation`,z:o,id:e.id||null,count:a,cycle:d,units:p}}function OP(e,t,n,r){let i=e.pos&&typeof e.pos.x==`number`?e.pos.x:.5,a=(e.track||[]).filter(e=>e.action===`walk`&&e.to&&typeof e.to.x==`number`).sort((e,t)=>e.atPhrase-t.atPhrase);for(let e=0;e<a.length;e++){let o=a[e],s=t[o.atPhrase].t,c=a[e+1]?t[a[e+1].atPhrase].t:Math.min(s+2.2,n),l=o.to.x;if(r>=c)i=l;else if(r>=s){i=lO(i,l,dO((r-s)/Math.max(.001,c-s)));break}else break}return i}function kP(e,t){let n=vP(e.audio),r=yP(e,n),i=K(t,0,r),a=e.meta&&e.meta.aspect||`16:9`,o=mO(a),s=e.meta&&e.meta.seed||42,c=e.meta&&e.meta.style||{},l=c.bob!==!1,u=c.shadow!==!1,d=bP(n,i),f=xP(e.scenes,n,r),p=f[0];for(let e of f)i>=e.t0-1e-9&&(p=e);let m=null,h=1;if(i<p.t0+VP){let e=f[f.indexOf(p)-1];e&&(m=AP(e.scene),h=K((i-p.t0)/VP,0,1))}let g=AP(p.scene),_=e.meta&&e.meta.palette||`auto`,v={};e.cast.forEach(e=>v[e.id]=Yk(e.params||{},_));let y=p.scene,b={},x=[],S=[],C=jj(y.setup.name)?QA[y.setup.palette||`day`]||`light`:Pj[y.setup.name]||`light`;(y.dialogue||[]).forEach(e=>{e.phrase===d&&(e.style===`narrationCard`?S.push({text:e.text||n[e.phrase].text,anchor:e.anchor||`skyBand`,tone:C}):e.style===`fullCard`?S.push({text:e.text||n[e.phrase].text,tone:C,full:!0}):(b[e.speaker]=!0,x.push({ref:e.speaker,text:e.text||n[e.phrase].text,tStart:n[e.phrase].t})))});let w=y.cast||[],T={};w.forEach(e=>{let t=gP(e,n,p.t0,i),a=t.xOverride==null?OP(e,n,r,i):t.xOverride,s=e.pos&&typeof e.pos.z==`number`?e.pos.z:.5,{facing:c,squash:l}=wP(e,n,d,i);T[e.ref]={xn:a,rigX:a*o,z:s,facing:c,squash:l,enterOpacity:t.opacity,forceWalk:t.forceWalk,forceRun:t.forceRun,yOverride:t.yOverride,scaleMul:t.scaleMul}});let E=(e,t)=>{let n=T[e];if(!n)return{aimDX:0,aimDY:0};let r=n.rigX,i=n.z;if(t&&typeof t==`object`&&typeof t.x==`number`)r=t.x*o,typeof t.z==`number`&&(i=t.z);else if(typeof t==`string`){let e=T[t.replace(/^cast:/,``)];e&&(r=e.rigX,i=e.z)}return{aimDX:K((r-n.rigX)/(o*.35),-1,1),aimDY:K((n.z-i)*1.4,-1,1)}},D=w.map(e=>{let t=T[e.ref],r=CP(e,n,d,p.t0),a=t.forceRun?`run`:t.forceWalk?`walk`:r.action,o=t.forceWalk||t.forceRun?{speed:t.forceRun?1.5:1.15}:r.opts,u=t.forceWalk||t.forceRun?p.t0:r.start,f={...o};if(HO.includes(a)&&o.target!=null){let t=E(e.ref,o.target);f.aimDX=t.aimDX,f.aimDY=t.aimDY}let m=jP(MO(a,i,f)),h=jP(MO(r.prevAction,r.prevStart,r.opts)),g=dO(K((i-u)/BP,0,1)),_={};for(let e of Object.keys(xO))_[e]=lO(h[e],m[e],g);_.blink=SP(s+`:`+e.ref,i);let S=!!b[e.ref];if(S){_=FO(_,PO(i));let t=x.find(t=>t.ref===e.ref);Object.assign(_,c.mouth===`amplitude`&&t?_P(t.text,i-t.tStart):NO(i))}!l&&RP.includes(a)&&(_.bob=0);let C=GM(t.z,y.setup.mode);return{ref:e.ref,params:v[e.ref]||{},pose:_,states:e.state||[],xNorm:t.xn,rigX:t.rigX,z:t.z,facing:t.facing,squash:t.squash,depthScale:C.scale*(t.scaleMul||1),yShift:C.yShift+(t.yOverride||0),opacity:C.opacity*(t.enterOpacity==null?1:t.enterOpacity),blur:C.blur,action:a,speaking:S}}).sort((e,t)=>t.z-e.z);x.forEach(e=>{let t=T[e.ref];e.z=t?t.z:.5,e.facing=t?t.facing:`front`});let O={};(e.props||[]).forEach(e=>O[e.id]=e);let k=(y.setup&&y.setup.dress||[]).map(e=>{let t=O[e.ref]||{id:e.ref,source:`coded`,ref:e.ref},n=e.presentation||`onSurface`,r,i,a;if(n===`heldBy`){let t=(e.slot||``).replace(/^(cast:|hand:)/,``),n=T[t];if(n)r=n.rigX+(n.facing===`left`?-46:46),i=344,a=n.z;else{let t=IA(e.slot,o);r=t.x,i=t.y,a=t.z}}else{let t=IA(e.slot,o);r=t.x,i=t.y,a=t.z}return{id:e.ref,spec:t,slot:e.slot,x:r,y:i,z:a,presentation:n,depthScale:GM(a,y.setup.mode).scale}}),A=[];(y.entities||[]).forEach(e=>{e.type===`assetBox`?A.push(TP({...e,face:`assetBox`},i,o,y.setup.mode,s)):e.type===`placeholder`?A.push(TP(e,i,o,y.setup.mode,s)):e.type===`formation`?A.push(EP(e,i,o,y.setup.mode,s)):e.type===`crowdFlow`&&A.push(DP(e,i,o,y.setup.mode,s))});let j=e=>{if(e&&typeof e==`object`&&typeof e.x==`number`)return{x:e.x*o,y:e.y==null?300:e.y};if(typeof e==`string`){if(e.startsWith(`region:`)){let t=lA(e.slice(7),o);return{x:t.x,y:t.y,tint:t.tint}}if(e.startsWith(`prop:`)){let t=k.find(t=>t.id===e.slice(5));if(t)return{x:t.x,y:t.y-40}}if(e.includes(`.`)){let t=IA(e,o);return{x:t.x,y:t.y}}let t=T[e.replace(/^cast:/,``)];if(t)return{x:t.rigX,y:240};let n=IA(e,o);return{x:n.x,y:n.y}}return{x:o/2,y:300}},M=(y.overlays||[]).map(e=>{let t=e.atMs==null?n[e.atPhrase==null?d:e.atPhrase].t:e.atMs/1e3,r=(e.hold==null?4:e.hold/1e3)+.6;if(i<t||i>t+r)return null;let a,s={};if(e.region){let t=lA(e.region,o);a={x:t.x,y:t.y},s.tint=e.tint||t.tint}else a=j(e.anchor||`skyBand`);if(e.from&&e.to){let t=j(e.from),n=j(e.to);a=t,s.bx=n.x-t.x,s.by=n.y-t.y,s.tint=e.tint||t.tint||n.tint}return{...e,...s,p:K((i-t)/.5,0,1),x:a.x,y:a.y}}).filter(Boolean),N=(y.sfx||[]).map(e=>{let t=e.atMs==null?n[e.atPhrase==null?d:e.atPhrase].t:e.atMs/1e3;return{name:e.name,t0:t,gain:e.gain==null?1:e.gain,firing:i>=t&&i<t+.12}}),P=(y.extras||[]).map((e,t)=>{let n=e.z==null?.78:e.z,r=GM(n,y.setup.mode);return{x:(e.x==null?.5:e.x)*o,z:n,depthScale:r.scale,yShift:r.yShift,opacity:r.opacity,shirt:e.shirt||`#98a4b0`,phase:t*1.7%6.28}}),F=null;{let e=f[f.indexOf(p)-1],t=e&&e.scene.transitionOut,n=e=>{let t=XA[e.setup&&e.setup.palette||`day`];return t&&t.ground||`#3a4657`};if(t&&t.type===`flash`)i<p.t0+FP&&(F={type:`flash`,p:K((i-p.t0)/FP,0,1),tint:t.tint||`#ffffff`});else if(t&&NM(t.type)&&t.type!==`fade`){let r=Math.max(.3,(t.durationMs||1200)/1e3),a=K((i-p.t0)/r,0,1);if(i<p.t0+r){let r=t.carrySubject?T[t.carrySubject]:null;F={harness:!0,spec:t,p:a,bridge:[n(e.scene),n(p.scene)],subjectFrom:r?{x:r.rigX,y:400}:{x:o*.3,y:420},subjectTo:r?{x:r.rigX,y:400}:{x:o*.7,y:420}}}}else m&&t&&t.type!==`carry`&&(F={type:t.type||`fade`,bands:t.bands||4,direction:t.direction||`left`,p:K((i-p.t0)/VP,0,1)})}let I=[];(y.effects||[]).forEach(e=>{let t=e.atMs==null?n[e.atPhrase==null?d:e.atPhrase].t:e.atMs/1e3,r=e.hold==null?$N[e.type]||1:e.hold/1e3;if(i<t||i>t+r)return;let a=K((i-t)/r,0,1),s=e.at?j(e.at):{x:o/2,y:300},c={type:e.type,space:eP(e.type),p:a,t0:t,tint:e.tint,intensity:e.intensity,scale:e.scale,shake:e.shake,VBW:o};if(e.type===`tracerArc`){let t=e.from?j(e.from):s,n=e.to?j(e.to):{x:t.x+120,y:t.y-40};I.push({...c,x:t.x,y:t.y,bx:n.x-t.x,by:n.y-t.y})}else I.push({...c,x:s.x,y:s.y})}),A.forEach(e=>{e.kind===`placeholder`&&(e.emits||[]).forEach(t=>{let n=e.anchors[t.anchor||(t.type===`muzzleFlash`?`muzzle`:`smoke`)]||e.anchors.center;if(t.type===`muzzleFlash`){let r=1.6,a=i%r/r;a<.14&&I.push({type:`muzzleFlash`,space:`world`,x:n.x,y:n.y,p:a/.14,t0:i-a,tint:t.tint,scale:e.depthScale,VBW:o})}else I.push({type:t.type,space:eP(t.type),x:n.x,y:n.y,p:.5,t0:0,tint:t.tint,scale:e.depthScale,VBW:o})})});let ee=0,te=I.filter(e=>!ZN.includes(e.type)||++ee<=2),ne=0,re=0;te.forEach(e=>{if(!(e.shake===!0||e.shake!==!1&&e.type===`flashImpact`))return;let t=14*(1-K((i-e.t0)/.3,0,1)),n=aO(`shk`+e.t0.toFixed(3))%100;ne+=Math.sin(i*90+n)*t,re+=Math.cos(i*84+n)*t*.7});let ie={VBW:o,sceneT0:p.t0,sceneT1:p.t1,phrases:n,resolveTarget:j,seed:s,cast:D.map(e=>({rigX:e.rigX}))},ae=MA(y.setup.name)?wA(y.setup.name,y.setup.seed==null?0:y.setup.seed,y.setup.elements||{}):null,oe=y.camera&&!Array.isArray(y.camera)?y.camera:null,se=!!(oe||ae),ce,le=null,ue=null;if(se){let e=ae?{worldW:ae.worldW,worldH:ae.worldH,viewW:ae.viewW,viewH:ae.viewH}:{worldW:o,worldH:640,viewW:o,viewH:640},t=oe&&oe.subjects||(ae?ae.subjects:[]),n=oe||{mode:`generated`,seed:y.setup.seed||1,style:`editorial`},r=nM(oM(n,{duration:p.t1-p.t0,...e,subjects:t}),i-p.t0);if(n.safeZone&&n.safeZone.enabled!==!1){let t=(n.safeZone.x==null?.22:n.safeZone.x)*e.viewW/r.scale,i=(n.safeZone.y==null?.2:n.safeZone.y)*e.viewH/r.scale;r={...r,x:K(r.x,t,e.worldW-t),y:K(r.y,i,e.worldH-i)}}if(le=r,ce={cx:r.x,cy:r.y,zoom:r.scale,rotation:r.rotation,pan:!0,subjectId:r.subjectId,worldW:e.worldW,worldH:e.worldH,viewW:e.viewW,viewH:e.viewH},ae&&ae.focusRing){let e=t.find(e=>e.id===r.subjectId)||t[0];e&&(ue={x:e.x,y:e.y})}(ne||re)&&(ce.cx+=ne,ce.cy+=re)}else{ce=iN(y,i,ie);let e=f[f.indexOf(p)-1],t=e&&(!Array.isArray(e.scene.camera)&&e.scene.camera||MA(e.scene.setup.name));if(m&&i<p.t0+VP&&e&&!t){let t=iN(e.scene,e.t1-.001,{...ie,sceneT0:e.t0,sceneT1:e.t1}),n=K((i-p.t0)/VP,0,1);ce.cx=lO(t.cx,ce.cx,n),ce.cy=lO(t.cy,ce.cy,n),ce.zoom=lO(t.zoom,ce.zoom,n)}(ne||re)&&(ce.cx+=ne,ce.cy+=re)}let de=y.setup.weather?typeof y.setup.weather==`string`?{type:y.setup.weather}:{...y.setup.weather}:null,fe=null,pe=y.setup.timeRamp;if(pe){let e=pe.overPhrases||2,t=n[Math.min(n.length-1,(y.startPhrase||0)+e)].t,r=K((i-p.t0)/Math.max(.1,t-p.t0),0,1),a=XA[pe.from]||XA.day,s=XA[pe.to]||XA.night;fe={k:r,top:cO(a.skyTop,s.skyTop,r),bot:cO(a.skyBot,s.skyBot,r),alpha:.55*r,sun:{x:o*(.2+.6*r),y:130+r*r*380,a:K(1-r*1.25,0,1)},moon:{x:o*(.78-.5*r),y:430-r*300,a:K((r-.4)/.45,0,1)}}}let me=y.mode===`wordReveal`?`wordReveal`:`normal`,he=null;if(me===`wordReveal`){let e=y.wordReveal||{},t={...Sd,...e},n=hd(y.words||[],(i-p.t0)*1e3,t,180),r=gd(t.swapAnim,n.enterP);if(he={word:!n.cleared&&n.word?t.allCaps?n.word.toUpperCase():n.word:``,...r,emphasized:n.emphasized,background:t.background,accent:t.accentColor},Math.round(Number(e.trailCount==null?e.ghostWords:e.trailCount)||0)>0){let e=bd(y.words||[],(i-p.t0)*1e3,t,180);he.trail={entries:e.entries.map(e=>({...e,text:t.allCaps?e.text.toUpperCase():e.text,transform:e.role===`current`?gd(t.swapAnim,e.enterP):null})),layout:t.trailLayout,muteColor:t.trailMuteColor,exit:t.trailExit}}}let ge=me===`wordReveal`;return{t:i,dur:r,aspect:a,VBW:o,seed:s,phraseIndex:d,mode:me,wordReveal:he,background:{to:g,from:m,mix:h},cast:D,extras:P,entities:A,effects:te,bubbles:ge?[]:x,cards:ge?[]:S,props:k,overlays:M,transition:F,weather:de,timeGrade:fe,sfx:N,style:{bob:l,shadow:u},board:ae?{name:y.setup.name,planes:ae.planes,worldW:ae.worldW,worldH:ae.worldH,viewW:ae.viewW,viewH:ae.viewH,focusRing:ae.focusRing,ring:ue,panels:ae.panels}:null,camera:{view:ce,pan:le,bgCam:se?{pan:0,scale:0}:sN(ce,o),coverage:se?1:cN(y,ie),richness:se?1:aN(y,ie),traveling:ce.directive===`travel`,shake:{x:ne,y:re}}}}function AP(e){return{name:e.setup.name,seed:e.setup.seed==null?7:e.setup.seed,mode:e.setup.mode||`2.5d`,palette:e.setup.palette||`day`}}function jP(e){return{...xO,...e}}var MP,NP,PP,FP,IP,LP,RP,zP,BP,VP,HP,UP,WP=o((()=>{pO(),jO(),UO(),cA(),Bj(),NA(),fM(),UM(),QM(),mN(),DN(),JN(),rP(),sP(),hA(),kd(),MP=590,NP=[`grid`,`wedge`,`column`,`line`],PP=[`march`,`run`,`flee`,`idle`,`cheer`],FP=.18,IP=1,LP=e=>e===`right`?1.16:-.16,RP=[`idle`,`stand`,`look`,`lookAround`,`turn`,`talkGesture`,`talk`],zP=.06,BP=.25,VP=.5,HP=3.5,UP=class extends Error{constructor(e){super(e),this.name=`SchemaError`}}}));function GP(e,t){let n=Math.round(K(15*e,12,27));return{fontPx:n,padY:Math.round(n*.5),padX:Math.round(n*.72),maxWidth:Math.min(t*.72,Math.round(250*e)),radius:Math.round(n*1.05),gap:Math.round(9+n*.4)}}function KP(e,t,n,r,i,a){let o=a.radius,s=a.gap,c=e.h*.5+r*.5+s,l=e.h*.5+i*.5+s,u=e.cx+n.x*c-r/2,d=e.midY+n.y*l-i/2;u=K(u,10,t.w-10-r),d=K(d,10,t.h-10-i);let f=u+r/2,p=d+i/2,m=e.cx-f,h=e.midY-p,g;return g=Math.abs(h)>=Math.abs(m)?{side:h>0?`down`:`up`,left:Math.round(K(e.cx,u+o+4,u+r-o-4)-u-9),top:null}:{side:m>0?`right`:`left`,left:null,top:Math.round(K(e.midY,d+o+4,d+i-o-4)-d-8)},{left:Math.round(u),top:Math.round(d),tail:g}}function qP(e,t,n=34){return Math.max(0,Math.min(e.length,Math.floor(t*n)))}var JP=o((()=>{pO()}));function YP(e){let t=`gen:`+e;if(eF.has(t))return eF.get(t);let n=aO(e);oO(e);let r=n%360,i=`hsl(${r} 62% 58%)`,a=`hsl(${r} 55% 38%)`,o=`generic`;for(let[t,n]of $P)if(n.test(e)){o=t;break}let s={svg:`<g data-prop>${QP[o]({c:i,d:a})}</g>`,w:80,h:80,icon:o,cached:!1};return eF.set(t,{...s,cached:!0}),s}function XP(e){return e?e.source===`coded`?{svg:`<g data-prop>${(tF[e.ref]||tF.box)()}</g>`,w:90,h:100}:YP(e.prompt||e.ref||`object`):null}function ZP(e,t,n,r=1){let i=r;if(e===`hoverIdle`){let e=Math.sin(n*1.6)*6;return{x:t.x,y:t.y+e,scale:i,shadow:`breathe`,floatY:e}}return e===`pinned`?{x:t.x,y:t.y,scale:i,shadow:`none`}:e===`planeAt`?{x:t.x,y:t.y,scale:i,shadow:`soft`}:{x:t.x,y:t.y,scale:i,shadow:`contact`}}var QP,$P,eF,tF,nF=o((()=>{pO(),QP={coin:e=>`<g><ellipse cx="0" cy="-30" rx="30" ry="30" fill="${e.c}"/><ellipse cx="0" cy="-30" rx="22" ry="22" fill="none" stroke="${e.d}" stroke-width="3"/><text x="0" y="-22" font-size="26" font-weight="800" text-anchor="middle" fill="${e.d}">$</text></g>`,card:e=>`<g><rect x="-38" y="-52" width="76" height="48" rx="7" fill="${e.c}"/><rect x="-38" y="-40" width="76" height="10" fill="${e.d}"/><rect x="-30" y="-18" width="30" height="6" rx="3" fill="#fff" opacity=".85"/></g>`,house:e=>`<g><rect x="-26" y="-42" width="52" height="42" rx="3" fill="${e.c}"/><path d="M-34 -42 L0 -70 L34 -42 Z" fill="${e.d}"/><rect x="-8" y="-24" width="16" height="24" fill="${e.d}"/></g>`,phone:e=>`<g><rect x="-20" y="-64" width="40" height="64" rx="8" fill="${e.c}"/><rect x="-15" y="-58" width="30" height="46" rx="2" fill="#dfe7ee"/><circle cx="0" cy="-7" r="3" fill="#dfe7ee"/></g>`,key:e=>`<g><circle cx="-16" cy="-46" r="14" fill="none" stroke="${e.c}" stroke-width="8"/><rect x="-6" y="-50" width="42" height="8" rx="3" fill="${e.c}"/><rect x="24" y="-42" width="8" height="12" fill="${e.c}"/></g>`,chart:e=>`<g><rect x="-34" y="-8" width="16" height="30" fill="${e.c}"/><rect x="-8" y="-40" width="16" height="62" fill="${e.d}"/><rect x="18" y="-24" width="16" height="46" fill="${e.c}"/></g>`,clock:e=>`<g><circle cx="0" cy="-34" r="30" fill="${e.c}"/><circle cx="0" cy="-34" r="24" fill="#fff" opacity=".9"/><line x1="0" y1="-34" x2="0" y2="-52" stroke="${e.d}" stroke-width="3"/><line x1="0" y1="-34" x2="14" y2="-34" stroke="${e.d}" stroke-width="3"/></g>`,bag:e=>`<g><path d="M-28 -48 Q-28 -60 0 -60 Q28 -60 28 -48 L34 -4 Q34 2 26 2 L-26 2 Q-34 2 -34 -4 Z" fill="${e.c}"/><path d="M-14 -50 Q-14 -66 0 -66 Q14 -66 14 -50" fill="none" stroke="${e.d}" stroke-width="4"/></g>`,generic:e=>`<g><rect x="-30" y="-58" width="60" height="56" rx="12" fill="${e.c}"/><circle cx="0" cy="-30" r="15" fill="${e.d}"/><rect x="-18" y="-14" width="36" height="7" rx="3.5" fill="${e.d}" opacity=".7"/></g>`},$P=[[`coin`,/coin|gold|money|cash/i],[`card`,/card|credit|debit/i],[`house`,/house|home|mortgage|building/i],[`phone`,/phone|mobile|cell/i],[`key`,/key|lock|access/i],[`chart`,/chart|graph|bar|stat/i],[`clock`,/clock|time|watch|hour/i],[`bag`,/bag|shop|purse|wallet/i]],eF=new Map,tF={bookshelf:()=>`<g><rect x="-40" y="-96" width="80" height="96" rx="3" fill="#8a6a45"/><rect x="-34" y="-90" width="68" height="26" fill="#a9855c"/><rect x="-34" y="-60" width="68" height="26" fill="#a9855c"/><rect x="-34" y="-30" width="68" height="26" fill="#a9855c"/>${[-30,-20,-10,2,12,22].map((e,t)=>`<rect x="${e}" y="${-86-t%2*0}" width="7" height="20" fill="${[`#c0563f`,`#3f7fc0`,`#3fae6b`,`#c9a13a`,`#8b5cf6`,`#e08a3a`][t]}"/>`).join(``)}</g>`,table:()=>`<g><rect x="-44" y="-30" width="88" height="10" rx="3" fill="#a9855c"/><rect x="-40" y="-20" width="8" height="20" fill="#8a6a45"/><rect x="32" y="-20" width="8" height="20" fill="#8a6a45"/></g>`,plant:()=>`<g><path d="M-12 0 L-8 -30 L8 -30 L12 0 Z" fill="#c98a3a"/><circle cx="0" cy="-44" r="20" fill="#3f8f63"/><circle cx="-14" cy="-38" r="13" fill="#4fa576"/><circle cx="14" cy="-40" r="12" fill="#357a53"/></g>`,sign:()=>`<g><rect x="-3" y="-40" width="6" height="40" fill="#8a6a45"/><rect x="-30" y="-72" width="60" height="34" rx="4" fill="#eef2f4" stroke="#c7d0d6" stroke-width="2"/></g>`,box:()=>`<g><rect x="-26" y="-48" width="52" height="48" rx="3" fill="#c39a5f"/><path d="M-26 -34 L26 -34" stroke="#9a7440" stroke-width="3"/><path d="M0 -48 L0 0" stroke="#9a7440" stroke-width="2"/></g>`,lamp:()=>`<g><rect x="-2" y="-58" width="4" height="58" fill="#5b636b"/><path d="M-18 -58 L18 -58 L10 -78 L-10 -78 Z" fill="#f2c14e"/></g>`,window:()=>`<g><rect x="-34" y="-64" width="68" height="64" rx="3" fill="#bfe3f2" stroke="#9fb3c0" stroke-width="4"/><path d="M0 -64 L0 0 M-34 -32 L34 -32" stroke="#9fb3c0" stroke-width="3"/></g>`,coin:()=>`<g><ellipse cx="0" cy="-16" rx="16" ry="16" fill="#e6b83a"/><ellipse cx="0" cy="-16" rx="11" ry="11" fill="none" stroke="#b5892a" stroke-width="2"/></g>`}}));function rF(e){let t=e.w||100,n=e.h||100,r=96/Math.max(t,n);return{svg:`<svg x="${(-t*r/2).toFixed(1)}" y="${(-n*r).toFixed(1)}" width="${(t*r).toFixed(1)}" height="${(n*r).toFixed(1)}" viewBox="0 0 ${t} ${n}" preserveAspectRatio="xMidYMax meet" overflow="visible">${e.inner}</svg>`,w:t*r,h:n*r}}var iF,aF,oF,sF=o((()=>{jO(),cA(),Bj(),JP(),mN(),fM(),NA(),UM(),nF(),DN(),JN(),sP(),rP(),hP(),Xj(),pO(),kd(),iF=`http://www.w3.org/2000/svg`,aF=()=>document.createElementNS(iF,`g`),oF=class{constructor(e){this.stage=e,this.canvas=document.createElement(`canvas`),this.canvas.className=`v2-bg`,this.svg=document.createElementNS(iF,`svg`),this.svg.setAttribute(`class`,`v2-hero`),this.svg.setAttribute(`preserveAspectRatio`,`xMidYMid meet`),this.boardG=aF(),this.world=aF(),this.extrasG=aF(),this.entitiesG=aF(),this.propsG=aF(),this.wfxG=aF(),this.world.append(this.extrasG,this.entitiesG,this.propsG,this.wfxG),this.stateG=aF(),this.world.appendChild(this.stateG),this.timeG=aF(),this.occG=aF(),this.weatherG=aF(),this.fx=aF(),this.sfxG=aF(),this.transG=aF(),this.wrG=aF(),this.svg.append(this.boardG,this.world,this.timeG,this.occG,this.weatherG,this.fx,this.sfxG,this.transG,this.wrG),this.overlay=document.createElement(`div`),this.overlay.className=`v2-overlay`,e.append(this.canvas,this.svg,this.overlay),this.ctx=this.canvas.getContext(`2d`),this.rigs=new Map,this.bubbleEls=new Map,this.cardEl=null,this._setupCache=new Map,this.assets=null,this._resize=()=>this._sizeCanvas(),window.addEventListener(`resize`,this._resize)}destroy(){window.removeEventListener(`resize`,this._resize),this.stage.innerHTML=``}setAspect(e){this._vbw=mO(e),this.svg.setAttribute(`viewBox`,`0 0 ${this._vbw} 640`),this._sizeCanvas()}setAssets(e){return this.assets=e||null,this}_sizeCanvas(){let e=this.stage.getBoundingClientRect(),t=Math.min(2,window.devicePixelRatio||1);this.canvas.width=Math.max(1,Math.round(e.width*t)),this.canvas.height=Math.max(1,Math.round(e.height*t))}_setup(e){let t=e.name+`:`+e.seed+`:`+e.mode+`:`+(e.palette||`day`);return this._setupCache.has(t)||this._setupCache.set(t,BA(e.name,e.seed,e.mode,e.palette)),this._setupCache.get(t)}_rig(e,t,n){let r=kO(n)?`profile`:`flat`,i=this.rigs.get(e);if(i&&i.family!==r&&(i.rig.remove(),i=null),!i){let t=hO(r===`profile`?`right`:`front`);this.world.appendChild(t),i={rig:t,paintKey:null,family:r},this.rigs.set(e,i)}let a=JSON.stringify(t);return a!==i.paintKey&&(Qk(i.rig,t),i.paintKey=a),i.rig}_groundY(){let e=this.svg.getScreenCTM();if(!e)return this.canvas.height*.9;let t=this.svg.createSVGPoint();t.x=0,t.y=592;let n=this.stage.getBoundingClientRect(),r=this.canvas.height/Math.max(1,n.height);return K((t.matrixTransform(e).y-n.top)*r,this.canvas.height*.5,this.canvas.height*.98)}render(e){this._aspect!==e.aspect&&(this._aspect=e.aspect,this.setAspect(e.aspect)),this.canvas.width<2&&this._sizeCanvas(),this._t=e.t,this.world.setAttribute(`transform`,oN(e.camera.view,this._vbw));let t=e.camera.view.whip||0;this.world.style.filter=t>.05?`blur(${(t*4).toFixed(1)}px)`:``;let n=this.canvas.width,r=this.canvas.height,i=this._groundY();this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,n,r),e.board?this._board(e):(this.boardG.innerHTML=``,e.background.from&&(this.ctx.globalAlpha=1,VA(this.ctx,this._setup(e.background.from),n,r,i,e.camera.bgCam,e.t)),this.ctx.globalAlpha=e.background.from?e.background.mix:1,VA(this.ctx,this._setup(e.background.to),n,r,i,e.camera.bgCam,e.t),this.ctx.globalAlpha=1),this.extrasG.innerHTML=(e.extras||[]).map(t=>{let n=t.depthScale*.82,r=512+(t.yShift||0),i=Math.sin(e.t*.9+t.phase)*3;return`<g transform="translate(${(t.x+i).toFixed(1)} ${r.toFixed(1)}) scale(${n.toFixed(3)})" opacity="${(t.opacity*.85).toFixed(3)}"><ellipse cx="0" cy="6" rx="42" ry="10" fill="#000" opacity="0.06"/><rect x="-32" y="-150" width="64" height="150" rx="30" fill="${t.shirt}"/><circle cx="0" cy="-178" r="31" fill="#d9ac88"/></g>`}).join(``),this.entitiesG.innerHTML=(e.entities||[]).slice().sort((e,t)=>t.z-e.z).map(e=>{if(e.kind===`placeholder`){let t=this.assets&&e.source?this.assets[e.source]:null,n=t?jN(e,t):LN(e);return`<g transform="translate(${e.x.toFixed(1)} ${e.y.toFixed(1)})" opacity="${e.opacity.toFixed(3)}"${e.blur>.3?` style="filter:blur(${e.blur.toFixed(1)}px)"`:``}>${n}</g>`}return e.kind===`formation`?this._formationSvg(e):``}).join(``),this.propsG.innerHTML=(e.props||[]).map(t=>{let n=t.spec&&t.spec.cache&&this.assets?this.assets[t.spec.cache]:null,r=n?rF(n):XP(t.spec);if(!r)return``;let i=ZP(t.presentation,{x:t.x,y:t.y},e.t,t.depthScale||1),a=i.shadow===`none`?``:`<ellipse cx="0" cy="2" rx="34" ry="8" fill="#000" opacity="${i.shadow===`breathe`?(.12+.04*Math.sin(e.t*1.6)).toFixed(3):`0.12`}"/>`;return`<g transform="translate(${t.x.toFixed(1)} ${i.y.toFixed(1)}) scale(${i.scale.toFixed(3)})">${a}${r.svg}</g>`}).join(``);let a=new Set(e.cast.map(e=>e.ref)),o=!(e.style&&e.style.shadow===!1);this.rigs.forEach((e,t)=>{a.has(t)||e.rig.setAttribute(`opacity`,`0`)}),e.cast.forEach(e=>{let t=this._rig(e.ref,e.params,e.facing);t.setAttribute(`opacity`,String(e.opacity==null?1:e.opacity)),t.style.filter=e.blur>.3?`blur(${e.blur.toFixed(1)}px)`:``,gO(t,e.pose,rA(e.params,e.rigX,{facing:e.facing,squash:e.squash,depthScale:e.depthScale,yShift:e.yShift}));let n=AO(t,`shadow`);n&&n.setAttribute(`opacity`,o?`0.10`:`0`),this.world.appendChild(t)}),this.stateG.innerHTML=(e.cast||[]).filter(e=>e.states&&e.states.length).map(t=>{let n=592-458*t.depthScale+t.yShift;return`<g transform="translate(${t.rigX.toFixed(1)} ${n.toFixed(1)}) scale(${t.depthScale.toFixed(3)})" opacity="${(t.opacity==null?1:t.opacity).toFixed(2)}">${cP(t.states,e.t)}</g>`}).join(``),this.world.appendChild(this.stateG),this.wfxG.innerHTML=(e.effects||[]).filter(e=>e.space===`world`).map(t=>`<g transform="translate(${t.x.toFixed(1)} ${t.y.toFixed(1)})">${YN(t,t.p,e.t)}</g>`).join(``),this.world.appendChild(this.wfxG),this.sfxG.innerHTML=(e.effects||[]).filter(e=>e.space===`screen`).map(t=>YN(t,t.p,e.t)).join(``),this.fx.innerHTML=(e.overlays||[]).map(t=>`<g transform="translate(${t.x.toFixed(1)} ${t.y.toFixed(1)})">${hN(t,t.p,e.t)}</g>`).join(``),this._timeGrade(e),this._weather(e),this._occluders(e),this._transition(e.transition),this._wordReveal(e);let s=new Set(e.bubbles.map(e=>e.ref));this.bubbleEls.forEach((e,t)=>{s.has(t)||(e.style.display=`none`)}),e.bubbles.forEach(t=>this._bubble(t,e)),this._card(e.cards[0],e)}_board(e){let t=e.board,n=e.camera.pan||{x:t.worldW/2,y:t.worldH/2,scale:1,rotation:0},r=this._vbw/t.viewW,i=640/t.viewH;this.boardG.setAttribute(`transform`,`scale(${r.toFixed(4)} ${i.toFixed(4)})`),this.boardG.innerHTML=t.planes.map(r=>{let i=r.depth===1&&t.focusRing&&t.ring?TA(t.ring.x,t.ring.y,e.t):``;return`<g transform="${rM(n,r.depth,t.viewW,t.viewH)}">${r.svg}${i}</g>`}).join(``)}_timeGrade(e){let t=e.timeGrade;if(!t){this.timeG.innerHTML=``;return}let n=e.VBW,r=t.sun.a>.01?`<circle cx="${t.sun.x.toFixed(1)}" cy="${t.sun.y.toFixed(1)}" r="58" fill="#ffe08a" opacity="${(t.sun.a*.18).toFixed(2)}"/><circle cx="${t.sun.x.toFixed(1)}" cy="${t.sun.y.toFixed(1)}" r="34" fill="#ffe79a" opacity="${t.sun.a.toFixed(2)}"/>`:``,i=t.moon.a>.01?`<circle cx="${t.moon.x.toFixed(1)}" cy="${t.moon.y.toFixed(1)}" r="24" fill="#eef2f8" opacity="${t.moon.a.toFixed(2)}"/>`:``;this.timeG.innerHTML=`<defs><linearGradient id="v2tg" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="${t.top}"/><stop offset="1" stop-color="${t.bot}"/></linearGradient></defs><rect x="0" y="0" width="${n}" height="640" fill="url(#v2tg)" opacity="${t.alpha.toFixed(3)}"/>${r}${i}`}_weather(e){this.weatherG.innerHTML=e.weather?Vj(e.weather,e.t,e.VBW):``}_occluders(e){if(!e.camera||!e.camera.traveling){this.occG.innerHTML=``;return}let t=this._vbw,n=(1.2-e.t/.9%1*1.4)*t;this.occG.innerHTML=`<defs><linearGradient id="occEdgeL" x1="0" y1="0" x2="1" y2="0"><stop offset="0" stop-color="#0e1622" stop-opacity="0.26"/><stop offset="1" stop-color="#0e1622" stop-opacity="0"/></linearGradient><linearGradient id="occEdgeR" x1="1" y1="0" x2="0" y2="0"><stop offset="0" stop-color="#0e1622" stop-opacity="0.26"/><stop offset="1" stop-color="#0e1622" stop-opacity="0"/></linearGradient><filter id="occBlur" x="-40%" y="-40%" width="180%" height="180%"><feGaussianBlur stdDeviation="7"/></filter></defs><rect x="0" y="0" width="${(t*.17).toFixed(0)}" height="640" fill="url(#occEdgeL)"/><rect x="${(t*.83).toFixed(0)}" y="0" width="${(t*.17).toFixed(0)}" height="640" fill="url(#occEdgeR)"/><rect x="${n.toFixed(1)}" y="0" width="30" height="640" rx="10" fill="#0e1622" opacity="0.13" filter="url(#occBlur)"/>`}_wordReveal(e){if(e.mode!==`wordReveal`){this.wrG.innerHTML&&(this.wrG.innerHTML=``);return}let t=e.wordReveal||{},n=this._vbw,r=n/2,i=t.background||`#12151a`,a=e=>String(e).replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`),o=``;if(t.trail&&t.trail.entries?.length){let e=t.trail.entries.find(e=>e.role===`current`),i=Math.max(40,Math.min(132,n*.9/Math.max(3,(e?.text||``).length*.62))),s=null;t.trail.layout===`inline`&&(s=xd({entries:t.trail.entries},e=>String(e).length*i*.62,{maxWidth:n*.9,spaceW:i*.28,lineH:i*1.15,trailExit:t.trail.exit}));let c=t.trail.muteColor||`#8e8a80`;o=[...t.trail.entries].sort((e,t)=>t.slot-e.slot).map(e=>{let n=e.role===`current`,o=n?e.transform:null,l=s?s.get(e.wordIndex)||{x:0,y:0}:{x:e.dx*i,y:e.dy*i},u=e.scale*(o?o.scale:1)*(n&&e.emphasized?1.28:1),d=o&&o.ty?o.ty*640:0,f=e.emphasized?t.accent||`#ffd400`:_d(`#f4f6f8`,c,e.muteP),p=Math.max(0,Math.min(1,e.opacity*(o?o.opacity:1)));return`<g transform="translate(${(r+l.x).toFixed(1)} ${(300+l.y+d).toFixed(1)}) scale(${u.toFixed(3)}) rotate(${(o&&o.rot||0).toFixed(1)})" opacity="${p.toFixed(2)}"><text x="0" y="0" text-anchor="middle" dominant-baseline="central" font-family="Nunito,system-ui,sans-serif" font-weight="900" font-size="${i.toFixed(1)}" fill="${f}">${a(e.text)}</text></g>`}).join(``)}else if(t.word){let e=t.word,i=Math.max(40,Math.min(132,n*.9/Math.max(3,e.length*.62))),s=t.emphasized?1.28:1,c=t.emphasized?t.accent||`#ffd400`:`#f4f6f8`;o=`<g transform="translate(${r.toFixed(1)} ${(300+(t.ty||0)*640).toFixed(1)}) scale(${((t.scale==null?1:t.scale)*s).toFixed(3)}) rotate(${(t.rot||0).toFixed(1)})" opacity="${(t.opacity==null?1:t.opacity).toFixed(2)}"><text x="0" y="0" text-anchor="middle" dominant-baseline="central" font-family="Nunito,system-ui,sans-serif" font-weight="900" font-size="${i.toFixed(1)}" fill="${c}">${a(e)}</text></g>`}this.wrG.innerHTML=`<rect x="0" y="0" width="${n}" height="640" fill="${i}"/>${o}`}_transition(e){if(!e){this.transG.innerHTML=``;return}if(e.harness){let t=vM(e.spec,e.p,{VBW:this._vbw,bridge:e.bridge,subjectFrom:e.subjectFrom,subjectTo:e.subjectTo,subject:e.subjectFrom});this.transG.innerHTML=t.cover;return}let t=this._vbw,n=`#0d1220`,r=e.direction===`right`?1:-1,i=e.p,a=``;if(e.type===`flash`){let n=Math.max(0,1-i*1.1),r=e.tint||`#ffffff`,o=(i*1.5-.25)*t;a=`<rect x="0" y="0" width="${t}" height="640" fill="${r}" opacity="${n.toFixed(3)}"/><path d="M ${o.toFixed(1)} -20 l ${120 .toFixed(1)} 0 l ${(-80).toFixed(1)} ${680 .toFixed(1)} l ${(-120).toFixed(1)} 0 z" fill="${r}" opacity="${(n*.85).toFixed(3)}"/>`}else if(e.type===`fade`)a=`<rect x="0" y="0" width="${t}" height="640" fill="${n}" opacity="${(.55*(1-i)).toFixed(3)}"/>`;else if(e.type===`slide`)a=`<rect x="${(r*i*t).toFixed(1)}" y="0" width="${t}" height="640" fill="${n}" opacity="0.92"/>`;else if(e.type===`irisWipe`){let e=i*Math.hypot(t,640)*.62;a=`<path fill-rule="evenodd" d="M0 0 H ${t} V 640 H 0 Z M ${t/2} 320 m ${(-e).toFixed(1)} 0 a ${e.toFixed(1)} ${e.toFixed(1)} 0 1 0 ${(2*e).toFixed(1)} 0 a ${e.toFixed(1)} ${e.toFixed(1)} 0 1 0 ${(-2*e).toFixed(1)} 0" fill="${n}"/>`}else if(e.type===`whipPan`){let e=Math.sin(i*Math.PI);for(let r=0;r<8;r++){let o=r/8*640,s=(i*1.6-.3)*t+(r%2?20:-20);a+=`<rect x="${s.toFixed(1)}" y="${o.toFixed(1)}" width="${(t*.5).toFixed(1)}" height="${81 .toFixed(1)}" fill="${n}" opacity="${(e*.5).toFixed(2)}"/>`}}else if(e.type===`doorPass`){let e=t/2*i;a=`<rect x="${(-e).toFixed(1)}" y="0" width="${(t/2).toFixed(1)}" height="640" fill="${n}"/><rect x="${(t/2+e).toFixed(1)}" y="0" width="${(t/2).toFixed(1)}" height="640" fill="${n}"/>`}else if(e.type===`objectWipe`){let e=t*.45;a=`<rect x="${(-e+i*(t+2*e)).toFixed(1)}" y="-20" width="${e.toFixed(1)}" height="${680 .toFixed(1)}" rx="18" fill="${n}"/>`}else if(e.type===`matchDissolve`)a=`<rect x="0" y="0" width="${t}" height="640" fill="${n}" opacity="${(Math.sin(i*Math.PI)*.5).toFixed(3)}"/>`;else{let o=Math.max(2,e.bands||4),s=t/o;for(let e=0;e<o;e++){let o=r*K((i-e*.12)/.6,0,1)*t;a+=`<rect x="${(e*s+o).toFixed(1)}" y="0" width="${(s+1).toFixed(1)}" height="640" fill="${n}"/>`}}this.transG.innerHTML=a}_formationSvg(e){let t=this._t||0;return(e.units||[]).map(e=>`<g transform="translate(${e.x.toFixed(1)} ${e.y.toFixed(1)})">${aP(e,t)}</g>`).join(``)}_bubble(e,t){let n=this.bubbleEls.get(e.ref);n||(n=document.createElement(`div`),n.className=`v2-bubble`,n.innerHTML=`<span class="txt"></span><i class="tail"></i>`,this.overlay.appendChild(n),this.bubbleEls.set(e.ref,n));let r=this.rigs.get(e.ref);if(!r){n.style.display=`none`;return}let i=AO(r.rig,`head`).getBoundingClientRect(),a=this.stage.getBoundingClientRect();if(!i.width){n.style.display=`none`;return}let o={cx:i.left+i.width/2-a.left,midY:i.top+i.height/2-a.top,h:i.height},s=GP(K(o.h/135,.6,2),a.width);n.querySelector(`.txt`).textContent=e.text.slice(0,qP(e.text,t.t-e.tStart))||` `,Object.assign(n.style,{display:`inline-block`,fontSize:s.fontPx+`px`,padding:s.padY+`px `+s.padX+`px`,maxWidth:s.maxWidth+`px`,borderRadius:s.radius+`px`,zIndex:String(20+Math.round((1-(e.z==null?.5:e.z))*40))});let c=n.offsetWidth,l=n.offsetHeight,u=KP(o,{w:a.width,h:a.height},{x:0,y:-.9},c,l,s);n.style.left=u.left+`px`,n.style.top=u.top+`px`;let d=n.querySelector(`.tail`);d.className=`tail `+u.tail.side,d.style.left=u.tail.left==null?``:u.tail.left+`px`,d.style.top=u.tail.top==null?``:u.tail.top+`px`}_card(e,t){if(!e){this.cardEl&&(this.cardEl.style.display=`none`);return}this.cardEl||(this.cardEl=document.createElement(`div`),this.overlay.appendChild(this.cardEl));let n=!!e.full;this.cardEl.className=(n?`v2-card-full `:`v2-card `)+(e.tone===`dark`?`v2-card-dark`:`v2-card-light`),this.cardEl.textContent=e.text,this.cardEl.style.display=n?`flex`:`block`}}})),cF,lF,uF,dF,fF,pF=o((()=>{cF={flat:{amb:1,dir:0,len:1},soft:{amb:.85,dir:.4,len:1.4},dramatic:{amb:.5,dir:.9,len:2.6},night:{amb:.35,dir:.6,len:2.2},screenlit:{amb:.6,dir:.5,len:1.2}},lF=[`phone`,`laptop`,`monitor`,`tablet`],uF={condition:[`new`,`worn`,`rusted`,`broken`],fill:[`empty`,`full`],growth:[`seed`,`sprout`,`tree`],temperature:[`cold`,`hot`],damage:[`whole`,`cracked`,`shattered`],life:[`fresh`,`wilted`],size:[`small`,`large`],power:[`dark`,`lit`]},dF=[`stream`,`emitToTarget`,`flowField`,`converge`,`disperse`,`counted`],fF={V1_lighting:{renderers:[`lightShadow`,`glowSvg`,`rimSvg`,`shaftsSvg`,`ambientOcclusion`],looks:Object.keys(cF)},V2_liquids:{renderers:[`fillSvg`,`pourSvg`,`waveSvg`,`dripSvg`,`glassSvg`,`metalSvg`,`wetSvg`]},V3_fire:{renderers:[`flameSvg`,`smokeSvg`,`sparkSvg`,`explosionSvg`,`steamSvg`]},V4_dataviz:{renderers:[`plotOverTime`,`barRace`,`pieGrow`,`sankeySvg`,`scatterSvg`,`networkSvg`,`mapChoropleth`]},V5_type:{renderers:[`wordPop`,`numberMorph`,`kineticHeadline`,`typewriter`,`highlightSweep`,`maskReveal`,`textPath`]},V6_ui:{renderers:[`deviceFrame`,`fakeUI`,`chatThread`,`codeType`,`browserBar`,`notification`],frames:lF},V7_state:{renderers:[`stateChange`],stateSets:Object.keys(uF)},V8_weather:{renderers:[`wetGroundSvg`,`snowAccumulationSvg`,`windEffect`,`fogBankSvg`,`wetCharacterTint`]},V9_continuity:{renderers:[`carryObject`,`motionCarry`,`thematicReprise`]},V10_particles:{renderers:[`particleFlow`,`trailRibbon`],modes:dF}},Object.keys(fF)})),mF,hF,gF,_F,vF,yF,bF,xF,SF,CF,wF,TF,EF,DF=o((()=>{({sin:mF,cos:hF,PI:gF,pow:_F,abs:vF,min:yF,max:bF,exp:xF}=Math),SF=[`anticipate`,`overshootSettle`,`snap`,`punch`,`drift`,`cushion`,`elastic`,`linearIntentional`,`flat`],CF={primary:{durS:.65,feel:`overshootSettle`,hold:!0},secondary:{durS:.3,feel:`snap`,hold:!1},ambient:{durS:1.1,feel:`drift`,hold:!1},emphasis:{durS:.18,feel:`punch`,hold:!0}},wF=Object.keys(CF),TF={polished:{tierFeel:{primary:`overshootSettle`,secondary:`snap`,ambient:`drift`,emphasis:`punch`},staggerMs:75,secondaryMotion:!0,rhythm:1},calm:{tierFeel:{primary:`cushion`,secondary:`drift`,ambient:`drift`,emphasis:`overshootSettle`},staggerMs:110,secondaryMotion:!0,rhythm:.4},energetic:{tierFeel:{primary:`punch`,secondary:`snap`,ambient:`snap`,emphasis:`punch`},staggerMs:50,secondaryMotion:!0,rhythm:1.6},flat:{tierFeel:{primary:`flat`,secondary:`flat`,ambient:`flat`,emphasis:`flat`},staggerMs:0,secondaryMotion:!1,rhythm:0}},EF=Object.keys(TF)})),OF,kF,AF,jF=o((()=>{OF=[`number`,`process`,`comparison`,`thing`,`place`,`person`,`changeOverTime`,`causeEffect`,`concept`,`emphasis`,`list`,`warning`],kF={number:[{id:`counter`,uses:`V4 counter`,note:`the value counts up`},{id:`proportionFill`,uses:`V2 fill / pie`,note:`a proportion filled truthfully`},{id:`oneBigNumber`,uses:`V5 numberMorph`,note:`one big number, held`}],process:[{id:`stepPath`,uses:`method stepPath`,note:`literal ordered sequence`},{id:`causeArrowChain`,uses:`device causeArrowChain`,note:`A→B→C arrows`},{id:`explodedCutaway`,uses:`method explodedView`,note:`exploded / cutaway`}],comparison:[{id:`splitScreen`,uses:`setup split`,note:`both, side by side`},{id:`sideBySideScaled`,uses:`prominence rule`,note:`sized truthfully`},{id:`barCompare`,uses:`V4 barRace`,note:`bars compared`}],thing:[{id:`heroShot`,uses:`placeholder / prop focal`,note:`one clear hero shot`},{id:`labeledObject`,uses:`device connectorLine`,note:`the object, labeled`}],place:[{id:`establishSetup`,uses:`scenes setup`,note:`the place, established`}],person:[{id:`castInRole`,uses:`wardrobe + action`,note:`right wardrobe, relevant action`}],changeOverTime:[{id:`timeline`,uses:`device timelineTicker`,note:`the timeline`},{id:`beforeAfter`,uses:`V7 stateChange`,note:`before / after`},{id:`timeLapse`,uses:`timeRamp`,note:`time-lapse the delta`}],causeEffect:[{id:`arrowAtoB`,uses:`overlay arrow`,note:`A → B`},{id:`domino`,uses:`V10 stream`,note:`domino / chain`},{id:`effectResults`,uses:`V7 stateChange`,note:`the effect visibly resulting`}],concept:[{id:`lightMetaphor`,uses:`ONE metaphor slot`,note:`⚠ only if no literal image exists — instantly readable`},{id:`literalExemplar`,uses:`a concrete example`,note:`show one concrete instance instead`}],emphasis:[{id:`justType`,uses:`V5 + punch feel`,note:`big text + punch + hold — sometimes JUST type`},{id:`bigNumberHold`,uses:`V5 numberMorph`,note:`the number, held`}],list:[{id:`sequentialReveal`,uses:`stagger + numbered`,note:`items reveal in order, numbered`}],warning:[{id:`alertTreatment`,uses:`device alert + red accent`,note:`red accent, consequence shown`},{id:`consequenceShown`,uses:`V7 stateChange`,note:`the consequence visibly`}]},AF=e=>kF[e]||kF.thing,Object.fromEntries(OF.map(e=>[e,AF(e).map(e=>e.id)]))})),MF,NF,PF,FF,IF,LF,RF,zF,BF,VF,HF,UF,WF=o((()=>{Bj(),JN(),UO(),hP(),Xj(),rP(),DN(),NA(),qk(),pF(),DF(),jF(),MF=Object.keys(cF),NF=lF,PF=Object.keys(uF),FF=dF,IF=fF.V4_dataviz.renderers,LF=fF.V5_type.renderers,RF=[`editorial`,`energetic`,`calm`,`doc`,`documentary`,`dramatic`,`warfilm`],zF=[`panTo`,`punchTo`,`follow`,`hop`,`travel`,`zoomOut`,`establish`,`orbitLite`,`snapZoom`],BF=[`carry`,`fade`,`slide`,`shapeWipe`,`flash`,`irisWipe`,`whipPan`,`doorPass`,`objectWipe`,`matchDissolve`],VF=[`walkIn`,`runIn`,`fadeIn`,`present`,`popIn`,`dropIn`,`riseFrom`,`carryOver`],HF=[`front`,`back`,`left`,`right`],UF=[{path:`setup.name`,type:`enum`,options:Lj,default:`openField`,group:`World`,label:`Setup`},{path:`setup.palette`,type:`enum`,options:ZA,default:`day`,group:`World`,label:`Palette`},{path:`setup.mode`,type:`enum`,options:[`2.5d`,`2d`],default:`2.5d`,group:`World`,label:`Depth mode`},{path:`setup.seed`,type:`number`,min:0,max:9999,step:1,default:7,group:`World`,label:`Seed`},{path:`entity.face`,type:`enum`,options:HN,default:`assetBox`,group:`Placeholder`,label:`Face`},{path:`entity.label`,type:`text`,default:``,group:`Placeholder`,label:`Label`},{path:`entity.size`,type:`enum`,options:[`S`,`M`,`L`],default:`M`,group:`Placeholder`,label:`Size`},{path:`entity.plane`,type:`number`,min:0,max:1,step:.01,default:.5,group:`Placeholder`,label:`Plane (z)`},{path:`entity.x`,type:`number`,min:0,max:1,step:.01,default:.5,group:`Placeholder`,label:`X`},{path:`entity.placement`,type:`enum`,options:BN,default:`ground`,group:`Placeholder`,label:`Placement`},{path:`entity.tint`,type:`color`,default:`#4a5a6b`,group:`Placeholder`,label:`Tint`},{path:`entity.source`,type:`enum`,options:[`placeholder`,`asset`],default:`placeholder`,group:`Placeholder`,label:`Source`},{path:`cast.action`,type:`enum`,options:VO,default:`idle`,group:`Performance`,label:`Action`},{path:`cast.state`,type:`enum`,options:lP,default:[],multi:!0,group:`Performance`,label:`State overlays`},{path:`cast.facing`,type:`enum`,options:HF,default:`front`,group:`Performance`,label:`Facing`},{path:`cast.enter.type`,type:`enum`,options:VF,default:`walkIn`,group:`Performance`,label:`Entrance`},{path:`effect.type`,type:`enum`,options:XN,default:`burst`,group:`Effects`,label:`Effect`},{path:`effect.tint`,type:`color`,default:`#ffd27a`,group:`Effects`,label:`Effect tint`},{path:`effect.intensity`,type:`number`,min:0,max:1,step:.05,default:.6,group:`Effects`,label:`Intensity`},{path:`setup.weather`,type:`enum`,options:[`none`,...qj],default:`none`,group:`Weather`,label:`Weather`},{path:`setup.weather.intensity`,type:`enum`,options:[`light`,`storm`],default:`light`,group:`Weather`,label:`Intensity`},{path:`setup.timeRamp.from`,type:`enum`,options:ZA,default:`goldenHour`,group:`Weather`,label:`Time ramp — from`},{path:`setup.timeRamp.to`,type:`enum`,options:ZA,default:`night`,group:`Weather`,label:`Time ramp — to`},{path:`setup.timeRamp.overPhrases`,type:`number`,min:1,max:12,step:1,default:2,group:`Weather`,label:`Time ramp — over phrases`},{path:`overlay.type`,type:`enum`,options:TN,default:`counter`,group:`Overlays`,label:`Overlay`},{path:`overlay.anchor`,type:`text`,default:`skyBand`,group:`Overlays`,label:`Anchor`},{path:`overlay.value`,type:`number`,min:0,max:1e3,step:1,default:60,group:`Overlays`,label:`Value`},{path:`overlay.label`,type:`text`,default:``,group:`Overlays`,label:`Label`},{path:`overlay.tint`,type:`color`,default:`#2BB3A3`,group:`Overlays`,label:`Overlay tint`},{path:`card.type`,type:`enum`,options:EN,default:`titleCard`,group:`Overlays`,label:`Structural card`},{path:`camera.idle`,type:`enum`,options:[`focusFlow`,`drift`,`locked`],default:`focusFlow`,group:`Camera`,label:`Idle motion`},{path:`camera.stylePreset`,type:`enum`,options:RF,default:`editorial`,group:`Camera`,label:`Style preset`},{path:`camera.directive`,type:`enum`,options:zF,default:`establish`,group:`Camera`,label:`Directive`},{path:`transitionOut.type`,type:`enum`,options:BF.concat([`irisObject`,`strokeSweep`,`slabWipe`,`curtainFall`,`lightWash`,`bandWipe`,`carryTravel`]),default:`carry`,group:`Transitions`,label:`Transition out`},{path:`transitionOut.durationMs`,type:`number`,min:200,max:4e3,step:50,default:1200,group:`Transitions`,label:`Duration (ms)`},{path:`transitionOut.ease`,type:`enum`,options:[`linear`,`smooth`,`smoother`],default:`smoother`,group:`Transitions`,label:`Ease`},{path:`transitionOut.direction`,type:`enum`,options:[`L2R`,`R2L`,`T2B`,`B2T`,`radialIn`,`radialOut`],default:`L2R`,group:`Transitions`,label:`Direction`},{path:`transitionOut.colorMode`,type:`enum`,options:[`bridge`,`incoming`,`token`,`custom`],default:`bridge`,group:`Transitions`,label:`Colour mode`},{path:`transitionOut.carrySubject`,type:`text`,default:``,group:`Transitions`,label:`Carry subject (castId)`},{path:`sfx.name`,type:`text`,default:``,group:`Audio`,label:`SFX cue`},{path:`board.name`,type:`enum`,options:jA,default:`conceptTriptych`,group:`Boards`,label:`Board`},{path:`setup.element`,type:`bool`,default:!0,group:`Boards`,label:`Element (per manifest)`},{path:`camera.mode`,type:`enum`,options:[`generated`,`manual`,`hybrid`],default:`generated`,group:`PanControl`,label:`Camera mode`},{path:`camera.style`,type:`enum`,options:[`editorial`,`calm`,`energetic`,`dramatic`,`custom`],default:`editorial`,group:`PanControl`,label:`Shot style`},{path:`camera.seed`,type:`number`,min:0,max:9999,step:1,default:1,group:`PanControl`,label:`Shot seed`},{path:`camera.safeZone.enabled`,type:`bool`,default:!0,group:`PanControl`,label:`Safe-zone clamp`},{path:`camera.point.x`,type:`number`,min:-4e3,max:4e3,step:1,default:0,group:`PanControl`,label:`Point · X`},{path:`camera.point.y`,type:`number`,min:-4e3,max:4e3,step:1,default:0,group:`PanControl`,label:`Point · Y`},{path:`camera.point.zoom`,type:`number`,min:.5,max:3,step:.01,default:1,group:`PanControl`,label:`Point · zoom`},{path:`camera.point.rotation`,type:`number`,min:-6,max:6,step:.1,default:0,group:`PanControl`,label:`Point · rotation`},{path:`camera.point.time`,type:`number`,min:0,max:600,step:.1,default:0,group:`PanControl`,label:`Point · time`},{path:`camera.point.ease`,type:`enum`,options:[`linear`,`smooth`,`smoother`],default:`smoother`,group:`PanControl`,label:`Point · ease`},{path:`appearance.hair`,type:`enum`,options:yk,default:`crop`,group:`Wardrobe`,label:`Hair`},{path:`appearance.top`,type:`enum`,options:Kk.top,default:`tee`,group:`Wardrobe`,label:`Top`},{path:`appearance.sleeves`,type:`enum`,options:Kk.sleeves,default:`short`,group:`Wardrobe`,label:`Sleeves`},{path:`appearance.outerwear`,type:`enum`,options:Kk.outerwear,default:`none`,group:`Wardrobe`,label:`Outerwear`},{path:`appearance.bottom`,type:`enum`,options:Kk.bottom,default:`jeans`,group:`Wardrobe`,label:`Bottom`},{path:`appearance.footwear`,type:`enum`,options:Kk.footwear,default:`sneakers`,group:`Wardrobe`,label:`Footwear`},{path:`appearance.faceShape`,type:`enum`,options:jk,default:`oval`,group:`Wardrobe`,label:`Face shape`},{path:`appearance.facialHair`,type:`enum`,options:Pk,default:`none`,group:`Wardrobe`,label:`Facial hair`},{path:`appearance.glasses`,type:`enum`,options:Ik,default:`none`,group:`Wardrobe`,label:`Glasses`},{path:`appearance.topColor`,type:`color`,default:`#2b6cb0`,group:`Wardrobe`,label:`Top colour`},{path:`appearance.outerColor`,type:`color`,default:`#455a70`,group:`Wardrobe`,label:`Outerwear colour`},{path:`appearance.bottomColor`,type:`color`,default:`#37455a`,group:`Wardrobe`,label:`Bottom colour`},{path:`appearance.pack`,type:`enum`,options:Gk,default:`casual`,group:`Wardrobe`,label:`Wardrobe pack`},{path:`cast.ageHint`,type:`enum`,options:[`childYoung`,`child`,`teen`,`adult`,`elder`],default:`adult`,group:`Wardrobe`,label:`Age`},{path:`appearance.headwear`,type:`enum`,options:Rk,default:`none`,group:`Wardrobe`,label:`Headwear`},{path:`appearance.headwearColor`,type:`color`,default:`#37455a`,group:`Wardrobe`,label:`Headwear colour`},{path:`appearance.eyeShape`,type:`enum`,options:Bk,default:`round`,group:`Wardrobe`,label:`Eye shape`},{path:`appearance.eyeSpacing`,type:`number`,min:-1,max:1,step:.1,default:0,group:`Wardrobe`,label:`Eye spacing`},{path:`appearance.irisColor`,type:`color`,default:`#243038`,group:`Wardrobe`,label:`Iris colour`},{path:`appearance.lashes`,type:`bool`,default:!1,group:`Wardrobe`,label:`Lashes`},{path:`appearance.browShape`,type:`enum`,options:Hk,default:`flat`,group:`Wardrobe`,label:`Brow shape`},{path:`appearance.browThickness`,type:`number`,min:2,max:7,step:.5,default:4,group:`Wardrobe`,label:`Brow thickness`},{path:`appearance.browColor`,type:`color`,default:`#253038`,group:`Wardrobe`,label:`Brow colour`},{path:`appearance.freckles`,type:`bool`,default:!1,group:`Wardrobe`,label:`Freckles`},{path:`appearance.blush`,type:`bool`,default:!1,group:`Wardrobe`,label:`Blush`},{path:`appearance.earrings`,type:`bool`,default:!1,group:`Wardrobe`,label:`Earrings`},{path:`appearance.wrinkles`,type:`bool`,default:!1,group:`Wardrobe`,label:`Wrinkles (age)`},{path:`lighting.look`,type:`enum`,options:MF,default:`soft`,group:`Lighting`,label:`Lighting look`},{path:`lighting.light.type`,type:`enum`,options:[`sun`,`point`,`spot`,`ambient`],default:`sun`,group:`Lighting`,label:`Key light`},{path:`lighting.light.x`,type:`number`,min:0,max:1,step:.01,default:.3,group:`Lighting`,label:`Light X`},{path:`lighting.light.y`,type:`number`,min:0,max:1,step:.01,default:.1,group:`Lighting`,label:`Light Y (height)`},{path:`lighting.light.color`,type:`color`,default:`#fff2cc`,group:`Lighting`,label:`Light colour`},{path:`element.glow.color`,type:`color`,default:`#ffd27a`,group:`Lighting`,label:`Glow colour`},{path:`element.glow.radius`,type:`number`,min:0,max:200,step:5,default:60,group:`Lighting`,label:`Glow radius`},{path:`element.rim`,type:`bool`,default:!1,group:`Lighting`,label:`Rim light`},{path:`liquid.type`,type:`enum`,options:[`fill`,`pour`,`flow`,`drip`,`wave`],default:`fill`,group:`Materials`,label:`Liquid`},{path:`liquid.pct`,type:`number`,min:0,max:1,step:.01,default:.5,group:`Materials`,label:`Fill level`},{path:`liquid.color`,type:`color`,default:`#4aa3c4`,group:`Materials`,label:`Liquid colour`},{path:`material.shader`,type:`enum`,options:[`none`,`glass`,`metal`,`wet`],default:`none`,group:`Materials`,label:`Material`},{path:`fire.type`,type:`enum`,options:[`flame`,`smoke`,`spark`,`explosion`,`steam`],default:`flame`,group:`Fire`,label:`Fire/energy`},{path:`fire.size`,type:`number`,min:10,max:200,step:5,default:60,group:`Fire`,label:`Size`},{path:`smoke.variant`,type:`enum`,options:[`smolder`,`puff`,`billow`,`wisp`],default:`billow`,group:`Fire`,label:`Smoke variant`},{path:`dataviz.type`,type:`enum`,options:IF,default:`plotOverTime`,group:`Data-viz`,label:`Chart`},{path:`dataviz.data`,type:`text`,default:`[]`,group:`Data-viz`,label:`Data (JSON)`},{path:`type.effect`,type:`enum`,options:LF,default:`wordPop`,group:`Typography`,label:`Kinetic type`},{path:`type.text`,type:`text`,default:``,group:`Typography`,label:`Text`},{path:`type.stagger`,type:`number`,min:0,max:.5,step:.01,default:.15,group:`Typography`,label:`Stagger`},{path:`ui.device`,type:`enum`,options:NF,default:`phone`,group:`Screen/UI`,label:`Device frame`},{path:`ui.content`,type:`enum`,options:[`fakeUI`,`chatThread`,`codeType`,`browserBar`,`notification`,`graphOnScreen`],default:`fakeUI`,group:`Screen/UI`,label:`Screen content`},{path:`state.set`,type:`enum`,options:PF,default:`condition`,group:`Object-state`,label:`State set`},{path:`state.shakeIntensity`,type:`number`,min:0,max:20,step:1,default:6,group:`Object-state`,label:`Shake`},{path:`state.popScale`,type:`number`,min:1,max:2,step:.05,default:1.25,group:`Object-state`,label:`Pop scale`},{path:`weather.consequence`,type:`enum`,options:[`wetGround`,`snowAccumulation`,`windEffect`,`wetCharacter`,`fogBank`],default:`wetGround`,group:`Weather`,label:`Consequence`},{path:`weather.windStrength`,type:`number`,min:0,max:3,step:.1,default:1,group:`Weather`,label:`Wind strength`},{path:`continuity.mode`,type:`enum`,options:[`carryObject`,`motionCarry`,`thematicReprise`],default:`carryObject`,group:`Continuity`,label:`Carry mode`},{path:`particles.mode`,type:`enum`,options:FF,default:`stream`,group:`Particles`,label:`Flow mode`},{path:`particles.count`,type:`number`,min:1,max:300,step:1,default:20,group:`Particles`,label:`Count`},{path:`particles.particleType`,type:`enum`,options:[`dot`,`coin`,`arrow`],default:`dot`,group:`Particles`,label:`Particle`},{path:`particles.rate`,type:`number`,min:.1,max:4,step:.1,default:1,group:`Particles`,label:`Rate`},{path:`finish.profile`,type:`enum`,options:EF,default:`polished`,group:`Finish`,label:`Finish profile`},{path:`element.tier`,type:`enum`,options:wF,default:`secondary`,group:`Finish`,label:`Motion tier`},{path:`element.feel`,type:`enum`,options:SF,default:`flat`,group:`Finish`,label:`Feel (override)`},{path:`element.feelParams.overshootPct`,type:`number`,min:0,max:.4,step:.01,default:.08,group:`Finish`,label:`Overshoot %`},{path:`element.feelParams.windupPct`,type:`number`,min:0,max:.3,step:.01,default:.08,group:`Finish`,label:`Wind-up %`},{path:`element.feelParams.settleMs`,type:`number`,min:0,max:500,step:10,default:150,group:`Finish`,label:`Settle (ms)`},{path:`element.feelParams.intensity`,type:`number`,min:0,max:2,step:.1,default:1,group:`Finish`,label:`Feel intensity`},{path:`finish.staggerMs`,type:`number`,min:0,max:200,step:5,default:75,group:`Finish`,label:`Stagger (ms)`},{path:`finish.secondaryMotion`,type:`bool`,default:!0,group:`Finish`,label:`Secondary motion`},{path:`beat.simultaneous`,type:`bool`,default:!1,group:`Finish`,label:`Enter simultaneously`},{path:`beat.type`,type:`enum`,options:OF,default:`thing`,group:`Taste`,label:`Beat type`},{path:`beat.emphasis`,type:`bool`,default:!1,group:`Taste`,label:`Emphasis beat`},{path:`beat.focalSide`,type:`enum`,options:[`left`,`center`,`right`],default:`left`,group:`Taste`,label:`Focal position`},{path:`beat.deliberateCenter`,type:`bool`,default:!1,group:`Taste`,label:`Deliberate center`},{path:`beat.intensity`,type:`number`,min:0,max:1,step:.05,default:.4,group:`Taste`,label:`Beat intensity`}],Object.fromEntries(UF.map(e=>[e.path,e]))})),GF=o((()=>{WP(),sF(),Bj(),NA(),UO(),DN(),UM(),rP(),Xj(),hP(),JN(),cA(),WF()})),KF=o((()=>{GF()})),qF=o((()=>{GF(),new Set(Lj)})),JF=o((()=>{new Set(`the a an and or but of to in on at for with by from as is are was were be been it its this that these those they them their you your we our i he she his her not no yes so if then than into over about after before while when where why how what which who whom can could will would should may might must do does did have has had get got make makes made just very more most some any all each every one two three now here there also only even because through during them then meanwhile feel feels feeling think thinks really actually basically thing things stuff time times way ways`.split(` `))})),YF=o((()=>{JF(),new Set(`the a an and or of to in on at for with by from as is are was were it its this that your you our their about`.split(` `))}));function XF(e){return String(e||``).trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}function ZF(e,t=`flat`){return`${t}-${XF(e)}`}var QF=o((()=>{})),$F=o((()=>{YF(),new Set(`the a an and or of to in on at for with by from as is are was were it its this that so now then`.split(` `))})),eI=o((()=>{GF(),qF(),YF(),JF(),kd(),$F()})),tI=o((()=>{GF(),KF()})),nI=o((()=>{GF(),KF(),qF(),eI(),tI()}));function rI(e={}){let t=new Map(Object.entries(e));return{read:()=>Object.fromEntries(t),write:e=>{t.clear();for(let[n,r]of Object.entries(e))t.set(n,r)}}}function iI(){return{read(){try{return JSON.parse(localStorage.getItem(sI)||`{}`)||{}}catch{return{}}},write(e){try{localStorage.setItem(sI,JSON.stringify(e))}catch{}}}}function aI(){return typeof localStorage<`u`?iI():rI()}function oI(e=aI()){let t=()=>e.read();return{has(e){return Object.prototype.hasOwnProperty.call(t(),e)},get(e){return t()[e]||null},put(n,r){let i=t();return i[n]={inner:r.inner,w:r.w,h:r.h},e.write(i),n},keys(){return Object.keys(t())},resolverFor(e){let n=t(),r={};return e.forEach(e=>{n[e]&&(r[e]=n[e])}),r}}}var sI,cI=o((()=>{sI=`aivw.v2.assets`}));function lI(e,t,n={}){let r=n.style||`flat`,i=!1,a=(e.scenes||[]).map(e=>{if(!e.entities?.length)return e;let n=!1,a=e.entities.map(e=>{if(e.type!==`assetBox`&&e.type!==`placeholder`)return e;let i=XF(e.label);if(!i)return e;let a=ZF(i,r),o=t.has(a)?`${fI}${a}`:`placeholder`;return e.source===o?e:(n=!0,{...e,source:o})});return n?(i=!0,{...e,entities:a}):e});return i?{...e,scenes:a}:e}function uI(e){let t=new Set;return(e.scenes||[]).forEach(e=>(e.entities||[]).forEach(e=>{let n=mI(e.source);n&&t.add(n)})),(e.props||[]).forEach(e=>{let n=mI(e.cache);n&&t.add(n)}),[...t]}function dI(e,t){let n={};return uI(e).forEach(e=>{let r=t.get(e);r&&(n[`${fI}${e}`]=r)}),n}var fI,pI,mI,hI=o((()=>{QF(),fI=`vault:`,pI=e=>typeof e==`string`&&e.startsWith(fI),mI=e=>pI(e)?e.slice(6):null})),gI=o((()=>{QF(),cI(),hI()})),_I,vI=o((()=>{cI(),_I=oI(aI())}));function yI(e,t,n){return new Promise((t,n)=>{let r=new Blob([e],{type:`image/svg+xml;charset=utf-8`}),i=URL.createObjectURL(r),a=new Image;a.onload=()=>{URL.revokeObjectURL(i),t(a)},a.onerror=()=>{URL.revokeObjectURL(i),n(Error(`v2 svg raster failed`))},a.src=i})}function bI(e,t,n,r){let i=(t||[]).map(e=>e.text).filter(Boolean).join(` `).trim();if(!i)return;let a=Math.max(14,Math.round(r*.03));e.font=`700 ${a}px Nunito, system-ui, sans-serif`;let o=n*.86,s=i.split(/\s+/),c=[],l=``;for(let t of s){let n=l?`${l} ${t}`:t;e.measureText(n).width>o&&l?(c.push(l),l=t):l=n}l&&c.push(l);let u=a*1.3,d=a*.7,f=a*.5,p=Math.min(o+d*2,Math.max(...c.map(t=>e.measureText(t).width))+d*2),m=c.length*u+f*2,h=(n-p)/2,g=r-m-r*.06,_=Math.min(18,m/2);e.fillStyle=`rgba(20,24,30,0.82)`,e.beginPath(),e.moveTo(h+_,g),e.arcTo(h+p,g,h+p,g+m,_),e.arcTo(h+p,g+m,h,g+m,_),e.arcTo(h,g+m,h,g,_),e.arcTo(h,g,h+p,g,_),e.closePath(),e.fill(),e.fillStyle=`#f4f6f8`,e.textAlign=`center`,e.textBaseline=`middle`,c.forEach((t,r)=>e.fillText(t,n/2,g+f+u*(r+.5)))}function xI(e,t,n){let r=lI(e,_I),i=dI(r,_I),a=document.createElement(`div`);a.style.cssText=`position:fixed;left:-99999px;top:0;width:${t}px;height:${n}px;`,document.body.appendChild(a);let o=new oF(a);o.setAspect(r.meta?.aspect||`16:9`),o.setAssets(i),o.svg.setAttribute(`width`,String(t)),o.svg.setAttribute(`height`,String(n));let s=document.createElement(`canvas`);s.width=t,s.height=n;let c=s.getContext(`2d`),l=new XMLSerializer;return{width:t,height:n,async frameAt(e){let i=kP(r,Math.max(0,e));o.render(i),c.clearRect(0,0,t,n),c.fillStyle=`#0b0e12`,c.fillRect(0,0,t,n);try{c.drawImage(o.canvas,0,0,t,n)}catch{}try{let e=await yI(l.serializeToString(o.svg),t,n);c.drawImage(e,0,0,t,n)}catch{}return bI(c,i.bubbles,t,n),s},close(){try{o.destroy()}catch{}try{a.remove()}catch{}}}}var SI=o((()=>{nI(),gI(),vI()}));function CI(e,t,n,r,i){let a=e.createLinearGradient(0,0,0,n);a.addColorStop(0,r),a.addColorStop(1,i),e.fillStyle=a,e.fillRect(0,0,t,n)}function wI(e){let t=Math.sin(e*127.1+311.7)*43758.5453;return t-Math.floor(t)}function TI(e){let t=/^#?([0-9a-f]{6})$/i.exec(String(e||``).trim());if(!t)return null;let n=parseInt(t[1],16);return{r:n>>16&255,g:n>>8&255,b:n&255}}function EI(e,t,n){let r=TI(e),i=TI(t);if(!r||!i)return e;let a=e=>Math.round(r[e]+(i[e]-r[e])*n);return`rgb(${a(`r`)},${a(`g`)},${a(`b`)})`}function DI(e,t){let n=TI(e);return n?`rgba(${n.r},${n.g},${n.b},${t})`:`rgba(0,0,0,${t})`}function OI(e,t,n,r,i){let a,o,s,c,l;if(II(i)){let e=i[0]||zI[0],t=i[1]||zI[1];a=e,o=EI(e,t,.4),s=DI(t,.28),c=DI(t,.35),l=DI(t,0)}else a=`#0a1a3f`,o=`#123a8a`,s=`rgba(120,170,255,0.28)`,c=`rgba(80,140,255,0.35)`,l=`rgba(80,140,255,0)`;CI(e,t,n,a,o);let u=Math.max(28,Math.min(t,n)*.09),d=r*u*.35%u;e.lineWidth=Math.max(1,Math.min(t,n)*.0022),e.strokeStyle=s,e.beginPath();for(let r=-u+d%u;r<=t+u;r+=u)e.moveTo(r,0),e.lineTo(r,n);for(let r=-u+d;r<=n+u;r+=u)e.moveTo(0,r),e.lineTo(t,r);e.stroke();let f=e.createRadialGradient(t/2,n*.45,0,t/2,n*.45,Math.max(t,n)*.6);f.addColorStop(0,c),f.addColorStop(1,l),e.fillStyle=f,e.fillRect(0,0,t,n)}function kI(e,t,n,r){CI(e,t,n,`#050716`,`#0b1030`);let i=[{c:`rgba(90,220,200,0.55)`,fx:.07,fy:.05,px:.3,py:.35,r:.55},{c:`rgba(140,90,240,0.5)`,fx:.05,fy:.08,px:.7,py:.5,r:.6},{c:`rgba(60,140,255,0.5)`,fx:.09,fy:.06,px:.5,py:.7,r:.5},{c:`rgba(240,120,190,0.4)`,fx:.06,fy:.09,px:.4,py:.2,r:.45}];e.globalCompositeOperation=`lighter`;for(let a=0;a<i.length;a++){let o=i[a],s=t*(o.px+.18*Math.sin(r*o.fx*Math.PI*2+a)),c=n*(o.py+.16*Math.cos(r*o.fy*Math.PI*2+a*1.7)),l=Math.max(t,n)*o.r,u=e.createRadialGradient(s,c,0,s,c,l);u.addColorStop(0,o.c),u.addColorStop(1,`rgba(0,0,0,0)`),e.fillStyle=u,e.fillRect(0,0,t,n)}e.globalCompositeOperation=`source-over`}function AI(e,t,n,r){CI(e,t,n,`#1a1130`,`#2a0f3a`);let i=[{c:`rgba(255,120,80,0.55)`,bx:.25,by:.3},{c:`rgba(255,80,160,0.5)`,bx:.75,by:.28},{c:`rgba(120,90,255,0.5)`,bx:.7,by:.75},{c:`rgba(80,200,255,0.45)`,bx:.28,by:.72}];e.globalCompositeOperation=`lighter`;for(let a=0;a<i.length;a++){let o=i[a],s=t*(o.bx+.1*Math.sin(r*.15*Math.PI+a*1.3)),c=n*(o.by+.1*Math.cos(r*.13*Math.PI+a*.9)),l=Math.max(t,n)*(.5+.06*Math.sin(r*.2+a)),u=e.createRadialGradient(s,c,0,s,c,l);u.addColorStop(0,o.c),u.addColorStop(1,`rgba(0,0,0,0)`),e.fillStyle=u,e.fillRect(0,0,t,n)}e.globalCompositeOperation=`source-over`}function jI(e,t,n,r,i){let a;if(II(i)){let r=i[0]||BI[0],o=i[1]||BI[1];CI(e,t,n,r,EI(r,o,.18)),a=e=>DI(o,e)}else CI(e,t,n,`#0b1226`,`#152244`),a=e=>`rgba(150,190,255,${e})`;let o=n*1.25;e.globalCompositeOperation=`lighter`;for(let i=0;i<46;i++){let s=.4+wI(i)*.9,c=(.01+wI(i+99)*.04)*Math.min(t,n),l=(wI(i+7)+.05*Math.sin(r*.3+i))*t,u=n+c-(r*s*n*.06+wI(i+31)*o)%o,d=.15+wI(i+53)*.4,f=e.createRadialGradient(l,u,0,l,u,c);f.addColorStop(0,a(d)),f.addColorStop(1,a(0)),e.fillStyle=f,e.beginPath(),e.arc(l,u,c,0,Math.PI*2),e.fill()}e.globalCompositeOperation=`source-over`}function MI(e,t,n,r){CI(e,t,n,`#04122a`,`#0a2e4a`);for(let i of[{c:`rgba(30,140,200,0.5)`,amp:.05,base:.62,k:1.3,spd:.5},{c:`rgba(40,190,180,0.5)`,amp:.06,base:.72,k:1,spd:-.7},{c:`rgba(80,110,230,0.55)`,amp:.07,base:.82,k:.8,spd:.9}]){e.beginPath(),e.moveTo(0,n);let a=Math.max(6,t/120);for(let o=0;o<=t;o+=a){let a=o/t*Math.PI*2*i.k+r*i.spd,s=n*i.base+Math.sin(a)*n*i.amp;e.lineTo(o,s)}e.lineTo(t,n),e.closePath(),e.fillStyle=i.c,e.fill()}}function NI(e,t,n,r,i){let a=II(i),o=a?i[0]||VI[0]:`#e8e4da`,s=a?i[1]||VI[1]:`#57503f`,c=Math.floor(Math.max(0,Number(r)||0)/LI)%RI*977,l=Math.min(t,n)/360;CI(e,t,n,o,EI(o,s,.08));let u=e.createRadialGradient(t/2,n/2,Math.min(t,n)*.35,t/2,n/2,Math.max(t,n)*.75);u.addColorStop(0,DI(s,0)),u.addColorStop(1,DI(s,.1)),e.fillStyle=u,e.fillRect(0,0,t,n);for(let r=0;r<6;r++){let i=wI(c+11+r)*t,a=wI(c+23+r)*n,o=Math.max(t,n)*(.1+.16*wI(c+37+r)),l=e.createRadialGradient(i,a,0,i,a,o);l.addColorStop(0,DI(s,.055)),l.addColorStop(1,DI(s,0)),e.fillStyle=l,e.fillRect(0,0,t,n)}let d=Math.max(24,Math.min(t,n)*.075),f=(wI(c+3)-.5)*3*l,p=(wI(c+4)-.5)*3*l;e.lineWidth=Math.max(1,l*1.1),e.strokeStyle=DI(s,.16),e.beginPath();for(let r=-d+f;r<=t+d;r+=d)e.moveTo(r,0),e.lineTo(r,n);for(let r=-d+p;r<=n+d;r+=d)e.moveTo(0,r),e.lineTo(t,r);e.stroke(),e.fillStyle=DI(s,.5);for(let r=0;r<42;r++){let i=wI(c+101+r)*t,a=wI(c+211+r)*n,o=(.8+1.8*wI(c+307+r))*l;e.globalAlpha=.22+.38*wI(c+401+r),e.fillRect(i,a,o,o)}e.strokeStyle=DI(s,.3),e.lineWidth=Math.max(.6,l*.7);for(let r=0;r<14;r++){let i=wI(c+503+r)*t,a=wI(c+601+r)*n,o=wI(c+701+r)*Math.PI*2,s=(4+6*wI(c+809+r))*l;e.globalAlpha=.15+.2*wI(c+907+r),e.beginPath(),e.moveTo(i,a),e.lineTo(i+Math.cos(o)*s,a+Math.sin(o)*s),e.stroke()}for(let r=0;r<160;r++){let i=wI(c+1103+r)*t,a=wI(c+1301+r)*n,o=r%2==0;e.fillStyle=o?DI(s,1):`#ffffff`,e.globalAlpha=o?.04+.05*wI(c+1409+r):.05+.07*wI(c+1511+r),e.fillRect(i,a,l,l)}e.globalAlpha=1}function PI(e){if(typeof e!=`string`||!e.startsWith(`anim|`))return null;let[,t,...n]=e.split(`|`);return HI[t]?{key:t,colors:n}:null}function FI(e,t,n,r,i){let a=PI(t);return a?(HI[a.key].draw(e,n,r,Number(i)||0,a.colors),!0):!1}var II,LI,RI,zI,BI,VI,HI,UI=o((()=>{II=e=>Array.isArray(e)&&e.length>0,LI=.17,RI=8,zI=[`#0a1a3f`,`#3b7dff`],BI=[`#0b1226`,`#96beff`],VI=[`#e8e4da`,`#57503f`],HI={grid:{label:`Blue Grid`,draw:OI,css:`linear-gradient(180deg, #0a1a3f, #123a8a)`,tunable:[{key:`base`,label:`Background`,default:zI[0]},{key:`accent`,label:`Grid & glow`,default:zI[1]}]},aurora:{label:`Aurora`,draw:kI,css:`radial-gradient(circle at 35% 40%, rgba(90,220,200,0.7), rgba(140,90,240,0.5) 45%, #0b1030 80%)`},mesh:{label:`Mesh`,draw:AI,css:`radial-gradient(circle at 30% 30%, rgba(255,120,80,0.7), rgba(120,90,255,0.5) 55%, #2a0f3a 85%)`},bokeh:{label:`Bokeh`,draw:jI,css:`radial-gradient(circle at 60% 70%, rgba(150,190,255,0.5), #152244 70%)`,tunable:[{key:`base`,label:`Background`,default:BI[0]},{key:`accent`,label:`Dots`,default:BI[1]}]},waves:{label:`Waves`,draw:MI,css:`linear-gradient(180deg, #0a2e4a 40%, rgba(40,190,180,0.6) 70%, #04122a)`},paper:{label:`Paper`,draw:NI,css:`linear-gradient(180deg, #e8e4da, #ded9cd)`,tunable:[{key:`base`,label:`Paper`,default:VI[0]},{key:`accent`,label:`Grid & flecks`,default:VI[1]}]}}}));function WI(e,t,n,r,i){let a=typeof t==`string`?t:``;if(!FI(e,a,n,r,(Number(i)||0)/1e3)){if(a.startsWith(`radial|`)||a.startsWith(`linear|`)){let t=a.split(`|`),i;if(t[0]===`radial`){let a=t.slice(1);i=e.createRadialGradient(n/2,r*.42,Math.min(n,r)*.05,n/2,r*.5,Math.max(n,r)*.72),GI(i,a)}else{let a=Number(t[1])||90,o=t.slice(2),s=(a-90)*Math.PI/180,c=Math.max(n,r)/2,l=Math.cos(s)*c,u=Math.sin(s)*c;i=e.createLinearGradient(n/2-l,r/2-u,n/2+l,r/2+u),GI(i,o)}e.fillStyle=i}else e.fillStyle=a||`#ffffff`;e.fillRect(0,0,n,r)}}function GI(e,t){let n=t.length;t.forEach((t,r)=>e.addColorStop(n===1?0:r/(n-1),t))}function KI(e){let t=Number(e?.videoWidth||e?.width||e?.naturalWidth||e?.displayWidth)||0,n=Number(e?.videoHeight||e?.height||e?.naturalHeight||e?.displayHeight)||0;return{w:Math.max(1,t),h:Math.max(1,n)}}function qI(e,t){let n=Math.max(0,(t-(e.appearMs||0))/1e3),r=Number(e.speed)>0?Number(e.speed):1,i=Math.max(0,Number(e.trimStartSec)||0),a=i+n*r,o=Number(e.durationSec)||0;if(o>0){let t=Math.max(.05,o-i);a=e.loop===!1?Math.min(a,o-.05):i+(a-i)%t}return a}function JI(e,t){if(Array.isArray(e.wordTimes)&&Number.isFinite(Number(e.wordTimes[t])))return Number(e.wordTimes[t]);let n=e.anim?.speedMs||180;return(e.appearMs||0)+t*n}function YI(e,t){return String(e.text||``).split(/\s+/).filter(Boolean).map((n,r)=>{let i=JI(e,r),a=t-i;return{text:n,start:i,local:a,p:aL(a/320,0,1),spoken:a>=0}})}function XI(e,t){let n=YI(e,t),r=0;for(let t=0;t<n.length;t++){let i=n[t];if(!i.spoken)break;let a=t+1<n.length?Math.max(40,n[t+1].start-i.start):(e.anim?.speedMs||180)*2,o=aL(i.local/a,0,1);r+=Math.round(o*(i.text.length+1))}return r}function ZI(e,t,n){if(!e.motion||e.motion.type===`none`||t<(e.appearMs||0))return null;let r=e.leaveMs==null?n||0:e.leaveMs,i=Math.max(.1,(r-(e.appearMs||0))/1e3),a=(t-(e.appearMs||0))/1e3;return Nu(e.motion,a,i)}function QI(e,t,n){return e+(t-e)*n}function $I(e,t){let n=Math.max(0,Math.min(1,e));return t===`linear`?n:t===`ease-in`?n*n:t===`ease-out`?1-(1-n)*(1-n):n<.5?2*n*n:1-(-2*n+2)**2/2}function eL(e,t){let n={x:e.pos?.x??.5,y:e.pos?.y??.5,size:e.size},r=Array.isArray(e.moves)?e.moves.filter(e=>e&&typeof e==`object`).slice().sort((e,t)=>(e.atMs||0)-(t.atMs||0)):[],i=n;for(let e=0;e<r.length;e++){let n=r[e],a=Number(n.atMs)||0;if(t<a)break;let o=Number(n.durMs),s=Number.isFinite(o)&&o>=0?o:500,c=e+1<r.length?Number(r[e+1].atMs)||0:1/0,l=Math.max(0,Math.min(s,c-a)),u={x:n.pos?.x==null?i.x:n.pos.x,y:n.pos?.y==null?i.y:n.pos.y,size:n.size==null?i.size:n.size};if(l<=0||t>=a+l){i=u;continue}let d=$I((t-a)/l,n.ease);return{pos:{x:QI(i.x,u.x,d),y:QI(i.y,u.y,d)},size:i.size!=null&&u.size!=null?QI(i.size,u.size,d):u.size??i.size}}return{pos:{x:i.x,y:i.y},size:i.size}}function tL(e,t,n){let r=t.shadow==null?.18:Math.max(0,Math.min(1,Number(t.shadow)));if(r<=.001){e.shadowColor=`transparent`,e.shadowBlur=0,e.shadowOffsetY=0;return}e.shadowColor=`rgba(0,0,0,${r})`,e.shadowBlur=n*(.03+r*.14),e.shadowOffsetY=n*(.008+r*.05)}function nL(e,t){return(e?.elements||[]).filter(e=>t>=(e.appearMs||0)&&(e.leaveMs==null||t<e.leaveMs))}function rL(e,t,n=`pop`){let r=t-(e.appearMs||0),i=aL(r/320,0,1),a=1-(1-i)*(1-i);switch(e.kind===`text`?e.anim?.type||`pop`:e.entrance||n||`pop`){case`fade`:return{alpha:a,scale:1,dy:0,p:i};case`rise`:return{alpha:a,scale:1,dy:(1-a)*.06,p:i};case`scale`:return{alpha:1,scale:.4+.6*a,dy:0,p:i};case`typewriter`:case`pop-word`:case`word-pop`:case`sentence-build`:case`highlight`:return{alpha:1,scale:1,dy:0,p:i};case`line`:{let e=i<.7?i/.7*1.12:1.12-.12*((i-.7)/.3);return{alpha:Math.min(1,i*2.5),scale:e,dy:0,p:i}}default:{let e=i<.7?i/.7*1.12:1.12-.12*((i-.7)/.3);return{alpha:Math.min(1,i*2.5),scale:e,dy:0,p:i}}}}function iL(e,t,n,r,i,a){e.save(),WI(e,t.background,i,a,n);let o=t.handoff?.arrive===`fade`?`fade`:`pop`;for(let s of nL(t,n)){let c=rL(s,n,o),l=eL(s,n),u=l.pos,d=l.size==null?s.size:l.size,f=u.x*i,p=(u.y+(c.dy||0))*a;e.save(),e.globalAlpha=c.alpha,e.translate(f,p);let m=ZI(s,n,t.durationMs);if(m&&(e.translate(m.tx/100*i,m.ty/100*a),m.rot&&e.rotate(m.rot*Math.PI/180),m.scale!==1&&e.scale(m.scale,m.scale),m.blur>.01&&(e.filter=`blur(${(m.blur*(a/1080)).toFixed(2)}px)`)),s.tilt&&e.rotate(s.tilt*Math.PI/180),c.scale!==1&&e.scale(c.scale,c.scale),s.kind===`image`||s.kind===`video`){let t=s.src?r(s.src,s):null;!t&&s.kind===`video`&&s.poster&&(t=r(s.poster,s));let n=(d||.28)*i,o=s.box?Math.max(1,s.box.h*a):null,c=s.box?Math.max(1,s.box.w*i):null;if(t&&c){let{w:n,h:r}=KI(t),i=Math.max(c/n,o/r),a=c/i,l=o/i,u=(n-a)/2,d=(r-l)/2;tL(e,s,c),s.cutout||(e.fillStyle=`#fff`,e.fillRect(-c/2-c*.02,-o/2-c*.02,c+c*.04,o+c*.04),e.shadowColor=`transparent`),e.drawImage(t,u,d,a,l,-c/2,-o/2,c,o),s.cutout&&(e.shadowColor=`transparent`)}else if(t){let{w:r,h:i}=KI(t),a=i/r*n;tL(e,s,n),s.cutout||(e.fillStyle=`#fff`,e.fillRect(-n/2-n*.02,-a/2-n*.02,n+n*.04,a+n*.04),e.shadowColor=`transparent`),e.drawImage(t,-n/2,-a/2,n,a),s.cutout&&(e.shadowColor=`transparent`)}else{let t=c||n,r=o||n*.66;e.strokeStyle=`rgba(0,0,0,0.25)`,e.setLineDash([6,5]),e.lineWidth=2,e.strokeRect(-t/2,-r/2,t,r),e.setLineDash([]),e.fillStyle=`rgba(0,0,0,0.4)`,e.font=`${Math.round(a*.028)}px Hanken Grotesk, Arial, sans-serif`,e.textAlign=`center`,e.textBaseline=`middle`,e.fillText(String(s.query||(s.kind===`video`?`video`:`image`)).slice(0,28),0,0)}}else{let t=Math.max(10,(d||.07)*a);e.font=`${s.weight||700} ${t}px ${s.font||`Hanken Grotesk`}, Arial, sans-serif`,e.fillStyle=s.color||`#111111`,e.textAlign=`center`,e.textBaseline=`middle`;let r=s.anim?.type||`pop`,i=String(s.text||``);if(r===`typewriter`){if(Array.isArray(s.wordTimes)&&s.wordTimes.length){let t=XI(s,n);e.fillText(i.slice(0,t),0,0)}else{let t=s.anim?.speedMs||45,r=Math.max(0,Math.floor((n-(s.appearMs||0))/t));e.fillText(i.slice(0,r),0,0)}}else if(r===`pop-word`||r===`word-pop`||r===`sentence-build`||r===`highlight`){let i=YI(s,n),a=i.map(t=>e.measureText(`${t.text} `).width),o=-a.reduce((e,t)=>e+t,0)/2,l=s.anim?.entrance||`pop`;for(let n=0;n<i.length;n++){let s=i[n];if(r===`highlight`)e.save(),e.translate(o+a[n]/2,0),e.globalAlpha=c.alpha*(s.spoken?1:.3),e.fillText(s.text,0,0),e.restore();else if(s.spoken){let i=s.p;e.save();let u=1,d=0,f=0,p=Math.min(1,i*2.5);if(r===`sentence-build`){let e=1-(1-i)*(1-i);l===`fade`?p=e:l===`slide`?(d=(1-e)*-t*.8,p=e):l===`rise`?(f=(1-e)*t*.6,p=e):l===`scale`?(u=.4+.6*e,p=1):u=i<.7?i/.7*1.12:1.12-.12*((i-.7)/.3)}else u=i<.7?i/.7*1.12:1.12-.12*((i-.7)/.3);e.translate(o+a[n]/2+d,f),e.scale(u,u),e.globalAlpha=c.alpha*p,e.fillText(s.text,0,0),e.restore()}o+=a[n]}}else e.fillText(i,0,0)}e.restore()}e.restore()}var aL,oL=o((()=>{Lu(),UI(),[...Object.entries(HI).map(([e,t])=>({key:`anim-${e}`,label:t.label,value:`anim|${e}`,animated:!0}))],aL=(e,t,n)=>Math.max(t,Math.min(n,e))}));function sL(e){return e===`9:16`?[1080,1920]:e===`1:1`?[1080,1080]:[1920,1080]}async function cL(e,t=1920,n=1080){let r=typeof OffscreenCanvas<`u`?new OffscreenCanvas(t,n):Object.assign(document.createElement(`canvas`),{width:t,height:n}),i=r.getContext(`2d`),a=new Map,o=new Set;for(let t of e?.elements||[])t.kind===`image`&&t.src&&o.add(t.src),t.kind===`video`&&t.poster&&o.add(t.poster);await Promise.all([...o].map(e=>new Promise(t=>{let n=new Image;n.crossOrigin=`anonymous`,n.onload=()=>{a.set(e,n),t()},n.onerror=()=>t(),n.src=e})));let s=(e?.elements||[]).filter(e=>e.kind===`video`&&e.src),c=new Map;await Promise.all(s.map(e=>new Promise(t=>{if(typeof document>`u`)return t();let n=document.createElement(`video`);n.crossOrigin=`anonymous`,n.muted=!0,n.playsInline=!0,n.preload=`auto`;let r=()=>t();n.addEventListener(`loadeddata`,()=>{c.set(e.id,n),r()},{once:!0}),n.addEventListener(`error`,r,{once:!0}),setTimeout(r,8e3),n.src=e.src})));let l=(e,t)=>new Promise(n=>{if(Math.abs((e.currentTime||0)-t)<uL)return n();let r=setTimeout(n,lL);e.addEventListener(`seeked`,()=>{clearTimeout(r),n()},{once:!0});try{e.currentTime=t}catch{clearTimeout(r),n()}});return{width:t,height:n,frameAt:async o=>{let u=Math.max(0,o)*1e3;for(let e of s){let t=c.get(e.id);if(!t||u<(e.appearMs||0)||e.leaveMs!=null&&u>=e.leaveMs)continue;let n=Number(e.durationSec)||t.duration||0;await l(t,qI({...e,durationSec:n},u))}return iL(i,e,u,(e,t)=>a.get(e)||(t&&t.src===e?c.get(t.id):null)||null,t,n),r},close:()=>{a.clear();for(let e of c.values())try{e.pause(),e.removeAttribute(`src`),e.load()}catch{}c.clear()}}}var lL,uL,dL=o((()=>{oL(),lL=1500,uL=.006}));async function fL(e){let t=e?.original;if(!t?.assetId||!t?.versionId)return null;try{let e=pf(t);return e?await ff(e):null}catch{return null}}function pL(e){return e===`16:9`?[1920,1080]:e===`1:1`?[1080,1080]:[1080,1920]}function mL(e){return e?.aspect===`9:16`?[1080,1920]:e?.aspect===`1:1`?[1080,1080]:[1920,1080]}async function hL(e){let t=e.kind||`image`;if(t===`vector-scene`&&e.scene){let[t,n]=mL(e.scene),r=nO(e.scene,t,n,{debug:e.debug}),i=e.trimStart||0,a=e.speed||1;return{width:r.width,height:r.height,frameAt:e=>r.frameAt(i+Math.max(0,e)*a),close:()=>r.close?.()}}if(t===`collage`&&e.collage){let[t,n]=sL(e.collage.aspect),r=await cL(e.collage,t,n);return{width:r.width,height:r.height,frameAt:t=>r.frameAt(Math.max(0,t)*(e.speed||1)+(e.trimStart||0)),close:()=>r.close?.()}}if(t===`v2-scene`&&e.v2video){let[t,n]=pL(e.v2video.meta?.aspect),r=xI(e.v2video,t,n),i=e.trimStart||0,a=e.speed||1;return{width:r.width,height:r.height,frameAt:e=>r.frameAt(i+Math.max(0,e)*a),close:()=>r.close?.()}}let n=t===`video`?await lf(e.url):null;if(n)return gL({...e,url:n},null);let r=await fL(e)||await sf(e);if(uf(r))throw Error(`Can't find "${r.name}" on this device. Reconnect your local folder or re-import it, then try the export again.`);if(t===`video`&&(r.type||``).startsWith(`image/`)&&(t=`image`),t===`image`)try{let e=await createImageBitmap(r);return{frameAt:async()=>e,close:()=>e.close?.()}}catch{let t=URL.createObjectURL(r),n=new Image;await new Promise((r,i)=>{n.onload=r,n.onerror=()=>i(Error(`image load failed: ${e.title||e.url}`)),n.src=t});let i=await createImageBitmap(n);return URL.revokeObjectURL(t),{frameAt:async()=>i,close:()=>i.close?.()}}if(!e.reverse)try{return await NS(e,await r.arrayBuffer())}catch(t){console.warn(`[export] WebCodecs decode failed, seek fallback:`,e.title||e.url,t?.message||t)}return gL(e,r)}async function gL(e,t){let n=document.createElement(`video`);n.crossOrigin=`anonymous`,n.muted=!0,n.preload=`auto`,n.playsInline=!0;let r=t?URL.createObjectURL(t):e.url;n.src=r,await new Promise((t,r)=>{let i=()=>{s(),t()},a=()=>{s(),r(Error(`video load failed: ${e.title||e.url}`))},o=setTimeout(()=>{s(),r(Error(`video load timeout: ${e.title||e.url}`))},3e4);function s(){clearTimeout(o),n.removeEventListener(`loadeddata`,i),n.removeEventListener(`error`,a)}n.addEventListener(`loadeddata`,i),n.addEventListener(`error`,a)});let i=e.speed||1,a=e.trimStart||0,o=n.duration||0;return{async frameAt(t){let r=e.reverse?(e.trimEnd??o)-t*i:a+t*i;return r=Math.max(0,Math.min(Math.max(0,o-.001),r)),Math.abs(n.currentTime-r)>.001&&await new Promise(e=>{let t=()=>{n.removeEventListener(`seeked`,t),e()};n.addEventListener(`seeked`,t),n.currentTime=r,setTimeout(e,2e3)}),n},close(){try{n.removeAttribute(`src`),n.load(),URL.revokeObjectURL(r)}catch{}}}}var _L=o((()=>{PS(),gf(),iO(),SI(),dL()}));async function vL(e){let t=[];for(let n of e||[]){let e=n?.kind||`image`;if(!n?.url||e===`vector-scene`||e===`v2-scene`||e===`collage`||!wL(n))continue;let r=null;try{if(n.original?.assetId&&n.original?.versionId){let e=pf(n.original);e&&(r=await ff(e).catch(()=>null))}r||=await sf(n)}catch{continue}uf(r)&&t.push(r.name||n.title||n.url)}return[...new Set(t)]}function yL(e,t){let n=String(e||``).split(/[:/]/).map(Number),[r,i]=n.length===2&&n[0]>0&&n[1]>0?n:[16,9],a=[720,1080].includes(Number(t))?Number(t):1080,o,s;return r>=i?(s=a,o=Math.round(r/i*a)):(o=a,s=Math.round(i/r*a)),o-=o%2,s-=s%2,[Math.max(2,o),Math.max(2,s)]}function bL(e={}){let t=e||{},n=[24,30,60].includes(t.fps)?t.fps:TL.fps,[r,i]=yL(t.aspect||`16:9`,t.resolution),a=t.quality===`standard`?.1:.15;return{width:r,height:i,fps:n,bitrate:Math.min(28e6,Math.max(2e6,Math.round(r*i*n*a)))}}function xL(e){let t=new Map((e||[]).map((e,t)=>[e,t]));return(e,n)=>{let r=t.has(e.trackId)?t.get(e.trackId):0,i=t.has(n.trackId)?t.get(n.trackId):0;return r===i?(e.start||0)-(n.start||0):r-i}}async function SL(e,t){let n;for(let e=0;;e++)try{n=await cf(t);break}catch(t){if(e>=2)throw Error(`audio fetch failed after ${e+1} tries: ${t.message}`);await new Promise(t=>setTimeout(t,400*(e+1)))}if(uf(n))throw Error(`Can't find audio "${n.name}" on this device. Reconnect your local folder or re-import it, then try the export again.`);return e.decodeAudioData(n)}async function CL(e,{onProgress:t,settings:n,nativeAudio:r=null}={}){let{clips:i=[],audio:a=[],targetDuration:o=0,trackOrder:s=[],overlays:c=[],stickers:l=[],blurs:u=[],zooms:d=[],polishFx:f=[],fullscreenFrames:p=[],figureSweeps:m=[],graphs:h=[],fxEvents:g=[],liveOverlays:_=[],previewH:v=0,backgroundColor:y=`#000000`,stillmadeWatermark:b=!1,stillmadeWatermarkPos:x=`br`,stillmadeWatermarkOpacity:S=null,stillmadeEndScreen:C=!1,stillmadeEndScreenSec:w=void 0,stillmadeEndScreenAnim:T=void 0}=e||{},E=await vL(i);if(E.length){let e=E.length===1?E[0]:`${E.slice(0,-1).join(`, `)} and ${E.at(-1)}`;throw Error(`Can't find ${E.length===1?`this file`:`these files`} on this device: ${e}. Reconnect your local folder or re-import, then try the export again. If you just re-imported ${E.length===1?`it`:`them`}, choose Update affected steps on the Steps after Import media first, so they use the new copies.`)}let D=i.filter(e=>e&&(e.url||e.kind===`vector-scene`&&e.scene||e.kind===`v2-scene`&&e.v2video||e.kind===`collage`&&e.collage)).map(e=>({id:e.id,kind:e.kind||`image`,url:e.url,scene:e.kind===`vector-scene`?e.scene:void 0,v2video:e.kind===`v2-scene`?e.v2video:void 0,collage:e.kind===`collage`?e.collage:void 0,source:e.source,localKey:e.localKey,original:e.original,title:e.title,trackId:e.trackId,start:e.start||0,duration:e.duration||0,speed:e.speed||1,reverse:!!e.reverse,trimStart:(e.trimStart||0)+(e.sourceOffset||0),trimEnd:e.trimEnd,motion:e.motion,color:e.color,lut:e.lut,transition:e.transition,speedRamp:e.speedRamp,freeze:e.freeze,transform:{...e.transform||{},opacity:e.transform?.opacity??e.opacity??1},shareSource:!!e.shareSource})).sort(xL(s)),O=D.reduce((e,t)=>Math.max(e,t.start+t.duration),0),k=a.reduce((e,t)=>Math.max(e,(t.start||0)+(t.duration||0)),0),A=Math.max(o||0,O,k,1),j=C?A+sp(w):A,M=[],N=new Map;for(let e of D)N.has(e.trackId)||N.set(e.trackId,[]),N.get(e.trackId).push(e);for(let e of N.values()){e.sort((e,t)=>e.start-t.start);for(let t=0;t<e.length-1;t++){let n=e[t],r=e[t+1],i=n.transition?.type;if(!i||i===`Cut`)continue;let a=Math.min(n.transition.duration||.5,n.duration*.9,r.duration*.9);a<=.01||M.push({outId:n.id,inId:r.id,type:i,startT:Math.max(0,n.start+n.duration-a/2),dur:a,color:n.transition.color||null})}}let P=null,F=a.filter(e=>e&&e.url);if(F.length&&r===null){let e=new(window.AudioContext||window.webkitAudioContext),n=[],r=new Map;for(let i of F){t&&t({phase:`audio-decode`});try{let t=`${i.source||``}\u0000${i.localKey||``}\u0000${i.url}`;r.has(t)||r.set(t,SL(e,i));let a=await r.get(t);n.push({audioBuffer:a,start:i.start||0,durationSec:i.duration||a.duration,volume:(i.volume??80)/100,fadeIn:i.fadeIn||0,fadeOut:i.fadeOut||0,sourceOffset:i.sourceOffset||0,loop:!!i.loop,rate:i.rate>0?i.rate:1})}catch(t){if(!i.embedded){try{e.close?.()}catch{}throw Error(`Audio "${i.title||i.url}" failed to load (${t.message}). Export stopped so this sound isn't silently missing — if retrying doesn't fix it, re-import or replace that item (its source may be gone).`)}console.warn(`[export] audio decode failed, skipping:`,i.url,t.message)}}try{e.close?.()}catch{}n.length&&(P=await Du(n,{duration:j}))}let I={...n,aspect:n?.aspect||e?.aspect||e?.aspectRatio};return{...TL,...bL(I),duration:j,layers:D,transitions:M,overlays:c,stickers:l,blurs:u,zooms:d,polishFx:f,fullscreenFrames:p,figureSweeps:m,graphs:h,fxEvents:g,liveOverlays:_,previewH:v,backgroundColor:y,stillmadeWatermark:b,stillmadeWatermarkPos:x,stillmadeWatermarkOpacity:S,stillmadeEndScreen:C,stillmadeEndScreenSec:w,stillmadeEndScreenAnim:T,audioBuffer:P,nativeAudio:r}}var wL,TL,EL=o((()=>{ku(),gf(),gp(),wL=e=>!!(e?.original?.assetId&&e?.original?.versionId)||/^(?:sm-media|blob|file):/i.test(String(e?.url||``)),TL={width:1920,height:1080,fps:60,bitrate:18e6}}));function DL(e){return e instanceof Blob&&OL.add(e),e}var OL,kL=o((()=>{OL=new WeakSet})),AL=c({renderNative:()=>ML,wavHeader:()=>jL});function jL(e){let t=e.numberOfChannels,n=e.length*t*2;if(n>4294967259)throw Error(`Audio exceeds WAV size limit`);let r=new Uint8Array(44),i=new DataView(r.buffer),a=(e,t)=>[...t].forEach((t,n)=>i.setUint8(e+n,t.charCodeAt(0)));return a(0,`RIFF`),i.setUint32(4,n+36,!0),a(8,`WAVE`),a(12,`fmt `),i.setUint32(16,16,!0),i.setUint16(20,1,!0),i.setUint16(22,t,!0),i.setUint32(24,e.sampleRate,!0),i.setUint32(28,e.sampleRate*t*2,!0),i.setUint16(32,t*2,!0),i.setUint16(34,16,!0),a(36,`data`),i.setUint32(40,n,!0),r}async function ML(e,{onProgress:t,signal:n,exportAuthorization:r}={}){let i=hf(),a=new Map,o,s=()=>{if(n?.aborted)throw Error(`Export aborted`)},c=()=>{o&&i.cancelExport(o.id).catch(()=>{})};n?.addEventListener(`abort`,c,{once:!0});try{s();let n=Math.max(1,Math.round(e.duration*e.fps));if(o=await i.beginExport({width:e.width,height:e.height,fps:e.fps,frames:n},r?.ticket),s(),await document.fonts?.ready,s(),e.stickers?.some(e=>e.shape===`gif`)){let{preloadGifStickers:t}=await Sr(async()=>{let{preloadGifStickers:e}=await Promise.resolve().then(()=>(Vf(),xf));return{preloadGifStickers:e}},void 0);await t(e.stickers)}for(let t of e.layers)s(),a.has(t.id)||a.set(t.id,await hL(t));let c=new OffscreenCanvas(e.width,e.height).getContext(`2d`,{willReadFrequently:!0});for(let r=0;r<n;r++)s(),await Nh(c,e,r/e.fps,a,e.width,e.height),s(),await i.writeExportFrame(o.id,r,new Uint8Array(c.getImageData(0,0,e.width,e.height).data.buffer)),s(),(r%12==0||r===n-1)&&t?.({phase:`video`,done:r+1,total:n});if(e.nativeAudio?.length&&(s(),t?.({phase:`audio`}),await i.mixExportAudio(o.id,e.nativeAudio),s()),s(),e.audioBuffer){let n=e.audioBuffer;t?.({phase:`audio`}),await i.writeExportAudio(o.id,jL(n));let r=Array.from({length:n.numberOfChannels},(e,t)=>n.getChannelData(t));for(let e=0;e<n.length;e+=16384){s();let t=Math.min(16384,n.length-e),a=new Uint8Array(t*r.length*2),c=new DataView(a.buffer);for(let n=0;n<t;n++)for(let t=0;t<r.length;t++){let i=Math.max(-1,Math.min(1,r[t][e+n]));c.setInt16((n*r.length+t)*2,Math.round(i<0?i*32768:i*32767),!0)}await i.writeExportAudio(o.id,a)}}s();let l=await i.finishExport(o.id);return o=null,s(),t?.({phase:`done`}),l}finally{n?.removeEventListener(`abort`,c);for(let e of a.values())e.close?.();o&&await i.cancelExport(o.id).catch(()=>{})}}var NL=o((()=>{Lh(),_L(),gf(),Cr()}));async function PL(){return hf()&&(await hf().capabilities()).nativeTimelineExport?{strategy:`native`}:Ir()}async function FL(e,t={}){JL(t.signal),t.exportAuthorization?.watermark===!0&&(e={...e,stillmadeWatermark:!0});let n=hf(),r=n&&(await n.capabilities()).nativeTimelineExport;JL(t.signal);let i=r&&n.prepareNativeAudio?await n.prepareNativeAudio(e.audio||[]):null;JL(t.signal);let a=await CL(e,{...t,nativeAudio:i});if(a.stillmadeWatermark||a.stillmadeEndScreen)try{await Promise.all(pp().map(e=>document.fonts.load(e)))}catch{}JL(t.signal);let o=r?await(await Sr(async()=>{let{renderNative:e}=await Promise.resolve().then(()=>(NL(),AL));return{renderNative:e}},void 0)).renderNative(a,t):await BL(a,t);return t.exportAuthorization?DL(o):o}async function IL(e,{width:t,height:n,duration:r,fps:i=30,shortSide:a=1080,signal:o,onProgress:s,render:c=BL,plan:l=CL}={}){if(JL(o),!(e instanceof Blob)||!e.size)throw Error(`A video file is needed for a working copy.`);if(!(t>0&&n>0&&r>0))throw Error(`The video’s size and length are needed before it can be made smaller.`);if(Math.min(t,n)<720)throw Error(`no-gain`);let u=URL.createObjectURL(e);try{let e=await l({clips:[{id:`working`,kind:`video`,url:u,start:0,duration:r,trimStart:0,speed:1,trackId:`video`}],audio:[{id:`working-audio`,url:u,start:0,duration:r,trimStart:0,volume:1,trackId:`audio`}],targetDuration:r,trackOrder:[`video`],stillmadeWatermark:!1,stillmadeEndScreen:!1},{settings:{aspect:`${t}:${n}`,resolution:Math.min(a,1080)>=1080?1080:720,fps:[24,30,60].includes(i)?i:30,quality:`standard`},onProgress:s,signal:o});JL(o);let d=await c(e,{onProgress:s,signal:o});return d instanceof Blob?d:new Blob([d],{type:`video/mp4`})}finally{URL.revokeObjectURL(u)}}async function LL(e,{keep:t,width:n,height:r,duration:i,fps:a=30,shortSide:o=1080,signal:s,onProgress:c,render:l=BL,plan:u=CL}={}){JL(s);let d=e instanceof Blob&&e.size>0,f=typeof e==`string`&&e?e:d?URL.createObjectURL(e):null;if(!f)throw Error(`A video file is needed to cut.`);if(!(n>0&&r>0&&i>0))throw Error(`The video’s size and length are needed before it can be cut.`);let p=(Array.isArray(t)?t:[]).map(e=>({start:Math.max(0,Number(e?.start)),end:Math.min(i,Number(e?.end))})).filter(e=>Number.isFinite(e.start)&&Number.isFinite(e.end)&&e.end-e.start>.001);if(!p.length)throw Error(`Keep at least part of the recording.`);try{let e=0,t=[],i=[];for(let[n,r]of p.entries()){let a=r.end-r.start;t.push({id:`cut-${n}`,kind:`video`,url:f,start:e,duration:a,trimStart:r.start,speed:1,trackId:`video`}),i.push({id:`cut-audio-${n}`,url:f,start:e,duration:a,trimStart:r.start,volume:1,trackId:`audio`}),e+=a}let d=await u({clips:t,audio:i,targetDuration:e,trackOrder:[`video`],stillmadeWatermark:!1,stillmadeEndScreen:!1},{settings:{aspect:`${n}:${r}`,resolution:Math.min(n,r,o)>=1080?1080:720,fps:[24,30,60].includes(a)?a:30,quality:`standard`},onProgress:c,signal:s});JL(s);let m=await l(d,{onProgress:c,signal:s});return{file:m instanceof Blob?m:new Blob([m],{type:`video/mp4`}),duration:e}}finally{d&&URL.revokeObjectURL(f)}}async function RL(e,t={}){JL(t.signal);let n=hf(),r=n?.beginAudioExport&&n.prepareNativeAudio?await n.prepareNativeAudio(e.audio||[]):null;JL(t.signal);let i=await CL(e,{...t,nativeAudio:r});if(JL(t.signal),r?.length){let e,a=()=>{e&&n.cancelExport(e.id).catch(()=>{})};try{e=await n.beginAudioExport(i.duration,t.exportAuthorization?.ticket),t.signal?.addEventListener(`abort`,a,{once:!0}),JL(t.signal),t.onProgress?.(.1),await n.mixExportAudio(e.id,r),JL(t.signal),t.onProgress?.(.8);let o=await n.finishExport(e.id);return e=null,JL(t.signal),t.onProgress?.(1),o}finally{t.signal?.removeEventListener(`abort`,a),e&&await n.cancelExport(e.id).catch(()=>{})}}if(!i.audioBuffer){let e=Error(`NO_AUDIO`);throw e.code=`NO_AUDIO`,e}return Ou(i.audioBuffer,t)}async function zL(e,t){if(!e.shareSource||e.kind!==`video`||e.reverse||!e.url)return hL(e);t.has(e.url)||t.set(e.url,hL({...e,id:`shared:${e.url}`,start:0,trimStart:0,trimEnd:void 0,speed:1}));let n=await t.get(e.url),r=e.trimStart||0,i=e.speed||1;return{...n,frameAt:e=>n.frameAt(r+Math.max(0,e)*i),close(){}}}async function BL(e,{onProgress:t,signal:n}={}){let r=await Ir();if(r.strategy!==`webcodecs`)throw Error(`WebCodecs unavailable (wasm fallback is a later phase)`);let{width:i,height:a,fps:o,duration:s}=e;if(e.overlays?.length)try{await document.fonts?.ready}catch{}if(e.stickers?.some?.(e=>e?.shape===`gif`))try{let{preloadGifStickers:t}=await Sr(async()=>{let{preloadGifStickers:e}=await Promise.resolve().then(()=>(Vf(),xf));return{preloadGifStickers:e}},void 0);await t(e.stickers)}catch{}let c=new Map,l=new Map,u=null;try{for(let t of e.layers){if(n?.aborted)throw Error(`aborted`);c.has(t.id)||c.set(t.id,await zL(t,l))}let d=e.audioBuffer?await Tu(e.audioBuffer):null,f=Math.max(1,Math.round(s*o)),p=d?Math.ceil(d.buffer.length/(d.codec===`opus`?960:1024))+64:0,m=Mo({width:i,height:a,fps:o,audio:d?{channels:d.buffer.numberOfChannels,sampleRate:d.buffer.sampleRate,codec:d.codec}:null,expected:{video:f+16,audio:p}});u=Po({codec:r.videoCodec,width:i,height:a,fps:o,bitrate:e.bitrate||1e7,hardwareAcceleration:r.hardwareAcceleration||`prefer-hardware`,onChunk:(e,t)=>m.addVideoChunk(e,t)});let h=new OffscreenCanvas(i,a),g=h.getContext(`2d`),_=f;for(let r=0;r<_;r++){if(n?.aborted)throw Error(`aborted`);let s=r/o;await Nh(g,e,s,c,i,a),await u.encodeFrame(h,Math.round(s*1e6),r%48==0),t&&(r%12==0||r===_-1)&&t({phase:`video`,done:r+1,total:_})}return await u.finish(),u=null,d&&(t&&t({phase:`audio`}),await Eu(d.buffer,{config:d.config,onChunk:(e,t)=>m.addAudioChunk(e,t)})),t&&t({phase:`done`}),m.finalize()}finally{for(let e of c.values())try{e.close?.()}catch{}for(let e of l.values())try{(await e).close?.()}catch{}if(u)try{u.close()}catch{}}return e.audioBuffer&&(t&&t({phase:`audio`}),await Eu(e.audioBuffer,{onChunk:(e,t)=>muxer.addAudioChunk(e,t)})),t&&t({phase:`done`}),muxer.finalize()}async function VL(){let e=await Ir();if(e.strategy!==`webcodecs`)return{ok:!1,reason:`no webcodecs`,caps:e};let t=44100,n=Mo({width:640,height:360,fps:24,audio:{channels:2,sampleRate:t}}),r=Po({codec:e.videoCodec,width:640,height:360,fps:24,bitrate:2e6,onChunk:(e,t)=>n.addVideoChunk(e,t)}),i=new OffscreenCanvas(640,360),a=i.getContext(`2d`);for(let e=0;e<48;e++)a.fillStyle=`#101830`,a.fillRect(0,0,640,360),a.fillStyle=`#e0b84c`,a.fillRect(e/48*560,140,80,80),await r.encodeFrame(i,Math.round(e/24*1e6),e%48==0);await r.finish();let o=new OfflineAudioContext(2,t*2,t),s=o.createOscillator();s.frequency.value=440;let c=o.createGain();c.gain.value=.2,s.connect(c).connect(o.destination),s.start(0),s.stop(2),await Eu(await o.startRendering(),{onChunk:(e,t)=>n.addAudioChunk(e,t)});let l=n.finalize(),u=new Uint8Array(await l.slice(0,12).arrayBuffer()),d=String.fromCharCode(u[4],u[5],u[6],u[7])===`ftyp`,f=URL.createObjectURL(l),p=await new Promise(e=>{let t=document.createElement(`video`);t.preload=`metadata`,t.muted=!0,t.onloadedmetadata=()=>e({w:t.videoWidth,h:t.videoHeight,dur:Math.round(t.duration*100)/100}),t.onerror=()=>e({error:`decode error`}),t.src=f,setTimeout(()=>e({error:`timeout`}),5e3)});return URL.revokeObjectURL(f),{ok:!0,size:l.size,type:l.type,ftyp:d,codec:e.videoCodec,probe:p}}function HL(e,t){let n=document.createElement(`canvas`);n.width=800,n.height=450;let r=n.getContext(`2d`);r.fillStyle=t,r.fillRect(0,0,800,450),r.strokeStyle=`rgba(255,255,255,0.35)`;for(let e=0;e<=800;e+=80)r.beginPath(),r.moveTo(e,0),r.lineTo(e,450),r.stroke();for(let e=0;e<=450;e+=90)r.beginPath(),r.moveTo(0,e),r.lineTo(800,e),r.stroke();return r.fillStyle=`#fff`,r.font=`bold 160px sans-serif`,r.textAlign=`center`,r.textBaseline=`middle`,r.fillText(e,400,225),n.toDataURL(`image/png`)}async function UL(){let e={width:640,height:360,fps:24,duration:4,bitrate:3e6,layers:[{id:`a`,kind:`image`,url:HL(`A`,`#1a3a5a`),start:0,duration:2,motion:{type:`zoom`,zoomDirection:`in`,zoomAmount:1.4,zoomAnchor:`center`,intensity:100,range:[0,100],easing:`ease-in-out`},color:{saturation:40},transform:{opacity:1}},{id:`b`,kind:`image`,url:HL(`B`,`#5a1a3a`),start:2,duration:2,motion:{type:`pan`,panDirection:`left-right`,panAmount:20,intensity:100,range:[0,100],easing:`linear`},lut:`Teal and Orange`,transform:{opacity:1}}]},t=44100,n=new OfflineAudioContext(2,t*4,t),r=n.createOscillator();r.frequency.value=330;let i=n.createGain();i.gain.value=.15,r.connect(i).connect(n.destination),r.start(0),r.stop(4),e.audioBuffer=await n.startRendering();let a=performance.now(),o=await BL(e),s=Math.round(performance.now()-a),c=new Map;for(let t of e.layers)c.set(t.id,await hL(t));let l=document.getElementById(`__rt`);l||(l=document.createElement(`canvas`),l.id=`__rt`,l.style.cssText=`position:fixed;top:8px;left:8px;z-index:99999;border:2px solid #0f0;background:#000`,document.body.appendChild(l)),l.width=640,l.height=360,await Nh(l.getContext(`2d`),e,1,c,640,360);let u=new Uint8Array(await o.slice(0,12).arrayBuffer()),d=String.fromCharCode(u[4],u[5],u[6],u[7])===`ftyp`,f=URL.createObjectURL(o),p=await new Promise(e=>{let t=document.createElement(`video`);t.preload=`metadata`,t.muted=!0,t.onloadedmetadata=()=>e({w:t.videoWidth,h:t.videoHeight,dur:Math.round(t.duration*100)/100}),t.onerror=()=>e({error:`decode`}),t.src=f,setTimeout(()=>e({error:`timeout`}),6e3)});return URL.revokeObjectURL(f),{ok:!0,size:o.size,ftyp:d,probe:p,ms:s}}async function WL(){let e=await BL({width:480,height:270,fps:24,duration:3,bitrate:2e6,layers:[{id:`s`,kind:`image`,url:HL(`V`,`#243a2a`),start:0,duration:3,motion:{type:`pan`,panDirection:`left-right`,panAmount:30,intensity:100,range:[0,100],easing:`linear`},transform:{opacity:1}}]}),t=URL.createObjectURL(e),n=performance.now(),r=await BL({width:480,height:270,fps:24,duration:2,bitrate:2e6,layers:[{id:`v`,kind:`video`,url:t,start:0,duration:2,trimStart:.5,speed:1,motion:{type:`zoom`,zoomDirection:`in`,zoomAmount:1.3,zoomAnchor:`center`,intensity:100,range:[0,100],easing:`ease-in-out`},transform:{opacity:1}}]}),i=Math.round(performance.now()-n);URL.revokeObjectURL(t);let a=new Uint8Array(await r.slice(0,12).arrayBuffer()),o=String.fromCharCode(a[4],a[5],a[6],a[7])===`ftyp`,s=URL.createObjectURL(r),c=await new Promise(e=>{let t=document.createElement(`video`);t.preload=`metadata`,t.muted=!0,t.onloadedmetadata=()=>e({w:t.videoWidth,h:t.videoHeight,dur:Math.round(t.duration*100)/100}),t.onerror=()=>e({error:`decode`}),t.src=s,setTimeout(()=>e({error:`timeout`}),8e3)});return URL.revokeObjectURL(s),{ok:!0,srcSize:e.size,size:r.size,ftyp:o,probe:c,ms:i}}async function GL(){let e=await CL({targetDuration:4,trackOrder:[`video`,`overlay`],audio:[],clips:[{id:`c1`,kind:`image`,trackId:`video`,url:HL(`1`,`#203a4a`),start:0,duration:2,motion:{type:`ken-burns`,intensity:100,range:[0,100],easing:`ease-in-out`},transform:{opacity:1}},{id:`c2`,kind:`image`,trackId:`video`,url:HL(`2`,`#4a2030`),start:2,duration:2,motion:{type:`zoom`,zoomDirection:`out`,zoomAmount:1.5,intensity:100,range:[0,100]},lut:`Filmic`,transform:{opacity:1}}]}),t=performance.now(),n=await BL(e),r=Math.round(performance.now()-t),i=new Uint8Array(await n.slice(0,12).arrayBuffer()),a=String.fromCharCode(i[4],i[5],i[6],i[7])===`ftyp`,o=URL.createObjectURL(n),s=await new Promise(e=>{let t=document.createElement(`video`);t.preload=`metadata`,t.muted=!0,t.onloadedmetadata=()=>e({w:t.videoWidth,h:t.videoHeight,dur:Math.round(t.duration*100)/100}),t.onerror=()=>e({error:`decode`}),t.src=o,setTimeout(()=>e({error:`timeout`}),8e3)});return URL.revokeObjectURL(o),{ok:!0,layers:e.layers.length,dims:[e.width,e.height],size:n.size,ftyp:a,probe:s,ms:r}}async function KL(){let e=await CL({targetDuration:4,trackOrder:[`video`],audio:[],clips:[{id:`a`,kind:`image`,trackId:`video`,url:HL(`A`,`#1a3a5a`),start:0,duration:2,transition:{type:`Wipe left`,duration:1},transform:{opacity:1}},{id:`b`,kind:`image`,trackId:`video`,url:HL(`B`,`#5a1a3a`),start:2,duration:2,transform:{opacity:1}}]}),t=await BL(e),n=new Map;for(let t of e.layers)n.set(t.id,await hL(t));let r=document.getElementById(`__rt`);r||(r=document.createElement(`canvas`),r.id=`__rt`,r.style.cssText=`position:fixed;top:8px;left:8px;z-index:99999;border:2px solid #0ff;background:#000`,document.body.appendChild(r)),r.width=640,r.height=360,await Nh(r.getContext(`2d`),e,2,n,640,360);let i=new Uint8Array(await t.slice(0,12).arrayBuffer()),a=String.fromCharCode(i[4],i[5],i[6],i[7])===`ftyp`;return{ok:!0,transitions:e.transitions.length,transition:e.transitions[0],size:t.size,ftyp:a}}async function qL(){let e=await CL({targetDuration:3,trackOrder:[`video`],audio:[],previewH:360,clips:[{id:`bg`,kind:`image`,trackId:`video`,url:HL(`BG`,`#22303a`),start:0,duration:3,transform:{opacity:1}}],overlays:[{text:`Title Card`,subtitle:``,font:`Georgia`,size:60,color:`#ffffff`,background:`#16140F`,backgroundOpacity:90,backgroundPadding:10,backgroundRadius:5,position:`center`,start:0,end:3},{text:`A caption at the bottom`,font:`Hanken Grotesk`,size:28,color:`#ffffff`,background:`#000000`,backgroundOpacity:45,backgroundPadding:10,backgroundRadius:6,position:`bottom center`,start:0,end:3}],stickers:[{shape:`circle`,color:`#e0b84c`,x:22,y:30,scale:1,opacity:.9,rotation:0,start:0,end:3},{shape:`frame`,color:`#ffffff`,x:78,y:32,scale:1,opacity:.9,rotation:0,start:0,end:3}]}),t=await BL(e),n=new Map;for(let t of e.layers)n.set(t.id,await hL(t));let r=document.getElementById(`__rt`);r||(r=document.createElement(`canvas`),r.id=`__rt`,r.style.cssText=`position:fixed;top:8px;left:8px;z-index:99999;border:2px solid #ff0;background:#000`,document.body.appendChild(r)),r.width=640,r.height=360,await Nh(r.getContext(`2d`),e,1,n,640,360);let i=new Uint8Array(await t.slice(0,12).arrayBuffer()),a=String.fromCharCode(i[4],i[5],i[6],i[7])===`ftyp`;return{ok:!0,overlays:e.overlays.length,stickers:e.stickers.length,size:t.size,ftyp:a}}var JL,YL=o((()=>{zr(),No(),Fo(),ku(),Lh(),_L(),EL(),gf(),kL(),gp(),Cr(),JL=e=>{if(e?.aborted)throw Object.assign(Error(`Export aborted`),{name:`AbortError`})}})),XL=c({__overlayTest:()=>qL,__planTest:()=>GL,__renderTest:()=>UL,__smokeTestExport:()=>VL,__transitionTest:()=>KL,__videoTest:()=>WL,exportEditorAudioMp3:()=>RL,exportEditorTimeline:()=>FL,getExportCapabilities:()=>PL,renderRecordingCut:()=>LL,renderTimeline:()=>BL,renderWorkingCopy:()=>IL}),ZL,QL,$L=o((()=>{Ar(),Er(),Dn(),YL(),ZL=e=>()=>{throw Error(e+` is unavailable in the local preview.`)},QL={version:1};for(let e of Tr)QL[e]=[`toast`,`presenterHost`,`upgradeReasons`].includes(e)?{}:ZL(e);Object.assign(QL,{loadMediaBlob:async e=>{let t=typeof e==`string`?e:e?.url,n=t?await fetch(t).catch(()=>null):null;return n?.ok?n.blob():{missing:!0,ref:e}},loadMediaArrayBuffer:async e=>{let t=typeof e==`string`?e:e?.url,n=t?await fetch(t).catch(()=>null):null;return n?.ok?n.arrayBuffer():{missing:!0,ref:e}},resolveDesktopMediaUrl:async e=>typeof e==`string`&&e.startsWith(`sm-media://asset/`)?e:null,isMissing:e=>!!(e&&e.missing),proxiedMediaUrl:e=>e,cachedObjectUrlIfPresent:()=>null,desktopBridge:()=>null,isDeviceMediaUrl:_n,resolveDeviceMediaUrl:cn,deviceMediaUrlFor:e=>/^[0-9a-f-]{36}$/i.test(e?.assetId||``)&&/^[0-9a-f]{64}$/.test(e?.versionId||``)?hn(e):null,loadDeviceMediaBlob:async e=>{let t=gn(e);if(!t)return null;try{return await on(t)}catch{return null}}}),Dr(QL)})),eR=c({cutRecording:()=>rR,cutWithMediaRecorder:()=>nR,rendererAvailable:()=>tR});async function tR({capabilities:e}={}){try{if(typeof VideoEncoder>`u`||typeof OffscreenCanvas>`u`)return!1;let t=await(e||(await Sr(async()=>{let{getExportCapabilities:e}=await Promise.resolve().then(()=>($L(),XL));return{getExportCapabilities:e}},void 0)).getExportCapabilities)();return t?.strategy===`webcodecs`||t?.strategy===`native`}catch{return!1}}async function nR(e,{keep:t,width:n,height:r,shortSide:i=1080,fps:a=30,signal:o,onProgress:s,documentRef:c=globalThis.document}={}){if(typeof MediaRecorder!=`function`||!c)throw Error(`This browser cannot cut recordings.`);let l=(t||[]).filter(e=>e.end>e.start);if(!l.length)throw Error(`Keep at least part of the recording.`);let u=l.reduce((e,t)=>e+t.end-t.start,0),d=iR(n||1920,r||1080,i),f=URL.createObjectURL(e),p=c.createElement(`video`),m=c.createElement(`canvas`);m.width=d.width,m.height=d.height;for(let e of[p,m])e.setAttribute(`aria-hidden`,`true`),e.style.position=`fixed`,e.style.left=`-20000px`,e.style.top=`0`,e.style.width=`1px`,e.style.height=`1px`;p.preload=`auto`,p.playsInline=!0,p.muted=!1,p.volume=1,p.src=f,c.body.append(p,m);let h=m.getContext(`2d`,{alpha:!1}),g=null,_=null,v=null,y=null,b=()=>{clearInterval(y);try{_?.getTracks().forEach(e=>e.stop())}catch{}try{g?.close()}catch{}p.pause(),p.removeAttribute(`src`);try{p.load()}catch{}p.remove(),m.remove(),URL.revokeObjectURL(f)},x=()=>{if(o?.aborted)throw Object.assign(Error(`The cut was cancelled.`),{name:`AbortError`})};try{await new Promise((e,t)=>{let n=setTimeout(()=>t(Error(`The recording did not load in time.`)),3e4);p.onloadedmetadata=()=>{clearTimeout(n),e()},p.onerror=()=>{clearTimeout(n),t(Error(`This recording could not be read.`))}}),x(),_=m.captureStream(a);let e=globalThis.AudioContext||globalThis.webkitAudioContext;if(typeof e==`function`&&typeof MediaStream==`function`)try{g=new e;let t=g.createMediaStreamDestination();g.createMediaElementSource(p).connect(t),_=new MediaStream([..._.getVideoTracks(),...t.stream.getAudioTracks()])}catch{g?.close?.(),g=null}let t=cr(`screen`,{isTypeSupported:e=>MediaRecorder.isTypeSupported?.(e),canPlayType:e=>c.createElement(`video`).canPlayType(e)});v=new MediaRecorder(_,{...t?{mimeType:t}:{},videoBitsPerSecond:lr({width:d.width,height:d.height,frameRate:a}),audioBitsPerSecond:mr.voice});let n=[];v.addEventListener(`dataavailable`,e=>{e.data?.size&&n.push(e.data)});let r=new Promise(e=>v.addEventListener(`stop`,e,{once:!0})),i=new Promise((e,t)=>v.addEventListener(`error`,()=>t(Error(`Recording the cut failed.`)),{once:!0})),f=()=>{try{h.drawImage(p,0,0,d.width,d.height)}catch{}},b=e=>new Promise((t,n)=>{let r=setTimeout(()=>n(Error(`The recording could not be positioned.`)),15e3);p.onseeked=()=>{clearTimeout(r),t()},p.currentTime=e});await b(l[0].start),f(),v.start(1e3),v.pause();let S=0;y=setInterval(f,Math.round(1e3/a));for(let e of l)x(),Math.abs(p.currentTime-e.start)>.05&&await b(e.start),f(),await g?.resume?.(),v.resume(),await p.play(),await new Promise((t,n)=>{let r=()=>{if(o?.aborted){n(Object.assign(Error(`The cut was cancelled.`),{name:`AbortError`}));return}let i=p.currentTime;if(s?.(Math.min(1,(S+Math.max(0,i-e.start))/u)),i>=e.end-1/a||p.ended){t();return}setTimeout(r,40)};Promise.race([i]).catch(n),r()}),p.pause(),v.pause(),S+=e.end-e.start;v.stop(),await Promise.race([r,i]);let C=v.mimeType||t||`video/webm`,w=await tr(new Blob(n,{type:C}),u*1e3);if(!w.size)throw Error(`Nothing was recorded from the cut.`);return s?.(1),{file:w,duration:u,width:d.width,height:d.height}}finally{b()}}async function rR(e,{keep:t,width:n,height:r,duration:i,shortSide:a=1080,fps:o=30,signal:s,onProgress:c,renderer:l,playback:u=nR,available:d=tR}={}){return await d()?{...await(l||(await Sr(async()=>{let{renderRecordingCut:e}=await Promise.resolve().then(()=>($L(),XL));return{renderRecordingCut:e}},void 0)).renderRecordingCut)(e,{keep:t,width:n,height:r,duration:i,fps:o,shortSide:a,signal:s,onProgress:c}),method:`renderer`}:{...await u(e,{keep:t,width:n,height:r,shortSide:a,fps:o,signal:s,onProgress:c}),method:`playback`}}var iR,aR=o((()=>{sr(),vr(),Cr(),iR=(e,t,n)=>{let r=Math.min(1,n/Math.max(1,Math.min(e,t)));return{width:Math.max(2,Math.round(e*r/2)*2),height:Math.max(2,Math.round(t*r/2)*2)}}}));xt(),We(),Ut(),Dn(),sr(),vr(),Cr();var oR={screen:`screen.capture`,camera:`camera.capture`,microphone:`microphone.capture`},sR=500,cR=async(e,t)=>(await Sr(async()=>{let{cutRecording:e}=await Promise.resolve().then(()=>(aR(),eR));return{cutRecording:e}},void 0)).cutRecording(e,t),lR=async()=>{if(typeof MediaRecorder!=`function`)return`none`;try{return await(await Sr(async()=>{let{rendererAvailable:e}=await Promise.resolve().then(()=>(aR(),eR));return{rendererAvailable:e}},void 0)).rendererAvailable()?`renderer`:`playback`}catch{return`playback`}};async function uR(e){if(typeof document>`u`)return{};let t=URL.createObjectURL(e),n=document.createElement(`video`);n.preload=`metadata`,n.muted=!0;try{return await new Promise((e,r)=>{let i=setTimeout(()=>r(Error(`The video did not load in time.`)),3e4);n.onloadedmetadata=()=>{clearTimeout(i),e({duration:Number.isFinite(n.duration)?n.duration:0,width:n.videoWidth,height:n.videoHeight})},n.onerror=()=>{clearTimeout(i),r(Error(`This video cannot be read here.`))},n.src=t})}finally{n.removeAttribute(`src`);try{n.load()}catch{}URL.revokeObjectURL(t)}}var dR=/^\/api\/media\/[A-Za-z0-9_-]+\/[A-Za-z0-9_-][A-Za-z0-9._-]*$/;async function fR(e,{signal:t}={}){let n=typeof location<`u`?location.origin:``,r=e.startsWith(`sm-media://asset/`),i=dR.test(e),a=n&&e.startsWith(`blob:${n}/`);if(!r&&!i&&!a)throw Error(`Cut a recording kept on this device or saved in StillMade.`);let o=await fetch(e,{signal:t,credentials:`omit`,redirect:i?`follow`:`error`,referrerPolicy:`no-referrer`}).catch(()=>null);if(!o?.ok)throw Error(`This video cannot be read here.`);let s=(o.headers.get(`content-type`)||``).split(`;`)[0].trim().toLowerCase();if(!kn.video.includes(s))throw Error(`Choose a supported video file.`);if(Number(o.headers.get(`content-length`))>2147483648)throw Error(`Videos over 2 GB cannot be cut here.`);if(!o.body?.getReader)return o.blob();let c=o.body.getReader(),l=[],u=0;try{for(;;){let{done:e,value:t}=await c.read();if(e)break;if(u+=t.byteLength,u>2147483648)throw Error(`Videos over 2 GB cannot be cut here.`);l.push(t)}}finally{await c.cancel().catch(()=>{}),c.releaseLock()}return new Blob(l,{type:s})}function pR(e,t){if(!Array.isArray(e)||!e.length||e.length>sR)throw Error(`Keep 1 to ${sR} ranges of the recording.`);let n=-1,r=[];for(let i of e){let e=Number(i?.start),a=Number(i?.end);if(!Number.isFinite(e)||!Number.isFinite(a)||e<0||e<n||a<=e)throw Error(`Keep ranges are ordered, non-overlapping {start, end} seconds.`);r.push({start:e,end:t>0?Math.min(a,t):a}),n=a}return r.filter(e=>e.end-e.start>.001)}var mR={echoCancellation:!0,noiseSuppression:!0,autoGainControl:!1},hR=1048576,gR=e=>{try{for(let t of e?.getTracks?.()||[])t.stop()}catch{}},_R=(e,t)=>{try{return e?.[t===`video`?`getVideoTracks`:`getAudioTracks`]?.()||[]}catch{return[]}},vR=e=>{try{return e?.getSettings?.()||{}}catch{return{}}},yR=e=>[`NotAllowedError`,`AbortError`].includes(e?.name);function bR(e,{bridge:t=globalThis.stillmadeDesktop?.blockDesktop,onStatus:n=()=>{},storageScope:r=`preview`,limits:i,now:a=Date.now,renderCut:o=cR,probeVideo:s=uR,probeCut:c=lR}={}){let l=null,u=null,d=!1,f=null,p=!1,m=null,h=null,g=null,_=new Set,v=e=>e&&[`audio`,`video`,`image`].includes(e.kind)&&[`assetId`,`versionId`,`url`].every(t=>typeof e[t]==`string`&&e[t])?JSON.stringify([e.kind,e.assetId,e.versionId,e.url]):``,y=e?.manifest?.permissions?.desktop||[],b=new Map((e?.manifest?.desktopTools||[]).map(e=>[e.id,new Set(e.actions||[])])),x={"tool.launch":`launch`,"tool.project.import":`project.import`,"tool.project.open":`project.open`,"tool.project.render":`project.render`,"tool.adapter.import":`adapter.import`,"tool.adapter.inspect":`adapter.inspect`,"tool.adapter.execute":`adapter.execute`,"tool.adapter.describe":`adapter.describe`,"tool.adapter.call":`adapter.call`},S=t?`desktop`:`browser`,C=!!t&&[`recordingOpen`,`recordingAppend`,`recordingClose`].every(e=>typeof t[e]==`function`),w={...S===`browser`?gr.browser:C?gr.desktop:gr.legacyDesktop,...i},T=()=>({seconds:w.seconds,bytes:Number.isFinite(w.bytes)?w.bytes:null}),E=async(e,n,r)=>{if(!C)return t.save(l,e,new Uint8Array(await n.arrayBuffer()),r);let{id:i,maxAppendBytes:a}=await t.recordingOpen(l,{kind:e,mime:r}),o=Math.min(a||8*hR,8*hR);try{for(let e=0;e<n.size;e+=o)await t.recordingAppend(l,i,new Uint8Array(await n.slice(e,e+o).arrayBuffer()))}catch(e){throw await t.recordingClose(l,i,{discard:!0}).catch(()=>{}),e}return t.recordingClose(l,i,{})},D=()=>{if(!t)throw Error(`This capability requires the StillMade desktop app.`)},O=e=>{if(d)throw Error(`Block desktop access was closed. Reopen the Block.`);if(!y.includes(e))throw Error(`Declare permissions.desktop: ${e}`)},k=async()=>(u||=(async()=>{D();let n=e.manifest,i=await t.open({id:n.id,version:n.version,digest:await ft(e),permissions:y,tools:n.desktopTools||[],name:n.name,storageScope:`${Vt()||`anonymous`}:${r}`});if(d)throw await t.close(i),Error(`Block was closed`);return l=i,m=setTimeout(()=>ie(),36e5),i})(),u),A=async(e,n={})=>{D(),O(e);let r=await k();if(d)throw Error(`Block was closed`);return t.invoke(r,e,n)},j=(e,t,r)=>{if(!(f!==e||e.ended)){e.ended={stoppedBy:t,message:r},e.endedAt=a(),clearTimeout(e.timer),clearInterval(e.cursorTimer);try{e.recorder.state!==`inactive`&&e.recorder.stop()}catch{}n({active:!0,ended:!0,kind:e.kind,stoppedBy:t,message:r})}},M=e=>{clearTimeout(e.timer),clearInterval(e.cursorTimer),gR(e.stream),gR(e.microphone);try{e.audioContext?.close?.()}catch{}},N=(e,n)=>{e.appending=e.appending.then(async()=>{e.discarded||await t.recordingAppend(l,e.sink.id,new Uint8Array(await n.arrayBuffer()))}).catch(t=>{!e.ended&&!e.discarded&&j(e,`disk`,t?.message||`The recording could not be written to disk.`)})},P=async e=>{let r=f;if(!r)throw Error(`No recording is active`);return r.finishing||=(async()=>{if(r.recorder.state!==`inactive`&&r.recorder.stop(),await r.stopped,M(r),f=null,n({active:!1}),r.sink&&await r.appending,!e)return r.sink&&(r.discarded=!0,await t.recordingClose(l,r.sink.id,{discard:!0}).catch(()=>{})),{cancelled:!0};if(r.error)throw r.sink&&(r.discarded=!0,await t.recordingClose(l,r.sink.id,{discard:!0}).catch(()=>{})),Error(r.error);if(!r.chunks.length)throw Error(`Nothing was recorded.`);let i=r.recorder.mimeType||r.mimeType||``,o=Math.max(1,(r.endedAt||a())-r.started),s=r.kind===`microphone`?`audio`:`video`,c=i.split(`;`)[0].trim(),u={duration:o/1e3,mimeType:c,...s===`video`&&r.width?{width:r.width,height:r.height}:{}},d;if(r.sink){let e=await tr(new Blob([r.chunks[0]],i?{type:i}:void 0),o);d=await t.recordingClose(l,r.sink.id,{head:new Uint8Array(await e.arrayBuffer())})}else{let e=await tr(new Blob(r.chunks,i?{type:i}:void 0),o);if(t)d=await t.save(l,r.kind,new Uint8Array(await e.arrayBuffer()),c);else{let t=_r(r.kind,c,r.started);d=ln(await rn(new File([e],t,i?{type:c}:void 0),{kind:s,metadata:u,maxBytes:w.bytes}),{name:t})}}let p=v(d);return p&&_.add(p),{asset:d,...u,bytes:r.bytes,...r.ended?{stoppedBy:r.ended.stoppedBy,message:r.ended.message}:{},cursor:r.cursor,displays:r.displays||[],coordinates:`Global screen coordinates in device-independent pixels; timestamps in milliseconds relative to recording start.`}})(),r.finishing},F=()=>{let e=f;return e?{active:!0,platform:S,kind:e.kind,elapsed:(e.endedAt||a())-e.started,bytes:e.bytes,ended:!!e.ended,...e.ended||{},limits:T()}:{active:!1,platform:S,...g?{cutting:{progress:g.progress}}:{},limits:T()}},I=async()=>{O(Object.values(oR).find(e=>y.includes(e))||`screen.capture`);let e=typeof MediaRecorder==`function`&&!!navigator?.mediaDevices?.getDisplayMedia,n=null,r=0;if(!t)try{let e=await un();n=Number.isFinite(e?.quota)?e.quota:null,r=Number(e?.bytes)||0}catch{}let i=lr({width:1920,height:1080,frameRate:30})+mr.voice,a=S===`browser`?dr({platform:`browser`,bitsPerSecond:i,quota:n,used:r}):{seconds:w.seconds,bytes:Number.isFinite(w.bytes)?w.bytes:null};return S===`browser`&&Number.isFinite(w.bytes)&&(a.bytes=Math.min(a.bytes,w.bytes)),{platform:S,streams:C,recorder:!!e&&(t?!0:nn()),cut:e?await c():`none`,budget:{seconds:Math.min(a.seconds,w.seconds),bytes:a.bytes==null?null:Math.floor(a.bytes/hR)*hR,bitsPerSecond:i},limits:T()}},ee=async(e,t)=>{let n=navigator.mediaDevices;if(e===`screen`){let e=ur({resolution:t.resolution,frameRate:t.frameRate}),r=t=>n.getDisplayMedia({video:e,audio:t}),i=t.systemAudio===!0;try{return await r(i)}catch(e){if(!i||yR(e))throw e;return r(!1)}}return e===`camera`?n.getUserMedia({video:ur({resolution:t.resolution,frameRate:t.frameRate}),audio:!1}):n.getUserMedia({video:!1,audio:mR})},te=(e,t)=>{if(!t)return{recorded:e};let n=_R(t,`audio`),r=_R(e,`audio`);if(!n.length)return{recorded:e};let i=globalThis.AudioContext||globalThis.webkitAudioContext;if(r.length&&typeof i==`function`&&typeof MediaStream==`function`){let n=new i,r=n.createMediaStreamDestination();for(let i of[e,t])n.createMediaStreamSource(i).connect(r);return{recorded:new MediaStream([..._R(e,`video`),..._R(r.stream,`audio`)]),audioContext:n}}return typeof MediaStream==`function`?{recorded:new MediaStream([..._R(e,`video`),...r.length?r:n])}:{recorded:e}},ne=async(e,n=[])=>{if(O([`screen.capture`,`camera.capture`].find(e=>y.includes(e))||`screen.capture`),f)throw Error(`Stop the recording before cutting it.`);let r=e.source;if(!v(r)||r.kind!==`video`)throw Error(`Choose the video to cut.`);if(!_.has(v(r))&&!(Array.isArray(n)?n:[]).some(e=>v(e)===v(r)))throw Error(`Cut a video this Block received or recorded in this session.`);let i=String(r.url),c,l={width:Number(r.width)||0,height:Number(r.height)||0,duration:Number(r.duration)||0};if(_n(i)){let e=gn(i),t=await an(e);if(!t)throw Error(`This recording is not on this device.`);c=await on(e),l={width:Number(t.width)||l.width,height:Number(t.height)||l.height,duration:Number(t.duration)||l.duration}}else c=await fR(i);if(d)throw Error(`Block was closed`);l.width>0&&l.height>0&&l.duration>0||(l={...l,...await s(c)});let u=pR(e.keep,l.duration);if(!u.length)throw Error(`Keep at least part of the recording.`);g={progress:0,started:a()};try{let e=await o(c,{keep:u,width:l.width,height:l.height,duration:l.duration,onProgress:e=>{let t=typeof e==`number`?e:e?.total?e.done/e.total:null;Number.isFinite(t)&&g&&(g.progress=Math.max(0,Math.min(1,t)))}});if(d)throw Error(`Block was closed`);let n=e?.file;if(!(n instanceof Blob)||!n.size)throw Error(`The cut could not be rendered here.`);let i=await s(n).catch(()=>({})),a=String(n.type||`video/mp4`).split(`;`)[0].trim(),f={duration:i.duration||e.duration||u.reduce((e,t)=>e+t.end-t.start,0),width:i.width||l.width,height:i.height||l.height,mimeType:a},p=`${String(r.name||`recording`).replace(/\.[a-z0-9]+$/i,``).slice(0,200)||`recording`}-cut.${/webm/.test(a)?`webm`:`mp4`}`,m;m=t?await E(`screen`,n,a):ln(await rn(new File([n],p,{type:a}),{kind:`video`,metadata:f,maxBytes:w.bytes}),{name:p});let h=v(m);return h&&_.add(h),{asset:m,...f,bytes:n.size,keep:u}}finally{g=null}},re=async(e,r={},{received:i}={})=>{if(e===`record.stop`)return P(!0);if(e===`record.cancel`)return P(!1);if(e===`record.status`)return F();if(e===`device.info`)return I();if(e===`session.close`)return await ie(),{closed:!0};if(p)throw Error(`A desktop request is already in progress`);p=!0;try{if(e===`record.cut`)return await ne(r,i);if(e!==`record.start`){if(e.startsWith(`tool.`)){D(),O(`native.tools`);let n=b.get(r.tool),i=x[e];if(!n||e!==`tool.status`&&!n.has(i))throw Error(`Declare the exact desktop tool action`);let a=await t.invoke(await k(),e,r);if(d)throw Error(`Block desktop access closed before the native operation completed.`);let o=v(a?.asset);return o&&_.add(o),a}if(e.startsWith(`storage.`)){if(![`storage.info`,`storage.list`,`storage.read`,`storage.write`,`storage.remove`].includes(e))throw Error(`Unknown storage operation`);if(!t)throw Error(`Device storage requires the StillMade desktop app.`);if(d)throw Error(`Block desktop access was closed. Reopen the Block.`);return t.invoke(await k(),e,r)}if(!Ue.includes(e))throw Error(`Unknown desktop operation`);if(Object.values(oR).includes(e))throw Error(`Use record.start with kind screen, camera, or microphone.`);let n=await A(e,r);if(e===`media.pick`)for(let e of n?.assets||[]){let t=v(e);t&&_.add(t)}return n}if(f)throw Error(`A recording is already active`);let o=r.kind||`screen`,s=oR[o];if(!s)throw Error(`Choose screen, camera, or microphone`);O(s);let c=o===`screen`&&r.microphone===!0;if(c&&O(`microphone.capture`),r.cursor&&(O(`cursor.track`),D(),await A(`cursor.track`)),!t){if(!navigator?.mediaDevices?.[o===`screen`?`getDisplayMedia`:`getUserMedia`]||typeof MediaRecorder!=`function`)throw Error(`This browser cannot record. Use a current desktop browser or StillMade Desktop.`);if(!nn())throw Error(`This browser cannot keep recordings on the device. Use StillMade Desktop.`)}if(t&&(o!==`screen`&&await A(s),c&&await A(`microphone.capture`)),o===`screen`||!t){if(t&&await t.authorize(await k(),s),await new Promise((e,t)=>{h={reject:t},n({awaitingStart:!0,kind:o,microphone:c,start:()=>{h=null,e()}})}),d)throw Error(`Block was closed`);t&&await A(s,{systemAudio:r.systemAudio===!0})}let u=await ee(o,r);if(d)throw gR(u),Error(`Block was closed`);let p=null;if(c){try{p=await navigator.mediaDevices.getUserMedia({video:!1,audio:mR})}catch(e){throw gR(u),Error(`The microphone is unavailable: ${e?.message||e}`)}if(d)throw gR(u),gR(p),Error(`Block was closed`)}let m=vR(_R(u,`video`)[0]),g=Number(m.width)||0,y=Number(m.height)||0,S=cr(o,{isTypeSupported:e=>MediaRecorder.isTypeSupported?.(e),canPlayType:e=>typeof document<`u`?document.createElement(`video`).canPlayType(e):`maybe`}),E={...S?{mimeType:S}:{},...o===`microphone`?{}:{videoBitsPerSecond:lr({width:g,height:y,frameRate:m.frameRate})},audioBitsPerSecond:r.systemAudio===!0?mr.system:mr.voice},F,I,re;try{({recorded:F,audioContext:I}=te(u,p)),re=new MediaRecorder(F,E)}catch(e){gR(u),gR(p);try{I?.close?.()}catch{}throw e}let ie={kind:o,stream:u,microphone:p,audioContext:I,recorder:re,mimeType:S,width:g,height:y,chunks:[],bytes:0,cursor:[],started:a(),error:null,ended:null,endedAt:null,sink:null,appending:Promise.resolve(),discarded:!1};if(f=ie,C){try{ie.sink=await t.recordingOpen(l,{kind:o,mime:(re.mimeType||S||``).split(`;`)[0].trim()})}catch(e){throw M(ie),f=null,e}if(d)throw M(ie),f=null,await t.recordingClose(l,ie.sink.id,{discard:!0}).catch(()=>{}),Error(`Block was closed`)}ie.stopped=new Promise(e=>re.addEventListener(`stop`,e,{once:!0})),re.addEventListener(`dataavailable`,e=>{let n=e.data?.size||0;if(n&&f===ie){if(ie.bytes+n>w.bytes){j(ie,`size`,`This recording reached the ${Math.round(w.bytes/hR)} MB that fit here and was saved up to that point.${t?``:` StillMade Desktop records longer.`}`);return}ie.bytes+=n,ie.sink&&ie.chunks.length?N(ie,e.data):ie.chunks.push(e.data)}}),re.addEventListener(`error`,()=>{ie.error=`Recording failed`,P(!1).catch(()=>{})});for(let e of[..._R(u,`video`),..._R(u,`audio`)])e.addEventListener(`ended`,()=>{f===ie&&!ie.ended&&j(ie,`sharing`,`Sharing ended. The recording was saved up to that point.`)});try{re.start(1e3)}catch(e){throw M(ie),f=null,e}if(r.cursor){let e=!1;ie.cursorTimer=setInterval(async()=>{if(!(e||f!==ie||ie.ended||ie.cursor.length>=18e3)){e=!0;try{let e=await A(`cursor.track`);f===ie&&(ie.displays=e.displays,ie.cursor.push({x:e.x,y:e.y,time:e.time-ie.started}))}catch(e){ie.error=e.message,P(!1).catch(()=>{})}finally{e=!1}}},100)}return ie.ended||(ie.timer=setTimeout(()=>j(ie,`time`,`This recording reached the ${Math.round(w.seconds/60)} minute limit and was saved up to that point.`),w.seconds*1e3),n({active:!0,kind:o})),{recording:!0,kind:o,cursor:!!r.cursor,microphone:!!p,mimeType:S||null,width:g,height:y,limits:T()}}catch(e){throw f||n({active:!1,error:e.message}),e}finally{p=!1}},ie=async()=>{d||(d=!0,ae?.(),h?.reject(Error(`Recording cancelled`)),h=null,clearTimeout(m),f&&(gR(f.stream),gR(f.microphone)),f&&await P(!1).catch(()=>{}),l&&await t.close(l).catch(()=>{}),n({active:!1,closed:!0}))},ae=t?.onRevoked?.(e=>{l===e&&ie().catch(()=>{})});return{call:re,close:ie,authorizesMedia:e=>_.has(v(e)),platform:S}}var xR=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,78,5,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,199,7,137,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,55,9,266,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,233,0,3,0,8,1,6,0,475,6,110,6,6,9,4759,9,787719,239],SR=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,7,25,39,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,5,57,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,24,43,261,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,33,24,3,24,45,74,6,0,67,12,65,1,2,0,15,4,10,7381,42,31,98,114,8702,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,208,30,2,2,2,1,2,6,3,4,10,1,225,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4381,3,5773,3,7472,16,621,2467,541,1507,4938,6,8489],CR=`‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࢗ-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-᫝᫠-᫫ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・`,wR=`ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-࢏ࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚ౜ౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽ೜-ೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲊᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-Ƛ꟱-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ`,TR={3:`abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile`,5:`class enum extends super const export import`,6:`enum`,strict:`implements interface let package private protected public static yield`,strictBind:`eval arguments`},ER=`break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this`,DR={5:ER,"5module":ER+` export import`,6:ER+` const class extends export import super`},OR=/^in(stanceof)?$/,kR=RegExp(`[`+wR+`]`),AR=RegExp(`[`+wR+CR+`]`);function jR(e,t){for(var n=65536,r=0;r<t.length;r+=2){if(n+=t[r],n>e)return!1;if(n+=t[r+1],n>=e)return!0}return!1}function MR(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&kR.test(String.fromCharCode(e)):t!==!1&&jR(e,SR)}function NR(e,t){return e<48?e===36:e<58?!0:e<65?!1:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&AR.test(String.fromCharCode(e)):t===!1?!1:jR(e,SR)||jR(e,xR)}var PR=function(e,t){t===void 0&&(t={}),this.label=e,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop||null,this.updateContext=null};function FR(e,t){return new PR(e,{beforeExpr:!0,binop:t})}var IR={beforeExpr:!0},LR={startsExpr:!0},RR={};function zR(e,t){return t===void 0&&(t={}),t.keyword=e,RR[e]=new PR(e,t)}var Z={num:new PR(`num`,LR),regexp:new PR(`regexp`,LR),string:new PR(`string`,LR),name:new PR(`name`,LR),privateId:new PR(`privateId`,LR),eof:new PR(`eof`),bracketL:new PR(`[`,{beforeExpr:!0,startsExpr:!0}),bracketR:new PR(`]`),braceL:new PR(`{`,{beforeExpr:!0,startsExpr:!0}),braceR:new PR(`}`),parenL:new PR(`(`,{beforeExpr:!0,startsExpr:!0}),parenR:new PR(`)`),comma:new PR(`,`,IR),semi:new PR(`;`,IR),colon:new PR(`:`,IR),dot:new PR(`.`),question:new PR(`?`,IR),questionDot:new PR(`?.`),arrow:new PR(`=>`,IR),template:new PR(`template`),invalidTemplate:new PR(`invalidTemplate`),ellipsis:new PR(`...`,IR),backQuote:new PR("`",LR),dollarBraceL:new PR("${",{beforeExpr:!0,startsExpr:!0}),eq:new PR(`=`,{beforeExpr:!0,isAssign:!0}),assign:new PR(`_=`,{beforeExpr:!0,isAssign:!0}),incDec:new PR(`++/--`,{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new PR(`!/~`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:FR(`||`,1),logicalAND:FR(`&&`,2),bitwiseOR:FR(`|`,3),bitwiseXOR:FR(`^`,4),bitwiseAND:FR(`&`,5),equality:FR(`==/!=/===/!==`,6),relational:FR(`</>/<=/>=`,7),bitShift:FR(`<</>>/>>>`,8),plusMin:new PR(`+/-`,{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:FR(`%`,10),star:FR(`*`,10),slash:FR(`/`,10),starstar:new PR(`**`,{beforeExpr:!0}),coalesce:FR(`??`,1),_break:zR(`break`),_case:zR(`case`,IR),_catch:zR(`catch`),_continue:zR(`continue`),_debugger:zR(`debugger`),_default:zR(`default`,IR),_do:zR(`do`,{isLoop:!0,beforeExpr:!0}),_else:zR(`else`,IR),_finally:zR(`finally`),_for:zR(`for`,{isLoop:!0}),_function:zR(`function`,LR),_if:zR(`if`),_return:zR(`return`,IR),_switch:zR(`switch`),_throw:zR(`throw`,IR),_try:zR(`try`),_var:zR(`var`),_const:zR(`const`),_while:zR(`while`,{isLoop:!0}),_with:zR(`with`),_new:zR(`new`,{beforeExpr:!0,startsExpr:!0}),_this:zR(`this`,LR),_super:zR(`super`,LR),_class:zR(`class`,LR),_extends:zR(`extends`,IR),_export:zR(`export`),_import:zR(`import`,LR),_null:zR(`null`,LR),_true:zR(`true`,LR),_false:zR(`false`,LR),_in:zR(`in`,{beforeExpr:!0,binop:7}),_instanceof:zR(`instanceof`,{beforeExpr:!0,binop:7}),_typeof:zR(`typeof`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:zR(`void`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:zR(`delete`,{beforeExpr:!0,prefix:!0,startsExpr:!0})},BR=/\r\n?|\n|\u2028|\u2029/,VR=new RegExp(BR.source,`g`);function HR(e){return e===10||e===13||e===8232||e===8233}function UR(e,t,n){n===void 0&&(n=e.length);for(var r=t;r<n;r++){var i=e.charCodeAt(r);if(HR(i))return r<n-1&&i===13&&e.charCodeAt(r+1)===10?r+2:r+1}return-1}var WR=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,GR=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,KR=Object.prototype,qR=KR.hasOwnProperty,JR=KR.toString,YR=Object.hasOwn||(function(e,t){return qR.call(e,t)}),XR=Array.isArray||(function(e){return JR.call(e)===`[object Array]`}),ZR=Object.create(null);function QR(e){return ZR[e]||(ZR[e]=RegExp(`^(?:`+e.replace(/ /g,`|`)+`)$`))}function $R(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}var ez=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,tz=function(e,t){this.line=e,this.column=t};tz.prototype.offset=function(e){return new tz(this.line,this.column+e)};var nz=function(e,t,n){this.start=t,this.end=n,e.sourceFile!==null&&(this.source=e.sourceFile)};function rz(e,t){for(var n=1,r=0;;){var i=UR(e,r,t);if(i<0)return new tz(n,t-r);++n,r=i}}var iz={ecmaVersion:null,sourceType:`script`,strict:!1,onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,startLocation:null,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},az=!1;function oz(e){var t={};for(var n in iz)t[n]=e&&YR(e,n)?e[n]:iz[n];if(t.ecmaVersion===`latest`?t.ecmaVersion=1e8:t.ecmaVersion==null?(!az&&typeof console==`object`&&console.warn&&(az=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
1170
1170
  Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),t.allowReserved??=t.ecmaVersion<5,(!e||e.allowHashBang==null)&&(t.allowHashBang=t.ecmaVersion>=14),XR(t.onToken)){var r=t.onToken;t.onToken=function(e){return r.push(e)}}if(XR(t.onComment)&&(t.onComment=sz(t,t.onComment)),t.sourceType===`commonjs`&&t.allowAwaitOutsideFunction)throw Error(`Cannot use allowAwaitOutsideFunction with sourceType: commonjs`);return t}function sz(e,t){return function(n,r,i,a,o,s){var c={type:n?`Block`:`Line`,value:r,start:i,end:a};e.locations&&(c.loc=new nz(this,o,s)),e.ranges&&(c.range=[i,a]),t.push(c)}}var cz=1,lz=2,uz=4,dz=8,fz=16,pz=32,mz=64,hz=128,gz=256,_z=512,vz=1024,yz=cz|lz|gz;function bz(e,t){return lz|(e?uz:0)|(t?dz:0)}var xz=0,Sz=1,Cz=2,wz=3,Tz=4,Ez=5,Dz=function(e,t,n){this.options=e=oz(e),this.sourceFile=e.sourceFile,this.keywords=QR(DR[e.ecmaVersion>=6?6:e.sourceType===`module`?`5module`:5]);var r=``;e.allowReserved!==!0&&(r=TR[e.ecmaVersion>=6?6:e.ecmaVersion===5?5:3],e.sourceType===`module`&&(r+=` await`)),this.reservedWords=QR(r);var i=(r?r+` `:``)+TR.strict;this.reservedWordsStrict=QR(i),this.reservedWordsStrictBind=QR(i+` `+TR.strictBind),this.input=String(t),this.containsEsc=!1,this.pos=n||0,this.curLine=1,e.startLocation?(this.lineStart=this.pos-e.startLocation.column,this.curLine=e.startLocation.line):n?(this.lineStart=this.input.lastIndexOf(`
1171
1171
  `,n-1)+1,this.options.locations&&(this.curLine=this.input.slice(0,this.lineStart).split(BR).length)):this.lineStart=0,this.type=Z.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=e.sourceType===`module`,this.strict=this.inModule||e.strict===!0||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&e.allowHashBang&&this.input.slice(0,2)===`#!`&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(this.options.sourceType===`commonjs`?lz:cz),this.regexpState=null,this.privateNameStack=[]},Oz={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowReturn:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},allowUsing:{configurable:!0},inClassStaticBlock:{configurable:!0}};Dz.prototype.parse=function(){var e=this,t=this.options.program||this.startNode();return this.nextToken(),this.catchStackOverflow(function(){return e.parseTopLevel(t)})},Oz.inFunction.get=function(){return(this.currentVarScope().flags&lz)>0},Oz.inGenerator.get=function(){return(this.currentVarScope().flags&dz)>0},Oz.inAsync.get=function(){return(this.currentVarScope().flags&uz)>0},Oz.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(t&(gz|_z))return!1;if(t&lz)return(t&uz)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},Oz.allowReturn.get=function(){return!!(this.inFunction||this.options.allowReturnOutsideFunction&&this.currentVarScope().flags&cz)},Oz.allowSuper.get=function(){return(this.currentThisScope().flags&mz)>0||this.options.allowSuperOutsideMethod},Oz.allowDirectSuper.get=function(){return(this.currentThisScope().flags&hz)>0},Oz.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},Oz.allowNewDotTarget.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(t&(gz|_z)||t&lz&&!(t&fz))return!0}return!1},Oz.allowUsing.get=function(){var e=this.currentScope().flags;return!(e&vz||!this.inModule&&e&cz)},Oz.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&gz)>0},Dz.extend=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];for(var n=this,r=0;r<e.length;r++)n=e[r](n);return n},Dz.parse=function(e,t){return new this(t,e).parse()},Dz.parseExpressionAt=function(e,t,n){var r=new this(n,e,t);return r.nextToken(),r.parseExpression()},Dz.tokenizer=function(e,t){return new this(t,e)},Object.defineProperties(Dz.prototype,Oz);var kz=Dz.prototype,Az=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;kz.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){GR.lastIndex=e,e+=GR.exec(this.input)[0].length;var t=Az.exec(this.input.slice(e));if(!t)return!1;if((t[1]||t[2])===`use strict`){GR.lastIndex=e+t[0].length;var n=GR.exec(this.input),r=n.index+n[0].length,i=this.input.charAt(r);return i===`;`||i===`}`||BR.test(n[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(i)||i===`!`&&this.input.charAt(r+1)===`=`)}e+=t[0].length,GR.lastIndex=e,e+=GR.exec(this.input)[0].length,this.input[e]===`;`&&e++}},kz.eat=function(e){return this.type===e&&(this.next(),!0)},kz.isContextual=function(e){return this.type===Z.name&&this.value===e&&!this.containsEsc},kz.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1},kz.catchStackOverflow=function(e){try{return e()}catch(e){if(e instanceof Error&&(/\bstack\b.*\b(exceeded|overflow)\b/i.test(e.message)||/\btoo much recursion\b/i.test(e.message)))this.raise(this.start,`Not enough stack space to parse input`);else throw e}},kz.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},kz.canInsertSemicolon=function(){return this.type===Z.eof||this.type===Z.braceR||BR.test(this.input.slice(this.lastTokEnd,this.start))},kz.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},kz.semicolon=function(){!this.eat(Z.semi)&&!this.insertSemicolon()&&this.unexpected()},kz.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},kz.expect=function(e){this.eat(e)||this.unexpected()},kz.unexpected=function(e){this.raise(e??this.start,`Unexpected token`)};var jz=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};kz.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,`Comma is not permitted after the rest element`);var n=t?e.parenthesizedAssign:e.parenthesizedBind;n>-1&&this.raiseRecoverable(n,t?`Assigning to rvalue`:`Parenthesized pattern`)}},kz.checkExpressionErrors=function(e,t){if(!e)return!1;var n=e.shorthandAssign,r=e.doubleProto;if(!t)return n>=0||r>=0;n>=0&&this.raise(n,`Shorthand property assignments are valid only in destructuring patterns`),r>=0&&this.raiseRecoverable(r,`Redefinition of __proto__ property`)},kz.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,`Yield expression cannot be a default value`),this.awaitPos&&this.raise(this.awaitPos,`Await expression cannot be a default value`)},kz.isSimpleAssignTarget=function(e){return e.type===`ParenthesizedExpression`?this.isSimpleAssignTarget(e.expression):e.type===`Identifier`||e.type===`MemberExpression`};var Mz=Dz.prototype;Mz.parseTopLevel=function(e){var t=Object.create(null);for(e.body||=[];this.type!==Z.eof;){var n=this.parseStatement(null,!0,t);e.body.push(n)}if(this.inModule)for(var r=0,i=Object.keys(this.undefinedExports);r<i.length;r+=1){var a=i[r];this.raiseRecoverable(this.undefinedExports[a].start,`Export '`+a+`' is not defined`)}return this.adaptDirectivePrologue(e.body),this.next(),e.sourceType=this.options.sourceType===`commonjs`?`script`:this.options.sourceType,this.finishNode(e,`Program`)};var Nz={kind:`loop`},Pz={kind:`switch`};Mz.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual(`let`))return!1;GR.lastIndex=this.pos;var t=GR.exec(this.input),n=this.pos+t[0].length,r=this.fullCharCodeAt(n);if(r===91||r===92)return!0;if(e)return!1;if(r===123)return!0;if(MR(r)){var i=n;do n+=r<=65535?1:2;while(NR(r=this.fullCharCodeAt(n)));if(r===92)return!0;var a=this.input.slice(i,n);if(!OR.test(a))return!0}return!1},Mz.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual(`async`))return!1;GR.lastIndex=this.pos;var e=GR.exec(this.input),t=this.pos+e[0].length,n;return!BR.test(this.input.slice(this.pos,t))&&this.input.slice(t,t+8)===`function`&&(t+8===this.input.length||!(NR(n=this.fullCharCodeAt(t+8))||n===92))},Mz.isUsingKeyword=function(e,t){if(this.options.ecmaVersion<17||!this.isContextual(e?`await`:`using`))return!1;GR.lastIndex=this.pos;var n=GR.exec(this.input),r=this.pos+n[0].length;if(BR.test(this.input.slice(this.pos,r)))return!1;if(e){var i=r+5,a;if(this.input.slice(r,i)!==`using`||i===this.input.length||NR(a=this.fullCharCodeAt(i))||a===92)return!1;GR.lastIndex=i;var o=GR.exec(this.input);if(r=i+o[0].length,o&&BR.test(this.input.slice(i,r)))return!1}var s=this.fullCharCodeAt(r);if(!MR(s)&&s!==92)return!1;var c=r;do r+=s<=65535?1:2;while(NR(s=this.fullCharCodeAt(r)));if(s===92)return!0;var l=this.input.slice(c,r);if(OR.test(l))return!1;if(t&&!e&&l===`of`){GR.lastIndex=r;var u=GR.exec(this.input);if(r+=u[0].length,this.input.charCodeAt(r)!==61||(s=this.input.charCodeAt(r+1))===61||s===62)return!1}return!0},Mz.isAwaitUsing=function(e){return this.isUsingKeyword(!0,e)},Mz.isUsing=function(e){return this.isUsingKeyword(!1,e)},Mz.parseStatement=function(e,t,n){var r=this.type,i=this.startNode(),a;switch(this.isLet(e)&&(r=Z._var,a=`let`),r){case Z._break:case Z._continue:return this.parseBreakContinueStatement(i,r.keyword);case Z._debugger:return this.parseDebuggerStatement(i);case Z._do:return this.parseDoStatement(i);case Z._for:return this.parseForStatement(i);case Z._function:return e&&(this.strict||e!==`if`&&e!==`label`)&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(i,!1,!e);case Z._class:return e&&this.unexpected(),this.parseClass(i,!0);case Z._if:return this.parseIfStatement(i);case Z._return:return this.parseReturnStatement(i);case Z._switch:return this.parseSwitchStatement(i);case Z._throw:return this.parseThrowStatement(i);case Z._try:return this.parseTryStatement(i);case Z._const:case Z._var:return a||=this.value,e&&a!==`var`&&this.unexpected(),this.parseVarStatement(i,a);case Z._while:return this.parseWhileStatement(i);case Z._with:return this.parseWithStatement(i);case Z.braceL:return this.parseBlock(!0,i);case Z.semi:return this.parseEmptyStatement(i);case Z._export:case Z._import:if(this.options.ecmaVersion>10&&r===Z._import){GR.lastIndex=this.pos;var o=GR.exec(this.input),s=this.pos+o[0].length,c=this.input.charCodeAt(s);if(c===40||c===46)return this.parseExpressionStatement(i,this.parseExpression())}return this.options.allowImportExportEverywhere||(t||this.raise(this.start,`'import' and 'export' may only appear at the top level`),this.inModule||this.raise(this.start,`'import' and 'export' may appear only with 'sourceType: module'`)),r===Z._import?this.parseImport(i):this.parseExport(i,n);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(i,!0,!e);var l=this.isAwaitUsing(!1)?`await using`:this.isUsing(!1)?`using`:null;if(l)return this.allowUsing||this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script` or in the bare case statement"),e&&this.raise(this.start,`Using declaration is not allowed in single-statement positions`),l===`await using`&&(this.canAwait||this.raise(this.start,`Await using cannot appear outside of async function`),this.next()),this.next(),this.parseVar(i,!1,l),this.semicolon(),this.finishNode(i,`VariableDeclaration`);var u=this.value,d=this.parseExpression();return r===Z.name&&d.type===`Identifier`&&this.eat(Z.colon)?this.parseLabeledStatement(i,u,d,e):this.parseExpressionStatement(i,d)}},Mz.parseBreakContinueStatement=function(e,t){var n=t===`break`;this.next(),this.eat(Z.semi)||this.insertSemicolon()?e.label=null:this.type===Z.name?(e.label=this.parseIdent(),this.semicolon()):this.unexpected();for(var r=0;r<this.labels.length;++r){var i=this.labels[r];if((e.label==null||i.name===e.label.name)&&(i.kind!=null&&(n||i.kind===`loop`)||e.label&&n))break}return r===this.labels.length&&this.raise(e.start,`Unsyntactic `+t),this.finishNode(e,n?`BreakStatement`:`ContinueStatement`)},Mz.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,`DebuggerStatement`)},Mz.parseDoStatement=function(e){return this.next(),this.labels.push(Nz),e.body=this.parseStatement(`do`),this.labels.pop(),this.expect(Z._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(Z.semi):this.semicolon(),this.finishNode(e,`DoWhileStatement`)},Mz.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual(`await`)?this.lastTokStart:-1;if(this.labels.push(Nz),this.enterScope(0),this.expect(Z.parenL),this.type===Z.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var n=this.isLet();if(this.type===Z._var||this.type===Z._const||n){var r=this.startNode(),i=n?`let`:this.value;return this.next(),this.parseVar(r,!0,i),this.finishNode(r,`VariableDeclaration`),this.parseForAfterInit(e,r,t)}var a=this.isContextual(`let`),o=!1,s=this.isUsing(!0)?`using`:this.isAwaitUsing(!0)?`await using`:null;if(s){var c=this.startNode();return this.next(),s===`await using`&&(this.canAwait||this.raise(this.start,`Await using cannot appear outside of async function`),this.next()),this.parseVar(c,!0,s),this.finishNode(c,`VariableDeclaration`),this.parseForAfterInit(e,c,t)}var l=this.containsEsc,u=new jz,d=this.start,f=t>-1?this.parseExprSubscripts(u,`await`):this.parseExpression(!0,u);return this.type===Z._in||(o=this.options.ecmaVersion>=6&&this.isContextual(`of`))?(t>-1?(this.type===Z._in&&this.unexpected(t),e.await=!0):o&&this.options.ecmaVersion>=8&&(f.start===d&&!l&&f.type===`Identifier`&&f.name===`async`?this.unexpected():this.options.ecmaVersion>=9&&(e.await=!1)),a&&o&&this.raise(f.start,`The left-hand side of a for-of loop may not start with 'let'.`),this.toAssignable(f,!1,u),this.checkLValPattern(f),this.parseForIn(e,f)):(this.checkExpressionErrors(u,!0),t>-1&&this.unexpected(t),this.parseFor(e,f))},Mz.parseForAfterInit=function(e,t,n){return(this.type===Z._in||this.options.ecmaVersion>=6&&this.isContextual(`of`))&&t.declarations.length===1?(this.type===Z._in?((t.kind===`using`||t.kind===`await using`)&&!t.declarations[0].init&&this.raise(this.start,`Using declaration is not allowed in for-in loops`),this.options.ecmaVersion>=9&&n>-1&&this.unexpected(n)):this.options.ecmaVersion>=9&&(e.await=n>-1),this.parseForIn(e,t)):(n>-1&&this.unexpected(n),this.parseFor(e,t))},Mz.parseFunctionStatement=function(e,t,n){return this.next(),this.parseFunction(e,Iz|(n?0:Lz),!1,t)},Mz.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement(`if`),e.alternate=this.eat(Z._else)?this.parseStatement(`if`):null,this.finishNode(e,`IfStatement`)},Mz.parseReturnStatement=function(e){return this.allowReturn||this.raise(this.start,`'return' outside of function`),this.next(),this.eat(Z.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,`ReturnStatement`)},Mz.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(Z.braceL),this.labels.push(Pz),this.enterScope(vz);for(var t,n=!1;this.type!==Z.braceR;)if(this.type===Z._case||this.type===Z._default){var r=this.type===Z._case;t&&this.finishNode(t,`SwitchCase`),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),r?t.test=this.parseExpression():(n&&this.raiseRecoverable(this.lastTokStart,`Multiple default clauses`),n=!0,t.test=null),this.expect(Z.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(null));return this.exitScope(),t&&this.finishNode(t,`SwitchCase`),this.next(),this.labels.pop(),this.finishNode(e,`SwitchStatement`)},Mz.parseThrowStatement=function(e){return this.next(),BR.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,`Illegal newline after throw`),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,`ThrowStatement`)};var Fz=[];Mz.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t=e.type===`Identifier`;return this.enterScope(t?pz:0),this.checkLValPattern(e,t?Tz:Cz),this.expect(Z.parenR),e},Mz.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===Z._catch){var t=this.startNode();this.next(),this.eat(Z.parenL)?t.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0)),t.body=this.parseBlock(!1),this.exitScope(),e.handler=this.finishNode(t,`CatchClause`)}return e.finalizer=this.eat(Z._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,`Missing catch or finally clause`),this.finishNode(e,`TryStatement`)},Mz.parseVarStatement=function(e,t,n){return this.next(),this.parseVar(e,!1,t,n),this.semicolon(),this.finishNode(e,`VariableDeclaration`)},Mz.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(Nz),e.body=this.parseStatement(`while`),this.labels.pop(),this.finishNode(e,`WhileStatement`)},Mz.parseWithStatement=function(e){return this.strict&&this.raise(this.start,`'with' in strict mode`),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement(`with`),this.finishNode(e,`WithStatement`)},Mz.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,`EmptyStatement`)},Mz.parseLabeledStatement=function(e,t,n,r){for(var i=0,a=this.labels;i<a.length;i+=1)a[i].name===t&&this.raise(n.start,`Label '`+t+`' is already declared`);for(var o=this.type.isLoop?`loop`:this.type===Z._switch?`switch`:null,s=this.labels.length-1;s>=0;s--){var c=this.labels[s];if(c.statementStart===e.start)c.statementStart=this.start,c.kind=o;else break}return this.labels.push({name:t,kind:o,statementStart:this.start}),e.body=this.parseStatement(r?r.indexOf(`label`)===-1?r+`label`:r:`label`),this.labels.pop(),e.label=n,this.finishNode(e,`LabeledStatement`)},Mz.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,`ExpressionStatement`)},Mz.parseBlock=function(e,t,n){for(e===void 0&&(e=!0),t===void 0&&(t=this.startNode()),t.body=[],this.expect(Z.braceL),e&&this.enterScope(0);this.type!==Z.braceR;){var r=this.parseStatement(null);t.body.push(r)}return n&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,`BlockStatement`)},Mz.parseFor=function(e,t){return e.init=t,this.expect(Z.semi),e.test=this.type===Z.semi?null:this.parseExpression(),this.expect(Z.semi),e.update=this.type===Z.parenR?null:this.parseExpression(),this.expect(Z.parenR),e.body=this.parseStatement(`for`),this.exitScope(),this.labels.pop(),this.finishNode(e,`ForStatement`)},Mz.parseForIn=function(e,t){var n=this.type===Z._in;return this.next(),t.type===`VariableDeclaration`&&t.declarations[0].init!=null&&(!n||this.options.ecmaVersion<8||this.strict||t.kind!==`var`||t.declarations[0].id.type!==`Identifier`)&&this.raise(t.start,(n?`for-in`:`for-of`)+` loop variable declaration may not have an initializer`),e.left=t,e.right=n?this.parseExpression():this.parseMaybeAssign(),this.expect(Z.parenR),e.body=this.parseStatement(`for`),this.exitScope(),this.labels.pop(),this.finishNode(e,n?`ForInStatement`:`ForOfStatement`)},Mz.parseVar=function(e,t,n,r){for(e.declarations=[],e.kind=n;;){var i=this.startNode();if(this.parseVarId(i,n),this.eat(Z.eq)?i.init=this.parseMaybeAssign(t):!r&&n===`const`&&!(this.type===Z._in||this.options.ecmaVersion>=6&&this.isContextual(`of`))?this.unexpected():!r&&(n===`using`||n===`await using`)&&this.options.ecmaVersion>=17&&this.type!==Z._in&&!this.isContextual(`of`)?this.raise(this.lastTokEnd,`Missing initializer in `+n+` declaration`):!r&&i.id.type!==`Identifier`&&(!t||this.type!==Z._in&&!this.isContextual(`of`))?this.raise(this.lastTokEnd,`Complex binding patterns require an initialization value`):i.init=null,e.declarations.push(this.finishNode(i,`VariableDeclarator`)),!this.eat(Z.comma))break}return e},Mz.parseVarId=function(e,t){e.id=t===`using`||t===`await using`?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(e.id,t===`var`?Sz:Cz,!1)};var Iz=1,Lz=2,Rz=4;Mz.parseFunction=function(e,t,n,r,i){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!r)&&(this.type===Z.star&&t&Lz&&this.unexpected(),e.generator=this.eat(Z.star)),this.options.ecmaVersion>=8&&(e.async=!!r),t&Iz&&(e.id=t&Rz&&this.type!==Z.name?null:this.parseIdent(),e.id&&!(t&Lz)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?Sz:Cz:wz));var a=this.yieldPos,o=this.awaitPos,s=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(bz(e.async,e.generator)),t&Iz||(e.id=this.type===Z.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,n,!1,i),this.yieldPos=a,this.awaitPos=o,this.awaitIdentPos=s,this.finishNode(e,t&Iz?`FunctionDeclaration`:`FunctionExpression`)},Mz.parseFunctionParams=function(e){this.expect(Z.parenL),e.params=this.parseBindingList(Z.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},Mz.parseClass=function(e,t){this.next();var n=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var r=this.enterClassBody(),i=this.startNode(),a=!1;for(i.body=[],this.expect(Z.braceL);this.type!==Z.braceR;){var o=this.parseClassElement(e.superClass!==null);o&&(i.body.push(o),o.type===`MethodDefinition`&&o.kind===`constructor`?(a&&this.raiseRecoverable(o.start,`Duplicate constructor in the same class`),a=!0):o.key&&o.key.type===`PrivateIdentifier`&&zz(r,o)&&this.raiseRecoverable(o.key.start,`Identifier '#`+o.key.name+`' has already been declared`))}return this.strict=n,this.next(),e.body=this.finishNode(i,`ClassBody`),this.exitClassBody(),this.finishNode(e,t?`ClassDeclaration`:`ClassExpression`)},Mz.parseClassElement=function(e){if(this.eat(Z.semi))return null;var t=this.options.ecmaVersion,n=this.startNode(),r=``,i=!1,a=!1,o=`method`,s=!1;if(this.eatContextual(`static`)){if(t>=13&&this.eat(Z.braceL))return this.parseClassStaticBlock(n),n;this.isClassElementNameStart()||this.type===Z.star?s=!0:r=`static`}if(n.static=s,!r&&t>=8&&this.eatContextual(`async`)&&((this.isClassElementNameStart()||this.type===Z.star)&&!this.canInsertSemicolon()?a=!0:r=`async`),!r&&(t>=9||!a)&&this.eat(Z.star)&&(i=!0),!r&&!a&&!i){var c=this.value;(this.eatContextual(`get`)||this.eatContextual(`set`))&&(this.isClassElementNameStart()?o=c:r=c)}if(r?(n.computed=!1,n.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),n.key.name=r,this.finishNode(n.key,`Identifier`)):this.parseClassElementName(n),t<13||this.type===Z.parenL||o!==`method`||i||a){var l=!n.static&&Bz(n,`constructor`),u=l&&e;l&&o!==`method`&&this.raise(n.key.start,`Constructor can't have get/set modifier`),n.kind=l?`constructor`:o,this.parseClassMethod(n,i,a,u)}else this.parseClassField(n);return n},Mz.isClassElementNameStart=function(){return this.type===Z.name||this.type===Z.privateId||this.type===Z.num||this.type===Z.string||this.type===Z.bracketL||this.type.keyword},Mz.parseClassElementName=function(e){this.type===Z.privateId?(this.value===`constructor`&&this.raise(this.start,`Classes can't have an element named '#constructor'`),e.computed=!1,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)},Mz.parseClassMethod=function(e,t,n,r){var i=e.key;e.kind===`constructor`?(t&&this.raise(i.start,`Constructor can't be a generator`),n&&this.raise(i.start,`Constructor can't be an async method`)):e.static&&Bz(e,`prototype`)&&this.raise(i.start,`Classes may not have a static property named prototype`);var a=e.value=this.parseMethod(t,n,r);return e.kind===`get`&&a.params.length!==0&&this.raiseRecoverable(a.start,`getter should have no params`),e.kind===`set`&&a.params.length!==1&&this.raiseRecoverable(a.start,`setter should have exactly one param`),e.kind===`set`&&a.params[0].type===`RestElement`&&this.raiseRecoverable(a.params[0].start,`Setter cannot use rest params`),this.finishNode(e,`MethodDefinition`)},Mz.parseClassField=function(e){return Bz(e,`constructor`)?this.raise(e.key.start,`Classes can't have a field named 'constructor'`):e.static&&Bz(e,`prototype`)&&this.raise(e.key.start,`Classes can't have a static field named 'prototype'`),this.eat(Z.eq)?(this.enterScope(_z|mz),e.value=this.parseMaybeAssign(),this.exitScope()):e.value=null,this.semicolon(),this.finishNode(e,`PropertyDefinition`)},Mz.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(gz|mz);this.type!==Z.braceR;){var n=this.parseStatement(null);e.body.push(n)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,`StaticBlock`)},Mz.parseClassId=function(e,t){this.type===Z.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,Cz,!1)):(t===!0&&this.unexpected(),e.id=null)},Mz.parseClassSuper=function(e){e.superClass=this.eat(Z._extends)?this.parseExprSubscripts(null,!1):null},Mz.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared},Mz.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,n=e.used;if(this.options.checkPrivateFields)for(var r=this.privateNameStack.length,i=r===0?null:this.privateNameStack[r-1],a=0;a<n.length;++a){var o=n[a];YR(t,o.name)||(i?i.used.push(o):this.raiseRecoverable(o.start,`Private field '#`+o.name+`' must be declared in an enclosing class`))}};function zz(e,t){var n=t.key.name,r=e[n],i=`true`;return t.type===`MethodDefinition`&&(t.kind===`get`||t.kind===`set`)&&(i=(t.static?`s`:`i`)+t.kind),r===`iget`&&i===`iset`||r===`iset`&&i===`iget`||r===`sget`&&i===`sset`||r===`sset`&&i===`sget`?(e[n]=`true`,!1):r?!0:(e[n]=i,!1)}function Bz(e,t){var n=e.computed,r=e.key;return!n&&(r.type===`Identifier`&&r.name===t||r.type===`Literal`&&r.value===t)}Mz.parseExportAllDeclaration=function(e,t){return this.options.ecmaVersion>=11&&(this.eatContextual(`as`)?(e.exported=this.parseModuleExportName(),this.checkExport(t,e.exported,this.lastTokStart)):e.exported=null),this.expectContextual(`from`),this.type!==Z.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,`ExportAllDeclaration`)},Mz.parseExport=function(e,t){if(this.next(),this.eat(Z.star))return this.parseExportAllDeclaration(e,t);if(this.eat(Z._default))return this.checkExport(t,`default`,this.lastTokStart),e.declaration=this.parseExportDefaultDeclaration(),this.finishNode(e,`ExportDefaultDeclaration`);if(this.shouldParseExportStatement())e.declaration=this.parseExportDeclaration(e),e.declaration.type===`VariableDeclaration`?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id,e.declaration.id.start),e.specifiers=[],e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[]);else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual(`from`))this.type!==Z.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause());else{for(var n=0,r=e.specifiers;n<r.length;n+=1){var i=r[n];this.checkUnreserved(i.local),this.checkLocalExport(i.local),i.local.type===`Literal`&&this.raise(i.local.start,"A string literal cannot be used as an exported binding without `from`.")}e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[])}this.semicolon()}return this.finishNode(e,`ExportNamedDeclaration`)},Mz.parseExportDeclaration=function(e){return this.parseStatement(null)},Mz.parseExportDefaultDeclaration=function(){var e;if(this.type===Z._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,Iz|Rz,!1,e)}if(this.type===Z._class){var n=this.startNode();return this.parseClass(n,`nullableID`)}var r=this.parseMaybeAssign();return this.semicolon(),r},Mz.checkExport=function(e,t,n){e&&(typeof t!=`string`&&(t=t.type===`Identifier`?t.name:t.value),YR(e,t)&&this.raiseRecoverable(n,`Duplicate export '`+t+`'`),e[t]=!0)},Mz.checkPatternExport=function(e,t){var n=t.type;if(n===`Identifier`)this.checkExport(e,t,t.start);else if(n===`ObjectPattern`)for(var r=0,i=t.properties;r<i.length;r+=1){var a=i[r];this.checkPatternExport(e,a)}else if(n===`ArrayPattern`)for(var o=0,s=t.elements;o<s.length;o+=1){var c=s[o];c&&this.checkPatternExport(e,c)}else n===`Property`?this.checkPatternExport(e,t.value):n===`AssignmentPattern`?this.checkPatternExport(e,t.left):n===`RestElement`&&this.checkPatternExport(e,t.argument)},Mz.checkVariableExport=function(e,t){if(e)for(var n=0,r=t;n<r.length;n+=1){var i=r[n];this.checkPatternExport(e,i.id)}},Mz.shouldParseExportStatement=function(){return this.type.keyword===`var`||this.type.keyword===`const`||this.type.keyword===`class`||this.type.keyword===`function`||this.isLet()||this.isAsyncFunction()},Mz.parseExportSpecifier=function(e){var t=this.startNode();return t.local=this.parseModuleExportName(),t.exported=this.eatContextual(`as`)?this.parseModuleExportName():t.local,this.checkExport(e,t.exported,t.exported.start),this.finishNode(t,`ExportSpecifier`)},Mz.parseExportSpecifiers=function(e){var t=[],n=!0;for(this.expect(Z.braceL);!this.eat(Z.braceR);){if(n)n=!1;else if(this.expect(Z.comma),this.afterTrailingComma(Z.braceR))break;t.push(this.parseExportSpecifier(e))}return t},Mz.parseImport=function(e){return this.next(),this.type===Z.string?(e.specifiers=Fz,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual(`from`),e.source=this.type===Z.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,`ImportDeclaration`)},Mz.parseImportSpecifier=function(){var e=this.startNode();return e.imported=this.parseModuleExportName(),this.eatContextual(`as`)?e.local=this.parseIdent():(this.checkUnreserved(e.imported),e.local=e.imported),this.checkLValSimple(e.local,Cz),this.finishNode(e,`ImportSpecifier`)},Mz.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,Cz),this.finishNode(e,`ImportDefaultSpecifier`)},Mz.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual(`as`),e.local=this.parseIdent(),this.checkLValSimple(e.local,Cz),this.finishNode(e,`ImportNamespaceSpecifier`)},Mz.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===Z.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(Z.comma)))return e;if(this.type===Z.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(Z.braceL);!this.eat(Z.braceR);){if(t)t=!1;else if(this.expect(Z.comma),this.afterTrailingComma(Z.braceR))break;e.push(this.parseImportSpecifier())}return e},Mz.parseWithClause=function(){var e=[];if(!this.eat(Z._with))return e;this.expect(Z.braceL);for(var t={},n=!0;!this.eat(Z.braceR);){if(n)n=!1;else if(this.expect(Z.comma),this.afterTrailingComma(Z.braceR))break;var r=this.parseImportAttribute(),i=r.key.type===`Identifier`?r.key.name:r.key.value;YR(t,i)&&this.raiseRecoverable(r.key.start,`Duplicate attribute key '`+i+`'`),t[i]=!0,e.push(r)}return e},Mz.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===Z.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!==`never`),this.expect(Z.colon),this.type!==Z.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,`ImportAttribute`)},Mz.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===Z.string){var e=this.parseLiteral(this.value);return ez.test(e.value)&&this.raise(e.start,`An export name cannot include a lone surrogate.`),e}return this.parseIdent(!0)},Mz.adaptDirectivePrologue=function(e){for(var t=0;t<e.length&&this.isDirectiveCandidate(e[t]);++t)e[t].directive=e[t].expression.raw.slice(1,-1)},Mz.isDirectiveCandidate=function(e){return this.options.ecmaVersion>=5&&e.type===`ExpressionStatement`&&e.expression.type===`Literal`&&typeof e.expression.value==`string`&&(this.input[e.start]===`"`||this.input[e.start]===`'`)};var Vz=Dz.prototype;Vz.toAssignable=function(e,t,n){if(this.options.ecmaVersion>=6&&e)switch(e.type){case`Identifier`:this.inAsync&&e.name===`await`&&this.raise(e.start,`Cannot use 'await' as identifier inside an async function`);break;case`ObjectPattern`:case`ArrayPattern`:case`AssignmentPattern`:case`RestElement`:break;case`ObjectExpression`:e.type=`ObjectPattern`,n&&this.checkPatternErrors(n,!0);for(var r=0,i=e.properties;r<i.length;r+=1){var a=i[r];this.toAssignable(a,t),a.type===`RestElement`&&(a.argument.type===`ArrayPattern`||a.argument.type===`ObjectPattern`)&&this.raise(a.argument.start,`Unexpected token`)}break;case`Property`:e.kind!==`init`&&this.raise(e.key.start,`Object pattern can't contain getter or setter`),this.toAssignable(e.value,t);break;case`ArrayExpression`:e.type=`ArrayPattern`,n&&this.checkPatternErrors(n,!0),this.toAssignableList(e.elements,t);break;case`SpreadElement`:e.type=`RestElement`,this.toAssignable(e.argument,t),e.argument.type===`AssignmentPattern`&&this.raise(e.argument.start,`Rest elements cannot have a default value`);break;case`AssignmentExpression`:e.operator!==`=`&&this.raise(e.left.end,`Only '=' operator can be used for specifying default value.`),e.type=`AssignmentPattern`,delete e.operator,this.toAssignable(e.left,t);break;case`ParenthesizedExpression`:this.toAssignable(e.expression,t,n);break;case`ChainExpression`:this.raiseRecoverable(e.start,`Optional chaining cannot appear in left-hand side`);break;case`MemberExpression`:if(!t)break;default:this.raise(e.start,`Assigning to rvalue`)}else n&&this.checkPatternErrors(n,!0);return e},Vz.toAssignableList=function(e,t){for(var n=e.length,r=0;r<n;r++){var i=e[r];i&&this.toAssignable(i,t)}if(n){var a=e[n-1];this.options.ecmaVersion===6&&t&&a&&a.type===`RestElement`&&a.argument.type!==`Identifier`&&this.unexpected(a.argument.start)}return e},Vz.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,`SpreadElement`)},Vz.parseRestBinding=function(){var e=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==Z.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,`RestElement`)},Vz.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case Z.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(Z.bracketR,!0,!0),this.finishNode(e,`ArrayPattern`);case Z.braceL:return this.parseObj(!0)}return this.parseIdent()},Vz.parseBindingList=function(e,t,n,r){for(var i=[],a=!0;!this.eat(e);)if(a?a=!1:this.expect(Z.comma),t&&this.type===Z.comma)i.push(null);else if(n&&this.afterTrailingComma(e))break;else if(this.type===Z.ellipsis){var o=this.parseRestBinding();this.parseBindingListItem(o),i.push(o),this.type===Z.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`),this.expect(e);break}else i.push(this.parseAssignableListItem(r));return i},Vz.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t},Vz.parseBindingListItem=function(e){return e},Vz.parseMaybeDefault=function(e,t,n){if(n||=this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(Z.eq))return n;var r=this.startNodeAt(e,t);return r.left=n,r.right=this.parseMaybeAssign(),this.finishNode(r,`AssignmentPattern`)},Vz.checkLValSimple=function(e,t,n){t===void 0&&(t=xz);var r=t!==xz;switch(e.type){case`Identifier`:this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(r?`Binding `:`Assigning to `)+e.name+` in strict mode`),r&&(t===Cz&&e.name===`let`&&this.raiseRecoverable(e.start,`let is disallowed as a lexically bound name`),n&&(YR(n,e.name)&&this.raiseRecoverable(e.start,`Argument name clash`),n[e.name]=!0),t!==Ez&&this.declareName(e.name,t,e.start));break;case`ChainExpression`:this.raiseRecoverable(e.start,`Optional chaining cannot appear in left-hand side`);break;case`MemberExpression`:r&&this.raiseRecoverable(e.start,`Binding member expression`);break;case`ParenthesizedExpression`:return r&&this.raiseRecoverable(e.start,`Binding parenthesized expression`),this.checkLValSimple(e.expression,t,n);default:this.raise(e.start,(r?`Binding`:`Assigning to`)+` rvalue`)}},Vz.checkLValPattern=function(e,t,n){switch(t===void 0&&(t=xz),e.type){case`ObjectPattern`:for(var r=0,i=e.properties;r<i.length;r+=1){var a=i[r];this.checkLValInnerPattern(a,t,n)}break;case`ArrayPattern`:for(var o=0,s=e.elements;o<s.length;o+=1){var c=s[o];c&&this.checkLValInnerPattern(c,t,n)}break;default:this.checkLValSimple(e,t,n)}},Vz.checkLValInnerPattern=function(e,t,n){switch(t===void 0&&(t=xz),e.type){case`Property`:this.checkLValInnerPattern(e.value,t,n);break;case`AssignmentPattern`:this.checkLValPattern(e.left,t,n);break;case`RestElement`:this.checkLValPattern(e.argument,t,n);break;default:this.checkLValPattern(e,t,n)}};var Hz=function(e,t,n,r,i){this.token=e,this.isExpr=!!t,this.preserveSpace=!!n,this.override=r,this.generator=!!i},Uz={b_stat:new Hz(`{`,!1),b_expr:new Hz(`{`,!0),b_tmpl:new Hz("${",!1),p_stat:new Hz(`(`,!1),p_expr:new Hz(`(`,!0),q_tmpl:new Hz("`",!0,!0,function(e){return e.tryReadTemplateToken()}),f_stat:new Hz(`function`,!1),f_expr:new Hz(`function`,!0),f_expr_gen:new Hz(`function`,!0,!1,null,!0),f_gen:new Hz(`function`,!1,!1,null,!0)},Wz=Dz.prototype;Wz.initialContext=function(){return[Uz.b_stat]},Wz.curContext=function(){return this.context[this.context.length-1]},Wz.braceIsBlock=function(e){var t=this.curContext();return t===Uz.f_expr||t===Uz.f_stat?!0:e===Z.colon&&(t===Uz.b_stat||t===Uz.b_expr)?!t.isExpr:e===Z._return||e===Z.name&&this.exprAllowed?BR.test(this.input.slice(this.lastTokEnd,this.start)):e===Z._else||e===Z.semi||e===Z.eof||e===Z.parenR||e===Z.arrow?!0:e===Z.braceL?t===Uz.b_stat:e===Z._var||e===Z._const||e===Z.name?!1:!this.exprAllowed},Wz.inGeneratorContext=function(){for(var e=this.context.length-1;e>=1;e--){var t=this.context[e];if(t.token===`function`)return t.generator}return!1},Wz.updateContext=function(e){var t,n=this.type;n.keyword&&e===Z.dot?this.exprAllowed=!1:(t=n.updateContext)?t.call(this,e):this.exprAllowed=n.beforeExpr},Wz.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)},Z.parenR.updateContext=Z.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var e=this.context.pop();e===Uz.b_stat&&this.curContext().token===`function`&&(e=this.context.pop()),this.exprAllowed=!e.isExpr},Z.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?Uz.b_stat:Uz.b_expr),this.exprAllowed=!0},Z.dollarBraceL.updateContext=function(){this.context.push(Uz.b_tmpl),this.exprAllowed=!0},Z.parenL.updateContext=function(e){var t=e===Z._if||e===Z._for||e===Z._with||e===Z._while;this.context.push(t?Uz.p_stat:Uz.p_expr),this.exprAllowed=!0},Z.incDec.updateContext=function(){},Z._function.updateContext=Z._class.updateContext=function(e){e.beforeExpr&&e!==Z._else&&(e!==Z.semi||this.curContext()===Uz.p_stat)&&!(e===Z._return&&BR.test(this.input.slice(this.lastTokEnd,this.start)))&&(e!==Z.colon&&e!==Z.braceL||this.curContext()!==Uz.b_stat)?this.context.push(Uz.f_expr):this.context.push(Uz.f_stat),this.exprAllowed=!1},Z.colon.updateContext=function(){this.curContext().token===`function`&&this.context.pop(),this.exprAllowed=!0},Z.backQuote.updateContext=function(){this.curContext()===Uz.q_tmpl?this.context.pop():this.context.push(Uz.q_tmpl),this.exprAllowed=!1},Z.star.updateContext=function(e){if(e===Z._function){var t=this.context.length-1;this.context[t]===Uz.f_expr?this.context[t]=Uz.f_expr_gen:this.context[t]=Uz.f_gen}this.exprAllowed=!0},Z.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==Z.dot&&(this.value===`of`&&!this.exprAllowed||this.value===`yield`&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var Gz=Dz.prototype;Gz.checkPropClash=function(e,t,n){if(!(this.options.ecmaVersion>=9&&e.type===`SpreadElement`)&&!(this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var r=e.key,i;switch(r.type){case`Identifier`:i=r.name;break;case`Literal`:i=String(r.value);break;default:return}var a=e.kind;if(this.options.ecmaVersion>=6){i===`__proto__`&&a===`init`&&(t.proto&&(n?n.doubleProto<0&&(n.doubleProto=r.start):this.raiseRecoverable(r.start,`Redefinition of __proto__ property`)),t.proto=!0);return}i=`$`+i;var o=t[i];o?(a===`init`?this.strict&&o.init||o.get||o.set:o.init||o[a])&&this.raiseRecoverable(r.start,`Redefinition of property`):o=t[i]={init:!1,get:!1,set:!1},o[a]=!0}},Gz.parseExpression=function(e,t){var n=this;return this.catchStackOverflow(function(){var r=n.start,i=n.startLoc,a=n.parseMaybeAssign(e,t);if(n.type===Z.comma){var o=n.startNodeAt(r,i);for(o.expressions=[a];n.eat(Z.comma);)o.expressions.push(n.parseMaybeAssign(e,t));return n.finishNode(o,`SequenceExpression`)}return a})},Gz.parseMaybeAssign=function(e,t,n){if(this.isContextual(`yield`)){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var r=!1,i=-1,a=-1,o=-1;t?(i=t.parenthesizedAssign,a=t.trailingComma,o=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new jz,r=!0);var s=this.start,c=this.startLoc;(this.type===Z.parenL||this.type===Z.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=e===`await`);var l=this.parseMaybeConditional(e,t);if(n&&(l=n.call(this,l,s,c)),this.type.isAssign){var u=this.startNodeAt(s,c);return u.operator=this.value,this.type===Z.eq&&(l=this.toAssignable(l,!1,t)),r||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=l.start&&(t.shorthandAssign=-1),this.type===Z.eq?this.checkLValPattern(l):this.checkLValSimple(l),u.left=l,this.next(),u.right=this.parseMaybeAssign(e),o>-1&&(t.doubleProto=o),this.finishNode(u,`AssignmentExpression`)}return r&&this.checkExpressionErrors(t,!0),i>-1&&(t.parenthesizedAssign=i),a>-1&&(t.trailingComma=a),l},Gz.parseMaybeConditional=function(e,t){var n=this.start,r=this.startLoc,i=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return i;if((i.type!==`ArrowFunctionExpression`||i.start!==n)&&this.eat(Z.question)){var a=this.startNodeAt(n,r);return a.test=i,a.consequent=this.parseMaybeAssign(),this.expect(Z.colon),a.alternate=this.parseMaybeAssign(e),this.finishNode(a,`ConditionalExpression`)}return i},Gz.parseExprOps=function(e,t){var n=this.start,r=this.startLoc,i=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||i.start===n&&i.type===`ArrowFunctionExpression`?i:this.parseExprOp(i,n,r,-1,e)},Gz.parseExprOp=function(e,t,n,r,i){var a=this.type.binop;if(a!=null&&(!i||this.type!==Z._in)&&a>r){var o=this.type===Z.logicalOR||this.type===Z.logicalAND,s=this.type===Z.coalesce;s&&(a=Z.logicalAND.binop);var c=this.value;this.next();var l=this.start,u=this.startLoc,d=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,i),l,u,a,i),f=this.buildBinary(t,n,e,d,c,o||s);return(o&&this.type===Z.coalesce||s&&(this.type===Z.logicalOR||this.type===Z.logicalAND))&&this.raiseRecoverable(this.start,`Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses`),this.parseExprOp(f,t,n,r,i)}return e},Gz.buildBinary=function(e,t,n,r,i,a){r.type===`PrivateIdentifier`&&this.raise(r.start,`Private identifier can only be left side of binary expression`);var o=this.startNodeAt(e,t);return o.left=n,o.operator=i,o.right=r,this.finishNode(o,a?`LogicalExpression`:`BinaryExpression`)},Gz.parseMaybeUnary=function(e,t,n,r){var i=this.start,a=this.startLoc,o;if(this.isContextual(`await`)&&this.canAwait)o=this.parseAwait(r),t=!0;else if(this.type.prefix){var s=this.startNode(),c=this.type===Z.incDec;s.operator=this.value,s.prefix=!0,this.next(),s.argument=this.parseMaybeUnary(null,!0,c,r),this.checkExpressionErrors(e,!0),c?this.checkLValSimple(s.argument):this.strict&&s.operator===`delete`&&Kz(s.argument)?this.raiseRecoverable(s.start,`Deleting local variable in strict mode`):s.operator===`delete`&&qz(s.argument)?this.raiseRecoverable(s.start,`Private fields can not be deleted`):t=!0,o=this.finishNode(s,c?`UpdateExpression`:`UnaryExpression`)}else if(!t&&this.type===Z.privateId)(r||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),o=this.parsePrivateIdent(),this.type!==Z._in&&this.unexpected();else{if(o=this.parseExprSubscripts(e,r),this.checkExpressionErrors(e))return o;for(;this.type.postfix&&!this.canInsertSemicolon();){var l=this.startNodeAt(i,a);l.operator=this.value,l.prefix=!1,l.argument=o,this.checkLValSimple(o),this.next(),o=this.finishNode(l,`UpdateExpression`)}}if(!n&&(o.type!==`ArrowFunctionExpression`||o.start!==i)&&this.eat(Z.starstar)){if(t)this.unexpected(this.lastTokStart);else return this.buildBinary(i,a,o,this.parseMaybeUnary(null,!1,!1,r),`**`,!1)}else return o};function Kz(e){return e.type===`Identifier`||e.type===`ParenthesizedExpression`&&Kz(e.expression)}function qz(e){return e.type===`MemberExpression`&&e.property.type===`PrivateIdentifier`||e.type===`ChainExpression`&&qz(e.expression)||e.type===`ParenthesizedExpression`&&qz(e.expression)}Gz.parseExprSubscripts=function(e,t){var n=this.start,r=this.startLoc,i=this.parseExprAtom(e,t);if(i.type===`ArrowFunctionExpression`&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==`)`)return i;var a=this.parseSubscripts(i,n,r,!1,t);return e&&a.type===`MemberExpression`&&(e.parenthesizedAssign>=a.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=a.start&&(e.parenthesizedBind=-1),e.trailingComma>=a.start&&(e.trailingComma=-1)),a},Gz.parseSubscripts=function(e,t,n,r,i){for(var a=this.options.ecmaVersion>=8&&e.type===`Identifier`&&e.name===`async`&&this.lastTokEnd===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&this.potentialArrowAt===e.start,o=!1;;){var s=this.parseSubscript(e,t,n,r,a,o,i);if(s.optional&&(o=!0),s===e||s.type===`ArrowFunctionExpression`){if(o){var c=this.startNodeAt(t,n);c.expression=s,s=this.finishNode(c,`ChainExpression`)}return s}e=s}},Gz.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(Z.arrow)},Gz.parseSubscriptAsyncArrow=function(e,t,n,r){return this.parseArrowExpression(this.startNodeAt(e,t),n,!0,r)},Gz.parseSubscript=function(e,t,n,r,i,a,o){var s=this.options.ecmaVersion>=11,c=s&&this.eat(Z.questionDot);r&&c&&this.raise(this.lastTokStart,`Optional chaining cannot appear in the callee of new expressions`);var l=this.eat(Z.bracketL);if(l||c&&this.type!==Z.parenL&&this.type!==Z.backQuote||this.eat(Z.dot)){var u=this.startNodeAt(t,n);u.object=e,l?(u.property=this.parseExpression(),this.expect(Z.bracketR)):u.property=this.type===Z.privateId&&e.type!==`Super`?this.parsePrivateIdent():this.parseIdent(this.options.allowReserved!==`never`),u.computed=!!l,s&&(u.optional=c),e=this.finishNode(u,`MemberExpression`)}else if(!r&&this.eat(Z.parenL)){var d=new jz,f=this.yieldPos,p=this.awaitPos,m=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var h=this.parseExprList(Z.parenR,this.options.ecmaVersion>=8,!1,d);if(i&&!c&&this.shouldParseAsyncArrow())return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,`Cannot use 'await' as identifier inside an async function`),this.yieldPos=f,this.awaitPos=p,this.awaitIdentPos=m,this.parseSubscriptAsyncArrow(t,n,h,o);this.checkExpressionErrors(d,!0),this.yieldPos=f||this.yieldPos,this.awaitPos=p||this.awaitPos,this.awaitIdentPos=m||this.awaitIdentPos;var g=this.startNodeAt(t,n);g.callee=e,g.arguments=h,s&&(g.optional=c),e=this.finishNode(g,`CallExpression`)}else if(this.type===Z.backQuote){(c||a)&&this.raise(this.start,`Optional chaining cannot appear in the tag of tagged template expressions`);var _=this.startNodeAt(t,n);_.tag=e,_.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(_,`TaggedTemplateExpression`)}return e},Gz.parseExprAtom=function(e,t,n){this.type===Z.slash&&this.readRegexp();var r,i=this.potentialArrowAt===this.start;switch(this.type){case Z._super:return this.allowSuper||this.raise(this.start,`'super' keyword outside a method`),r=this.startNode(),this.next(),this.type===Z.parenL&&!this.allowDirectSuper&&this.raise(r.start,`super() call outside constructor of a subclass`),this.type!==Z.dot&&this.type!==Z.bracketL&&this.type!==Z.parenL&&this.unexpected(),this.finishNode(r,`Super`);case Z._this:return r=this.startNode(),this.next(),this.finishNode(r,`ThisExpression`);case Z.name:var a=this.start,o=this.startLoc,s=this.containsEsc,c=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!s&&c.name===`async`&&!this.canInsertSemicolon()&&this.eat(Z._function))return this.overrideContext(Uz.f_expr),this.parseFunction(this.startNodeAt(a,o),0,!1,!0,t);if(i&&!this.canInsertSemicolon()){if(this.eat(Z.arrow))return this.parseArrowExpression(this.startNodeAt(a,o),[c],!1,t);if(this.options.ecmaVersion>=8&&c.name===`async`&&this.type===Z.name&&!s&&(!this.potentialArrowInForAwait||this.value!==`of`||this.containsEsc))return c=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(Z.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(a,o),[c],!0,t)}return c;case Z.regexp:var l=this.value;return r=this.parseLiteral(l.value),r.regex={pattern:l.pattern,flags:l.flags},r;case Z.num:case Z.string:return this.parseLiteral(this.value);case Z._null:case Z._true:case Z._false:return r=this.startNode(),r.value=this.type===Z._null?null:this.type===Z._true,r.raw=this.type.keyword,this.next(),this.finishNode(r,`Literal`);case Z.parenL:var u=this.start,d=this.parseParenAndDistinguishExpression(i,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(d)&&(e.parenthesizedAssign=u),e.parenthesizedBind<0&&(e.parenthesizedBind=u)),d;case Z.bracketL:return r=this.startNode(),this.next(),r.elements=this.parseExprList(Z.bracketR,!0,!0,e),this.finishNode(r,`ArrayExpression`);case Z.braceL:return this.overrideContext(Uz.b_expr),this.parseObj(!1,e);case Z._function:return r=this.startNode(),this.next(),this.parseFunction(r,0);case Z._class:return this.parseClass(this.startNode(),!1);case Z._new:return this.parseNew();case Z.backQuote:return this.parseTemplate();case Z._import:return this.options.ecmaVersion>=11?this.parseExprImport(n):this.unexpected();default:return this.parseExprAtomDefault()}},Gz.parseExprAtomDefault=function(){this.unexpected()},Gz.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword import`),this.next(),this.type===Z.parenL&&!e)return this.parseDynamicImport(t);if(this.type===Z.dot){var n=this.startNodeAt(t.start,t.loc&&t.loc.start);return n.name=`import`,t.meta=this.finishNode(n,`Identifier`),this.parseImportMeta(t)}this.unexpected()},Gz.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(Z.parenR)?e.options=null:(this.expect(Z.comma),this.afterTrailingComma(Z.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(Z.parenR)||(this.expect(Z.comma),this.afterTrailingComma(Z.parenR)||this.unexpected())));else if(!this.eat(Z.parenR)){var t=this.start;this.eat(Z.comma)&&this.eat(Z.parenR)?this.raiseRecoverable(t,`Trailing comma is not allowed in import()`):this.unexpected(t)}return this.finishNode(e,`ImportExpression`)},Gz.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!==`meta`&&this.raiseRecoverable(e.property.start,`The only valid meta property for import is 'import.meta'`),t&&this.raiseRecoverable(e.start,`'import.meta' must not contain escaped characters`),this.options.sourceType!==`module`&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(e.start,`Cannot use 'import.meta' outside a module`),this.finishNode(e,`MetaProperty`)},Gz.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),t.raw.charCodeAt(t.raw.length-1)===110&&(t.bigint=t.value==null?t.raw.slice(0,-1).replace(/_/g,``):t.value.toString()),this.next(),this.finishNode(t,`Literal`)},Gz.parseParenExpression=function(){this.expect(Z.parenL);var e=this.parseExpression();return this.expect(Z.parenR),e},Gz.shouldParseArrow=function(e){return!this.canInsertSemicolon()},Gz.parseParenAndDistinguishExpression=function(e,t){var n=this.start,r=this.startLoc,i,a=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var o=this.start,s=this.startLoc,c=[],l=!0,u=!1,d=new jz,f=this.yieldPos,p=this.awaitPos,m;for(this.yieldPos=0,this.awaitPos=0;this.type!==Z.parenR;){if(l?l=!1:this.expect(Z.comma),a&&this.afterTrailingComma(Z.parenR,!0)){u=!0;break}if(this.type===Z.ellipsis){m=this.start,c.push(this.parseParenItem(this.parseRestBinding())),this.type===Z.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`);break}c.push(this.parseMaybeAssign(!1,d,this.parseParenItem))}var h=this.lastTokEnd,g=this.lastTokEndLoc;if(this.expect(Z.parenR),e&&this.shouldParseArrow(c)&&this.eat(Z.arrow))return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=f,this.awaitPos=p,this.parseParenArrowList(n,r,c,t);(!c.length||u)&&this.unexpected(this.lastTokStart),m&&this.unexpected(m),this.checkExpressionErrors(d,!0),this.yieldPos=f||this.yieldPos,this.awaitPos=p||this.awaitPos,c.length>1?(i=this.startNodeAt(o,s),i.expressions=c,this.finishNodeAt(i,`SequenceExpression`,h,g)):i=c[0]}else i=this.parseParenExpression();if(this.options.preserveParens){var _=this.startNodeAt(n,r);return _.expression=i,this.finishNode(_,`ParenthesizedExpression`)}return i},Gz.parseParenItem=function(e){return e},Gz.parseParenArrowList=function(e,t,n,r){return this.parseArrowExpression(this.startNodeAt(e,t),n,!1,r)};var Jz=[];Gz.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword new`);var e=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===Z.dot){var t=this.startNodeAt(e.start,e.loc&&e.loc.start);t.name=`new`,e.meta=this.finishNode(t,`Identifier`),this.next();var n=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!==`target`&&this.raiseRecoverable(e.property.start,`The only valid meta property for new is 'new.target'`),n&&this.raiseRecoverable(e.start,`'new.target' must not contain escaped characters`),this.allowNewDotTarget||this.raiseRecoverable(e.start,`'new.target' can only be used in functions and class static block`),this.finishNode(e,`MetaProperty`)}var r=this.start,i=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),r,i,!0,!1),e.callee.type===`Super`&&this.raiseRecoverable(r,`Invalid use of 'super'`),e.arguments=this.eat(Z.parenL)?this.parseExprList(Z.parenR,this.options.ecmaVersion>=8,!1):Jz,this.finishNode(e,`NewExpression`)},Gz.parseTemplateElement=function(e){var t=e.isTagged,n=this.startNode();return this.type===Z.invalidTemplate?(t||this.raiseRecoverable(this.start,`Bad escape sequence in untagged template literal`),n.value={raw:this.value.replace(/\r\n?/g,`
1172
1172
  `),cooked:null}):n.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
@@ -1556,16 +1556,23 @@ label:has(> textarea) {
1556
1556
  :where(.sm-actions) > :where(.sm-primary){flex:1 1 100%}
1557
1557
  }
1558
1558
 
1559
- /* ---------- Fields: a short label above one control ---------- */
1559
+ /* ---------- Fields: a short setting is one row, its label beside the control ----------
1560
+ Long inputs (a textarea, picture choices, file tiles, a list) keep their label above. */
1560
1561
  :where(.sm-field){display:grid;gap:6px;min-width:0}
1561
1562
  :where(.sm-field) > :where(label,.sm-label){display:flex;align-items:center;gap:var(--s-1,4px);font-size:var(--fs-body-s,.875rem);color:var(--fg-muted);min-height:24px}
1562
1563
  :where(.sm-field) :where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),select,textarea){width:100%;min-height:var(--touch-target,44px);padding:10px 12px;border:1px solid var(--border-tok);border-radius:var(--r-3,8px);background:var(--bg-elev-1);color:var(--fg);font:inherit}
1563
1564
  :where(.sm-field) :where(textarea){min-height:96px;resize:vertical}
1564
1565
  :where(.sm-fields){display:grid;gap:var(--s-4,16px);grid-template-columns:repeat(auto-fit,minmax(min(100%,200px),1fr))}
1565
- /* Compact: on a view wider than a phone a short field is one row, its label beside the control. */
1566
+ /* Compact (October 19, 2026): a short field is one row at every width. On a phone or in a
1567
+ narrow cell the label takes its own width and the control the rest; when the two do not
1568
+ fit, the control wraps under its label. */
1569
+ :where(.sm-field:not(:has(textarea,.sm-choices,.sm-gallery,.sm-list))){display:flex;flex-wrap:wrap;align-items:center;gap:6px var(--s-2,8px)}
1570
+ :where(.sm-field:not(:has(textarea,.sm-choices,.sm-gallery,.sm-list))) > :where(label,.sm-label){flex:0 1 auto}
1571
+ :where(.sm-field:not(:has(textarea,.sm-choices,.sm-gallery,.sm-list))) > :where(:not(label,.sm-label)){flex:1 1 var(--sm-control,10rem);min-width:0}
1572
+ /* Wider than a phone, short fields line up: one label column, the controls beside it. */
1566
1573
  @container (min-width:520px){
1567
1574
  /* Picture choices, file tiles and lists keep the full width: their label sits above, and they need the row. */
1568
- :where(.sm-field:not(:has(textarea,.sm-choices,.sm-gallery,.sm-list))){grid-template-columns:minmax(5rem,9rem) minmax(0,1fr);align-items:center;gap:var(--s-2,8px)}
1575
+ :where(.sm-field:not(:has(textarea,.sm-choices,.sm-gallery,.sm-list))){display:grid;grid-template-columns:minmax(5rem,9rem) minmax(0,1fr);align-items:center;gap:var(--s-2,8px)}
1569
1576
  :where(.sm-field) :where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),select){min-height:36px;padding:6px 10px}
1570
1577
  :where(.sm-fields){gap:var(--s-2,8px) var(--s-4,16px)}
1571
1578
  }
@@ -1600,9 +1607,11 @@ label:has(> textarea) {
1600
1607
  :where(.sm-choices[data-segmented]) > :where(label:last-of-type){border-start-end-radius:var(--r-pill,999px);border-end-end-radius:var(--r-pill,999px)}
1601
1608
  :where(.sm-choices[data-segmented]) > :where(label:has(input:checked)){position:relative;z-index:1;background:var(--bg-elev-2)}
1602
1609
  :where(.sm-choices[data-segmented]) :where(.sm-glyph){--sm-glyph-size:16px;margin:0}
1603
- /* Settings side by side: a grid of short settings, each label above its control. */
1610
+ /* Settings side by side: a grid of short settings, each label beside its control. A cell
1611
+ too narrow for both wraps the control under its label; long inputs keep the label above. */
1604
1612
  :where(.sm-settings){display:grid;gap:var(--s-3,12px) var(--s-4,16px);grid-template-columns:repeat(auto-fill,minmax(min(100%,11rem),1fr));align-items:start;min-width:0}
1605
1613
  :where(.sm-settings) > :where(.sm-field){grid-template-columns:minmax(0,1fr);gap:4px}
1614
+ :where(.sm-settings) > :where(.sm-field:not(:has(textarea,.sm-choices,.sm-gallery,.sm-list))){--sm-control:6rem;display:flex;flex-wrap:wrap;align-items:center;gap:4px var(--s-2,8px)}
1606
1615
  :where(.sm-settings) > :where(.sm-choices) > :where(legend),:where(.sm-settings) :where(.sm-label){font-size:var(--fs-caption,.8125rem)}
1607
1616
  /* On a phone, a row of chips or segments scrolls sideways instead of wrapping. */
1608
1617
  @container (max-width:519px){
@@ -1666,7 +1675,7 @@ label:has(> textarea) {
1666
1675
  :where(.sm-more) > :where(summary):hover{color:var(--fg)}
1667
1676
  :where(.sm-more) > :where(:not(summary)){margin-top:var(--s-2,8px)}
1668
1677
  :where(.sm-more[open]){padding-bottom:var(--s-3,12px)}
1669
- /* The popup spans its label row (.sm-label), so it never runs off a narrow screen. */
1678
+ /* The popup opens under its label row (.sm-label) and is never wider than the view, so it stays on a narrow screen even when the label sits beside its control. */
1670
1679
  :where(.sm-label){position:relative}
1671
1680
  :where(.sm-hint){display:inline-block;vertical-align:middle}
1672
1681
  :where(:not(.sm-label)) > :where(.sm-hint){position:relative}
@@ -1675,7 +1684,7 @@ label:has(> textarea) {
1675
1684
  :where(.sm-hint) > :where(summary)::-webkit-details-marker{display:none}
1676
1685
  :where(.sm-hint) > :where(summary)::before{content:"i";display:grid;place-items:center;width:15px;height:15px;border:1.5px solid currentColor;border-radius:50%;font:600 10px/1 var(--font-body);font-style:normal}
1677
1686
  :where(.sm-hint) > :where(summary):hover,:where(.sm-hint[open]) > :where(summary){color:var(--fg)}
1678
- :where(.sm-hint) > :where(:not(summary)){position:absolute;z-index:5;inset-inline-start:0;top:100%;width:max-content;max-width:min(280px,100%);margin:4px 0 0;padding:10px 12px;border:1px solid var(--border-tok);border-radius:var(--r-3,8px);background:var(--bg-elev-2);color:var(--fg);font-size:var(--fs-body-s,.875rem);line-height:1.45;box-shadow:var(--shadow-1)}
1687
+ :where(.sm-hint) > :where(:not(summary)){position:absolute;z-index:5;inset-inline-start:0;top:100%;width:max-content;max-width:min(280px,calc(100cqi - 32px));margin:4px 0 0;padding:10px 12px;border:1px solid var(--border-tok);border-radius:var(--r-3,8px);background:var(--bg-elev-2);color:var(--fg);font-size:var(--fs-body-s,.875rem);line-height:1.45;box-shadow:var(--shadow-1)}
1679
1688
  /* Outside a label row there is no safe anchor, so the explanation opens in the flow instead. */
1680
1689
  :where(:not(.sm-label)) > :where(.sm-hint[open]){display:block}
1681
1690
  :where(:not(.sm-label)) > :where(.sm-hint) > :where(:not(summary)){position:static;width:auto;max-width:60ch}
@@ -1717,5 +1726,5 @@ label:has(> textarea) {
1717
1726
  :where(.sm-status[data-state="loading"])::before,:where(.sm-glyph[data-glyph="spinner"])::before{animation:none;border-right-color:currentColor;opacity:.6}
1718
1727
  :where(.sm-more) > :where(summary)::after{transition:none}
1719
1728
  }
1720
- `;function AV(e){let t=e=>Number.isFinite(e)&&e>=0&&e<=1;return!e||typeof e!=`object`||Array.isArray(e)||!t(e.x)||!t(e.y)||e.id!==void 0&&(typeof e.id!=`string`||!e.id.length||e.id.length>160)?null:{x:e.x,y:e.y,...e.id===void 0?{}:{id:e.id}}}function jV(e,t,n){if(t=AV(t),!t)return null;let r,i;if(t.id!==void 0){let n=e.getElementById(t.id);if(!n)return null;let a=n.getBoundingClientRect();if(a.width<=0||a.height<=0)return null;r=a.left+a.width*t.x,i=a.top+a.height*t.y;let o=e.elementFromPoint?.(r,i);if(o&&!n.contains(o))return null}else r=t.x*e.documentElement.scrollWidth-n.scrollX,i=t.y*e.documentElement.scrollHeight-n.scrollY;return Number.isFinite(r)&&Number.isFinite(i)&&r>=0&&i>=0&&r<=n.width&&i<=n.height?{x:r,y:i}:null}function MV(e,t,n){let r=null,i=null,a=null,o=!1,s=e=>Math.max(0,Math.min(1,e)),c=[],l=null,u=null,d=null,f=new Map,p=()=>{if(u=null,o||!n)return;!l&&c.length&&(l=document.createElement(`div`),l.style.cssText=`position:fixed;inset:0;pointer-events:none;z-index:2147483647;overflow:hidden`,l.setAttribute(`aria-hidden`,`true`),document.body.append(l));let e=new Set(c.map(e=>e.id));for(let[t,n]of f)e.has(t)||(n.remove(),f.delete(t));for(let e of c){let t=f.get(e.id);t||(t=document.createElement(`div`),t.style.cssText=`position:absolute;left:0;top:0;pointer-events:none;color:var(--fg);white-space:nowrap;font:12px var(--font-body,sans-serif)`,typeof matchMedia==`function`&&!matchMedia(`(prefers-reduced-motion: reduce)`).matches&&(t.style.transition=`transform 100ms linear`),l.append(t),f.set(e.id,t)),t.textContent=`↖ `+e.label;let r=n(document,e.anchor,{width:innerWidth,height:innerHeight,scrollX,scrollY});t.hidden=!r,r&&(t.style.transform=`translate(`+r.x+`px,`+r.y+`px)`)}},m=()=>{u===null&&(u=setTimeout(p,50))},h=()=>{if(i=null,!o&&r){if(r.visible&&a){let e=(document.elementFromPoint?.(a.x,a.y)||a.target)?.closest?.(`[id]`),t=e?.id,n=t&&t.length<=160?e.getBoundingClientRect():null;if(n?.width>0&&n?.height>0)r.anchor={id:t,x:s((a.x-n.left)/n.width),y:s((a.y-n.top)/n.height)};else{let e=document.documentElement;r.anchor={x:s((a.x+scrollX)/Math.max(1,e.scrollWidth)),y:s((a.y+scrollY)/Math.max(1,e.scrollHeight))}}}parent.postMessage({channel:e,session:t,op:`cursor`,cursor:r},`*`),r=null}},g=e=>{a={x:e.clientX,y:e.clientY,target:e.target},r={x:s(e.clientX/Math.max(1,innerWidth)),y:s(e.clientY/Math.max(1,innerHeight)),visible:!0},i===null&&(i=setTimeout(h,50))},_=()=>{a=null,r={x:0,y:0,visible:!1},i===null&&(i=setTimeout(h,0))},v=()=>{a&&g({clientX:a.x,clientY:a.y,target:a.target}),m()},y=n=>{let s=n.data;if(!(o||n.source!==parent||s?.channel!==e||s.session!==t)){if(s.op===`peer-cursors`){c=(Array.isArray(s.peers)?s.peers:[]).slice(0,50).filter(e=>e&&typeof e.id==`string`&&e.id.length<=200&&typeof e.label==`string`&&e.label.length<=120).map(e=>({id:e.id,label:e.label,anchor:e.anchor})),m();return}s.op===`dispose`&&(o=!0,clearTimeout(i),clearTimeout(u),d?.disconnect(),r=null,a=null,c=[],f.clear(),l?.remove(),removeEventListener(`pointermove`,g),removeEventListener(`scroll`,v,!0),removeEventListener(`resize`,v),removeEventListener(`blur`,_),removeEventListener(`message`,y),document.documentElement.removeEventListener(`pointerleave`,_))}};addEventListener(`pointermove`,g,{passive:!0}),addEventListener(`scroll`,v,{passive:!0,capture:!0}),addEventListener(`resize`,v,{passive:!0}),document.documentElement.addEventListener(`pointerleave`,_),addEventListener(`blur`,_),addEventListener(`message`,y),typeof MutationObserver==`function`&&(d=new MutationObserver(e=>{c.length&&e.some(e=>!l?.contains(e.target))&&m()}),d.observe(document.body,{subtree:!0,childList:!0,attributes:!0,characterData:!0}))}function NV(e,t){let n=r=>{let i=r.data;r.source===parent&&i&&i.channel===e&&i.session===t&&(i.op===`theme`&&[`light`,`dark`,`white`].includes(i.mode)&&(document.documentElement.dataset.mode=i.mode),i.op===`dispose`&&removeEventListener(`message`,n))};addEventListener(`message`,n)}function PV(e,t){let n=parent,r=null,i=0,a=!1,o=()=>{if(r=null,a)return;let o=Math.ceil(Math.max(document.body.scrollHeight,document.body.getBoundingClientRect().height));o!==i&&(i=o,n.postMessage({channel:e,session:t,op:`content-size`,height:o},`*`))},s=()=>{!a&&r===null&&(r=setTimeout(o,100))},c=new ResizeObserver(s);c.observe(document.body);let l=i=>{i.source===n&&i.data?.channel===e&&i.data?.session===t&&i.data?.op===`dispose`&&(a=!0,clearTimeout(r),c.disconnect(),removeEventListener(`message`,l))};addEventListener(`message`,l),s()}xt();function FV(e){return L(Array.isArray(e)&&e.length>0&&e.length<=128&&e.every(e=>typeof e==`string`&&/^[a-f0-9]{64}$/.test(e)),`SCHEMA`,`Provide 1–128 exact source digests`),[...new Set(e)]}async function IV(e){ut(e);let t=e?.stages&&e.packages||[];return L(Array.isArray(t)&&t.length<128,`LIMIT`,`Too many packaged Blocks for execution review`),FV(await Promise.all([e,...t].map(e=>ft(e))))}async function LV(e){let t=await IV(e),n=new Set(t),r=e?.stages?e.packages||[]:[e],i=e=>{L(e&&typeof e.digest==`string`&&/^[a-f0-9]{64}$/.test(e.digest),`SCHEMA`,`Block lineage needs exact source digests`),n.add(e.digest),L(n.size<=128,`LIMIT`,`Block source and ancestry exceed the security review limit`)};for(let e of r){let t=e.manifest?.provenance;t?.remixedFrom!==void 0&&i(t.remixedFrom);let n=t?.remixAncestors??[];L(Array.isArray(n)&&n.length<=64,`SCHEMA`,`Block ancestry must contain at most 64 exact source references`),n.forEach(i);let r=e.portable?.lineage?.parents??[];L(Array.isArray(r)&&r.length<=16,`SCHEMA`,`Portable lineage must contain at most 16 exact source references`),r.forEach(i)}return FV([...n])}var RV=`stillmade.block-security.v1`,zV=new Map;function BV(e,t){let n=e?.revision||0,r=t.revision||0;return{revision:Math.max(n,r),published:t.published||e?.published===!0,revoked:n>r?e.revoked:n===r?t.revoked||e?.revoked===!0:t.revoked}}function VV(){try{let e=JSON.parse(globalThis.localStorage?.getItem(RV)||`{}`);for(let[t,n]of Object.entries(e))/^[a-f0-9]{64}$/.test(t)&&n&&typeof n.revoked==`boolean`&&typeof n.published==`boolean`&&Number.isInteger(n.revision)&&n.revision>=0&&zV.set(t,BV(zV.get(t),n))}catch{}return zV}function HV(e){let t=VV();for(let n of e){let e=t.get(n.digest);(n.revoked||n.published||e)&&t.set(n.digest,BV(e,n))}try{globalThis.localStorage?.setItem(RV,JSON.stringify(Object.fromEntries(t)))}catch{}}var UV=()=>Object.assign(Error(`This exact Block version has been quarantined by StillMade. Use a reviewed replacement.`),{code:`BLOCK_REVOKED`});async function WV(e,{signal:t}={}){let n=await LV(e),r=VV();if(t?.aborted)throw Object.assign(Error(`Cancelled`),{code:`CANCELLED`});let i=new AbortController,a=()=>i.abort();t?.addEventListener(`abort`,a,{once:!0});let o=setTimeout(a,3e3),s;try{let e=await fetch(`/api/blocks/runtime-policy`,{method:`POST`,credentials:`omit`,cache:`no-store`,headers:{"Content-Type":`application/json`},body:JSON.stringify({digests:n}),signal:i.signal});if(!e.ok)throw Error(`Block security check unavailable`);if(s=await e.json(),!Array.isArray(s.digests)||s.digests.length!==n.length||new Set(s.digests.map(e=>e.digest)).size!==n.length||s.digests.some(e=>!n.includes(e.digest)||typeof e.revoked!=`boolean`||typeof e.published!=`boolean`||!Number.isInteger(e.revision)||e.revision<0))throw Error(`Invalid security response`);HV(s.digests)}catch{if(t?.aborted)throw Object.assign(Error(`Cancelled`),{code:`CANCELLED`});if(n.some(e=>r.get(e)?.revoked))throw UV();if(n.some(e=>r.get(e)?.published))throw Object.assign(Error(`Reconnect to check the safety of this published Block before running it.`),{code:`REVOCATION_UNAVAILABLE`});return{checked:!1}}finally{clearTimeout(o),t?.removeEventListener(`abort`,a)}if(n.some(e=>VV().get(e)?.revoked))throw UV();return{checked:!0}}var GV=c({loadViewAssets:()=>KV});async function KV(e,{signal:t}={}){let n={};for(let[r,i]of Object.entries(e?.files||{})){let a=await fetch(`/__dev/files/`+i.sha256,{signal:t});if(!a.ok)throw Error(r+` is missing from the Block folder.`);let o=await ZB(e,r,new Uint8Array(await a.arrayBuffer()));n[r]={mediaType:i.mediaType,base64:qV(o)}}return n}var qV,JV=o((()=>{QB(),qV=e=>{let t=``;for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)}}));T();var Q=u(f(),1);xt();var $=af();Cr();var YV=`stillmade.block.view.v1`,XV=()=>globalThis.crypto.randomUUID(),ZV=`*{box-sizing:border-box}html{container:stillmade-view/inline-size;overflow-wrap:anywhere}body{min-width:0;margin:0;padding:max(16px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) max(16px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left));overflow-x:hidden;background:var(--bg);color:var(--fg);font:16px/1.5 var(--font-body)}h1,h2{font:200 italic clamp(26px,8cqi,32px)/1.1 var(--font-display);letter-spacing:var(--tr-display)}button,input,textarea,select,summary{font:inherit;color:inherit;max-width:100%}button,input,textarea,select{min-height:44px;border:1px solid var(--border-tok);border-radius:var(--r-3);padding:10px 14px;background:transparent}summary{display:flex;align-items:center;min-height:44px;cursor:pointer}button{min-width:44px;cursor:pointer;border-radius:var(--r-pill);background:var(--fg);color:var(--bg)}button:disabled{opacity:.5;cursor:default}textarea{display:block;width:100%;min-height:120px}img,video,canvas{max-width:100%}:focus-visible{outline:2px solid var(--signal);outline-offset:3px}@container stillmade-view (max-width:360px){body{padding:12px}button,input,textarea,select{font-size:16px}}`,QV=`*{box-sizing:border-box}html{overflow-wrap:anywhere}body{min-width:0;margin:0;padding:16px;overflow-x:hidden;background:var(--bg);color:var(--fg);font:16px/1.5 var(--font-body)}`,$V=e=>JSON.stringify(e).replace(/</g,`\\u003c`).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`);function eH(e){if(ut(e),new TextEncoder().encode(JSON.stringify(e)).length>$B.messageBytes)throw Error(`Preview data exceeds 4 MiB`);return structuredClone(e)}var tH=e=>mt(e)&&[`image`,`video`,`audio`].includes(e.kind)&&[`assetId`,`versionId`,`url`].every(t=>typeof e[t]==`string`&&e[t])?dt([e.kind,e.assetId,e.versionId,e.url]):``;function nH(e){let t=(0,Q.useRef)({has:!1,original:null,signature:null,value:null});if(t.current.has&&Object.is(t.current.original,e))return t.current.value;let n=e===void 0?`undefined`:dt(e);return t.current.signature===n?t.current.original=e:t.current={has:!0,original:e,signature:n,value:e},t.current.value}function rH(e,t=[]){return Array.isArray(e)?(e.forEach(e=>rH(e,t)),t):mt(e)?tH(e)?(t.push(e),t):(Object.values(e).forEach(e=>rH(e,t)),t):t}var iH=e=>Array.isArray(e)?e.length>0&&e.every(iH):!!tH(e);function aH(e,t,n){if(!mt(e)||!Object.values(e).length||!Object.values(e).every(iH))throw Error(`Only complete saved media references can be chosen as outputs.`);let r=new Set(rH(t).map(tH));for(let t of rH(e))if(!r.has(tH(t))&&!n?.authorizesMedia(t))throw Error(`Choose media supplied by this workspace or recorded in this session.`);return eH(e)}function oH(e){let t=eH(e);if(!mt(t)||!pt(t,`image`))throw Error(`Choose a valid image supplied by this workspace.`);if(t.role!==void 0&&(typeof t.role!=`string`||!/^[a-z][a-z0-9_]{0,79}$/.test(t.role)))throw Error(`This image has an invalid semantic role.`);if(!Array.isArray(t.data)&&!([`assetId`,`versionId`,`url`].every(e=>typeof t[e]==`string`&&t[e].length>0)&&t.assetId.length<=512&&t.versionId.length<=512&&t.url.length<=32768))throw Error(`Keep the complete image reference supplied by this workspace.`);return t}function sH(e){let t=eH(e);if(!(mt(t)&&Object.keys(t).length===3&&[`url`,`width`,`height`].every(e=>Object.hasOwn(t,e))&&[`width`,`height`].every(e=>Number.isInteger(t[e])&&t[e]>0&&t[e]<=$B.imagePreviewEdge))||typeof t.url!=`string`||!/^data:image\/png;base64,[A-Za-z0-9+/]+={0,2}$/.test(t.url))throw Error(`The host returned an invalid image preview.`);let n=t.url.slice(22);if(n.length%4!=0)throw Error(`The host returned an invalid image preview.`);let r=atob(n.slice(0,44)),i=e=>r.charCodeAt(e),a=e=>i(e)*16777216+i(e+1)*65536+i(e+2)*256+i(e+3);if(r.length<33||![137,80,78,71,13,10,26,10].every((e,t)=>i(t)===e)||a(8)!==13||r.slice(12,16)!==`IHDR`||a(16)!==t.width||a(20)!==t.height)throw Error(`The host returned an invalid image preview.`);return t}function cH(e,t,n=`light`,r=`package`,i=!1,a=[],o=null,s=!1,c=!1,{assets:l={}}={}){lV(e);let u=gV(e),d=r===`package`?e.appearance??`host`:r;d!==`original`&&!u&&EV(e,{appearance:`host`});let f=(d===`original`?e.css??``:e.themedCss??e.css??``)+`
1721
- `+(u?``:OV),p=globalThis.crypto.randomUUID().replaceAll(`-`,``),m=`__sm_view_${p}`,h=`__sm_guard_${globalThis.crypto.randomUUID().replaceAll(`-`,``)}`,g=`(()=>{"use strict";document.currentScript.remove();const session=${$V(t)},channel=${$V(YV)},send=parent.postMessage.bind(parent);let input={},ready=false,inputRevision=0,editRevision=0,sequence=0,pending=null,pendingAdopt=null,adoptSequence=0,pendingImage=null,imageSequence=0,pendingDesktop=null,desktopSequence=0;const mediaURLs=new Set();const clearMedia=()=>{for(const url of mediaURLs)URL.revokeObjectURL(url);mediaURLs.clear()};const listeners=new Set();let calls=0,started=0;const now=performance.now.bind(performance),resetTask=setTimeout.bind(globalThis);${u?`for(const meta of document.querySelectorAll("meta[http-equiv]"))meta.remove();const frameRuntime=(${bV.toString()})(channel,session,send,${$V({guardName:h,taskMs:dV.taskMs,assets:l})});`:`Object.defineProperty(globalThis,${$V(m)},{configurable:true,value:()=>{if(calls===0){started=now();resetTask(()=>{calls=0},0)}if(++calls>10000||now()-started>50)throw Error("Interface is doing too much work. Move processing into the Block runtime.")}});addEventListener("message",event=>{if(event.isTrusted&&event.source===parent)calls=0},true);`}let controlEffects=0;let assisted=false,trackedCalls=new Set(),trackedFailure=null,controlOffset=0;const track=promise=>{if(assisted){trackedCalls.add(promise);promise.then(()=>trackedCalls.delete(promise),error=>{trackedFailure=error;trackedCalls.delete(promise)})}return promise};const controlSnapshot=(offset=controlOffset,automatic=true)=>{try{let snapshot;try{snapshot=dynamicUI.inspectControls({offset})}catch(error){if(!automatic||error.message!=="Choose a current control page"||!Number.isSafeInteger(offset)||offset<0)throw error;snapshot=dynamicUI.inspectControls({offset:0});}controlOffset=snapshot.offset;send({channel,session,op:"view-controls",snapshot},"*")}catch(error){send({channel,session,op:"view-controls-error",error:String(error.message).slice(0,1000)},"*")}};const dynamicUI=(${qn.toString()})(document,error=>send({channel,session,op:"interface-error",error},"*"),()=>Promise.resolve().then(controlSnapshot));const sharedLifecycle={};const sharedAPI=(${Kn.toString()})(channel,session,${$V(Wn)},sharedLifecycle);const textControls=${i?`(()=>{${In};return StillMadeTextFrame.installTextFrame(document,sharedAPI,error=>send({channel,session,op:"interface-error",error},"*"),channel,session,{token:${$V(o)},send});})()`:`null`};const sharedControls=(${Fn.toString()})(document,sharedAPI,error=>send({channel,session,op:"interface-error",error},"*"),textControls,${$V(a)});const {documentTools,sharedDocuments}=(${Ln})(sharedAPI,status=>send({channel,session,op:"document-store-status",status},"*"));const previews=(${Tt.toString()})((kind,value)=>{if(kind==="media"){if(mediaURLs.size>=2)throw Error("Release a previous media preview before opening another");if(!["video","audio"].includes(value.kind))throw Error("Choose an audio or video reference");}return new Promise((resolve,reject)=>{const id=String(++imageSequence);pendingImage={id,resolve,reject,media:kind==="media"};send({channel,session,op:kind==="media"?"preview-media":"preview-image",id,value},"*")})});const connectionAPI=(${wt.toString()})(${$V(YV)},${$V(t)},${c},send),workAPI=(${C.toString()})(${$V(YV)},${$V(t)},${s},send);const api=Object.freeze({...connectionAPI,...workAPI,${u?`asset:frameRuntime.asset,assetBytes:frameRuntime.assetBytes,`:``}connectedApp(...args){controlEffects++;return track(connectionAPI.connectedApp(...args))},sharedWork(...args){controlEffects++;return track(workAPI.sharedWork(...args))},previewSharedWorkMedia(...args){controlEffects++;return track(workAPI.previewSharedWorkMedia(...args))},schemaFields:(${Jn.toString()})(${JSON.stringify(a)}),...sharedAPI,...documentTools,connectDocument:sharedDocuments.connectDocument,bindShared:sharedControls.bindShared,setSharedDefaults:sharedControls.setSharedDefaults,scheduleSharedEdit:sharedControls.scheduleSharedEdit,render:dynamicUI.render,onAction:dynamicUI.onAction,releaseMedia(url){if(mediaURLs.delete(url))URL.revokeObjectURL(url)},previewMedia(value){if(!ready)return Promise.reject(Error("Preview is loading"));return track(previews.request("media",value))},desktop(operation,args={}){controlEffects++;if(!ready)return Promise.reject(Error("Preview is loading"));if(pendingDesktop)return Promise.reject(Error("A desktop request is already pending"));if(typeof operation!=="string"||JSON.stringify(args).length>131072)return Promise.reject(Error("Invalid desktop request"));return track(new Promise((resolve,reject)=>{const id=String(++desktopSequence);pendingDesktop={id,resolve,reject};send({channel,session,op:"desktop",id,operation,args},"*")}))},get input(){return structuredClone(input)},onInput(fn){if(typeof fn!=="function")throw Error("Expected a function");listeners.add(fn);if(ready)fn(structuredClone(input));return()=>listeners.delete(fn)},useOutput(values){controlEffects++;if(!ready)return Promise.reject(Error("Preview is loading"));if(pendingAdopt)return Promise.reject(Error("An output choice is already pending"));let serialized;try{serialized=JSON.stringify(values);if(!values||Array.isArray(values)||typeof values!=="object"||serialized.length>4194304)throw Error("Expected bounded output values")}catch(error){return Promise.reject(error)}return track(new Promise((resolve,reject)=>{const id=String(++adoptSequence);pendingAdopt={id,resolve,reject};send({channel,session,op:"use-output",id,outputs:values},"*")}))},previewImage(value){if(!ready)return Promise.reject(Error("Preview is loading"));return track(previews.request("image",value))},run(values){controlEffects++;if(!ready)return Promise.reject(Error("Preview is loading"));if(pending)return Promise.reject(Error("A run is already in progress"));try{dynamicUI.assertCommitted();sharedControls.assertNoComposition();}catch(error){return Promise.reject(error);}let serialized;try{serialized=JSON.stringify(values);if(!values||Array.isArray(values)||typeof values!=="object"||serialized.length>4194304)throw Error("Expected bounded input values")}catch(error){return Promise.reject(error)}return track(new Promise((resolve,reject)=>{const id=String(++sequence),requested=JSON.parse(serialized),sourceRevision=inputRevision,localRevision=editRevision,call={id,resolve,reject,sent:false};pending=call;Promise.resolve().then(()=>dynamicUI.flushAll()).then(()=>sharedControls.flushAll()).then(()=>sharedDocuments.flushAll()).then(()=>sharedLifecycle.flushSharedWrites()).then(()=>{dynamicUI.assertCommitted();sharedControls.assertNoComposition();if(pending!==call||!ready)throw Error("Preview was closed before its edits were saved.");if(inputRevision!==sourceRevision||editRevision!==localRevision)throw Error("The input changed while edits were saving. Review it before running again.");const savedText=textControls?.getValues?.()||{};for(const [key,value] of Object.entries(savedText)){const captured=typeof requested[key]==="string"?requested[key]:typeof requested[key]?.text==="string"?requested[key].text:null;if(captured!==null&&captured!==value)throw Error("The input changed while shared text was saving. Review it before running again.");}if(!sharedAPI.getShared().canEdit)throw Error("Shared editing is unavailable or read only.");call.sent=true;send({channel,session,op:"run",id,input:requested},"*");}).catch(error=>{if(pending===call){pending=null;call.reject(error);}});}))}});Object.defineProperty(globalThis,"StillMade",{value:api,writable:false,configurable:false});addEventListener("message",event=>{if(event.source!==parent||!event.data||event.data.channel!==channel||event.data.session!==session)return;const data=event.data;if(data.op==="inspect-view-controls"){controlSnapshot(data.offset,false);return;}if(data.op==="dispatch-named-text"&&typeof data.id==="string"){Promise.resolve().then(()=>textControls.dispatchNative(data.control,data.id)).then(()=>send({channel,session,op:"named-text-result",token:${$V(o)},id:data.id},"*"),error=>send({channel,session,op:"named-text-result",token:${$V(o)},id:data.id,error:String(error.message).slice(0,1000)},"*")).finally(()=>send({channel,session,op:"named-text-controls",token:${$V(o)},snapshot:textControls.inspectNative()},"*"));return;}if(data.op==="inspect-named-text"){if(textControls)send({channel,session,op:"named-text-controls",token:${$V(o)},snapshot:textControls.inspectNative()},"*");return;}if(data.op==="dispatch-view-control"&&typeof data.id==="string"){if(assisted){send({channel,session,op:"view-control-result",id:data.id,error:"A declared control is already running"},"*");return;}assisted=true;trackedFailure=null;const controlDocumentSeal=sharedDocuments.captureControlSettlement(),controlSharedSeal=sharedLifecycle.captureControlState(),controlInputRevision=inputRevision,controlEffectRevision=controlEffects;const personalControlUnchanged=()=>controlDocumentSeal&&inputRevision===controlInputRevision&&controlEffects===controlEffectRevision&&JSON.stringify(sharedLifecycle.captureControlState())===JSON.stringify(controlSharedSeal)&&!controlSharedSeal.closed&&controlSharedSeal.ready&&!controlSharedSeal.pending&&!controlSharedSeal.queued&&!controlSharedSeal.failed&&sharedDocuments.unchangedControlSettlement(controlDocumentSeal);dynamicUI.dispatchControl(data.control,async()=>{for(let round=0;round<16;round++){await Promise.allSettled(Array.from(trackedCalls));await dynamicUI.flushAll();await sharedControls.flushAll();if(personalControlUnchanged())await sharedDocuments.settleControl(controlDocumentSeal);else await sharedDocuments.flushAll();await sharedLifecycle.flushSharedWrites();await new Promise(resolve=>setTimeout(resolve,0));if(trackedFailure)throw trackedFailure;if(!trackedCalls.size){if(controlDocumentSeal&&!personalControlUnchanged())await sharedDocuments.flushAll();dynamicUI.assertCommitted();sharedControls.assertNoComposition();return;}}throw Error("Declared action did not settle");}).then(()=>send({channel,session,op:"view-control-result",id:data.id},"*"),error=>send({channel,session,op:"view-control-result",id:data.id,error:String(error?.message||"Declared action failed").slice(0,1000)},"*")).finally(()=>{assisted=false;controlSnapshot()});return;}if(data.op==="flush-shared"&&typeof data.id==="string"){Promise.resolve().then(()=>dynamicUI.flushAll()).then(()=>sharedControls.flushAll()).then(()=>sharedDocuments.flushAll()).then(()=>sharedLifecycle.flushSharedWrites()).then(()=>dynamicUI.flushAll()).then(()=>sharedControls.assertNoComposition()).then(()=>send({channel,session,op:"flush-shared-result",id:data.id},"*"),error=>send({channel,session,op:"flush-shared-result",id:data.id,error:String(error?.message||"Pending edits could not be confirmed").slice(0,1000)},"*"));return;}if(data.op==="desktop-result"&&pendingDesktop&&data.id===pendingDesktop.id){const call=pendingDesktop;pendingDesktop=null;data.error?call.reject(Error(data.error)):call.resolve(data.result)}else if(data.op==="use-output-result"&&pendingAdopt&&data.id===pendingAdopt.id){const call=pendingAdopt;pendingAdopt=null;data.error?call.reject(Error(data.error)):call.resolve(data.outputs)}else if(data.op==="input"){inputRevision+=1;if(pending&&!pending.sent){pending.reject(Error("Preview input changed before its edits were saved."));pending=null;}clearMedia();previews.reset();if(pendingImage)pendingImage.reject(Error("Preview input changed"));pendingImage=null;if(pendingAdopt)pendingAdopt.reject(Error("Preview input changed"));pendingAdopt=null;input=data.input;ready=true;for(const fn of listeners)try{fn(structuredClone(input))}catch(error){send({channel,session,op:"interface-error",error:String(error?.message||"The Block interface could not display its input").slice(0,1000)},"*")}}else if(data.op==="result"&&pending?.sent&&data.id===pending.id){const call=pending;pending=null;data.error?call.reject(Error(data.error)):call.resolve(data.outputs)}else if(data.op==="preview-media-result"&&pendingImage?.media&&data.id===pendingImage.id){const call=pendingImage;pendingImage=null;if(data.error)call.reject(Error(data.error));else{try{const url=URL.createObjectURL(data.preview.blob);mediaURLs.add(url);call.resolve({kind:data.preview.kind,url,mimeType:data.preview.blob.type,bytes:data.preview.blob.size})}catch(error){call.reject(error)}}}else if(data.op==="preview-image-result"&&pendingImage&&data.id===pendingImage.id){const call=pendingImage;pendingImage=null;data.error?call.reject(Error(data.error)):call.resolve(data.preview)}else if(data.op==="dispose"){clearMedia();previews.reset("Preview was reset");dynamicUI.dispose();sharedControls.dispose();textControls?.dispose();sharedDocuments.dispose();if(pendingDesktop)pendingDesktop.reject(Error("Block was closed"));pendingDesktop=null;if(pendingAdopt)pendingAdopt.reject(Error("Preview was reset"));pendingAdopt=null;if(pendingImage)pendingImage.reject(Error("Preview was reset"));pendingImage=null;if(pending)pending.reject(Error("Preview was reset"));pending=null;listeners.clear();ready=false}});addEventListener("input",()=>{editRevision+=1;},true);addEventListener("change",()=>{editRevision+=1;},true);addEventListener("compositionstart",()=>{editRevision+=1;},true);addEventListener("keydown",event=>{if(event.key==="Escape")send({channel,session,op:"escape"},"*")},true);addEventListener("click",event=>{if(event.target.closest?.("a,area"))event.preventDefault()},true);send({channel,session,op:"ready"},"*");})();`,_=u?`document.currentScript.remove();for(const node of document.querySelectorAll("[data-stillmade-share]")){if(!node.id||document.getElementById(node.id)!==node)throw Error("Each shared control needs a unique ID");StillMade.bindShared(node.getAttribute("data-stillmade-share"),node.id)}\n${yV(e.javascript||``,h)}`.replace(/<\/script/gi,`<\\/script`):`document.currentScript.remove();((${m})=>{"use strict";delete globalThis[${$V(m)}];for(const node of document.querySelectorAll("[data-stillmade-share]")){if(!node.id||document.getElementById(node.id)!==node)throw Error("Each shared control needs a unique ID");StillMade.bindShared(node.getAttribute("data-stillmade-share"),node.id)}\n${uV(e.javascript||``,m)}\n})(globalThis[${$V(m)}]);`.replace(/<\/script/gi,`<\\/script`);return`<!doctype html><html data-mode="${[`dark`,`white`].includes(n)?n:`light`}"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover"><meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'nonce-${p}'; style-src 'unsafe-inline'; img-src data: blob:; media-src data: blob:;${u?` font-src data: blob:;`:``} connect-src 'none'; frame-src 'none'; worker-src ${u?`blob:`:`'none'`}; object-src 'none'; base-uri 'none'; form-action 'none';"><meta name="referrer" content="no-referrer"><style>${DV.replace(/@font-face\s*\{[^}]*\}/g,``)}${u?QV:ZV}${kV}${(f||``).replace(/<\/style/gi,`<\\/style`)}@media(pointer:coarse){input,textarea,select{font-size:16px!important}}</style></head><body>${e.html}<script nonce="${p}">${g.replace(/<\/script/gi,`<\\/script`)}<\/script><script nonce="${p}">document.currentScript.remove();(${NV.toString()})(${$V(YV)},${$V(t)});(${PV.toString()})(${$V(YV)},${$V(t)});(${MV.toString()})(${$V(YV)},${$V(t)},((validateCursorAnchor)=>(${jV.toString()}))(${AV.toString()}));<\/script><script nonce="${p}">${_}<\/script></body></html>`}function lH({view:e,input:t={},sharedView:n=null,presenceKey:r=null,peers:i=[],actorId:a=null,onSharedChange:o,sharedText:s=null,sharedWork:c=null,connectedApp:l=null,onRun:u,onUseOutput:d,onPreviewImage:f,onPreviewMedia:p,onError:m,policyContent:h,policyParent:g,currentAppViewPolicy:_=null,title:v=`Block preview`,height:y=480,fitContent:C=!1,resetKey:w=0,theme:T,appearance:E=`package`,lockedInputKeys:D=[],agentContext:O=null}){let k=nH(e),A=nH(h),j=nH(g),M=[`comfyui`,`capability`].includes(A?.manifest?.runtime)||!!A?.manifest?.desktopTools?.length,N=A?.capability?.operation===`image.generate`?9e5:36e4,P=(0,Q.useRef)(null),F=(0,Q.useRef)({onSharedChange:o,onRun:u,onUseOutput:d,onPreviewImage:f,onPreviewMedia:p,onError:m}),I=(0,Q.useRef)(t),[ee,te]=(0,Q.useState)(``),[ne,re]=(0,Q.useState)(0),ie=(0,Q.useRef)(null),ae=(0,Q.useRef)(null),[oe,se]=(0,Q.useState)(null),[ce,le]=(0,Q.useState)(null),[ue,de]=(0,Q.useState)(null),[fe,pe]=(0,Q.useState)(null),[me,he]=(0,Q.useState)(()=>globalThis.document?.documentElement?.dataset.mode||`light`),ge=(0,Q.useRef)(`light`);ge.current=[`dark`,`white`].includes(T||me)?T||me:`light`;let _e=(0,Q.useRef)(l);_e.current=l;let ve=(0,Q.useRef)(c);ve.current=c;let ye=(0,Q.useRef)(s);ye.current=s;let be=(0,Q.useRef)(!1),[xe,Se]=(0,Q.useState)(()=>({enabled:!!s,projectId:s?.projectId??null,placementId:s?.placementId??null})),Ce=()=>{let e={enabled:!!ye.current,projectId:ye.current?.projectId??null,placementId:ye.current?.placementId??null};Se(t=>t.enabled===e.enabled&&t.projectId===e.projectId&&t.placementId===e.placementId?t:e)};(0,Q.useEffect)(()=>{be.current||Ce()},[!!s,s?.projectId,s?.placementId]);let we=xe.enabled,Te=xe.projectId,Ee=xe.placementId,De=!!fe?.count&&!!(fe.dirty||fe.pending||fe.error);(0,Q.useEffect)(()=>{let e=globalThis.document.documentElement,t=new MutationObserver(()=>he(e.dataset.mode||`light`));return t.observe(e,{attributes:!0,attributeFilter:[`data-mode`]}),()=>t.disconnect()},[]);let Oe=(0,Q.useMemo)(()=>{try{let e=eH(t);return{value:e,signature:dt(e)}}catch(e){return{error:e.message}}},[t]);F.current={onSharedChange:o,onRun:u,onUseOutput:d,onPreviewImage:f,onPreviewMedia:p,onError:m},I.current=Oe;let[ke,Ae]=(0,Q.useState)(null),je=_?ke?.handle===_&&ke.allowed:!A||ke?.content===A&&ke.parent===j&&ke.allowed;(0,Q.useEffect)(()=>{if(!A&&!_)return;let e=!0,t=new AbortController;return Ae(null),(_?x(_,{signal:t.signal}):Promise.all([A,...j?[j]:[]].map(e=>WV(e,{signal:t.signal})))).then(()=>{e&&Ae({handle:_,content:A,parent:j,allowed:!0})},t=>{e&&(Ae({handle:_,content:A,parent:j,allowed:!1,error:t.message}),F.current.onError?.(t))}),()=>{e=!1,t.abort()}},[A,j,_,ne]);let Me=gV(k)&&k.files?k.files:null,[Ne,Pe]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{if(!Me||!je){Pe(null);return}let e=!0,t=new AbortController;return Pe(null),Promise.resolve().then(()=>(lV(k),Sr(()=>Promise.resolve().then(()=>(JV(),GV)),void 0))).then(({loadViewAssets:e})=>e(Me,{signal:t.signal})).then(t=>{e&&Pe({files:Me,assets:t})},t=>{e&&Pe({files:Me,error:String(t?.message||`The interface files could not be loaded.`)})}),()=>{e=!1,t.abort()}},[k,Me,je]);let Fe=Me?Ne?.files===Me?Ne:{loading:!0}:null,Ie=JSON.stringify([...new Set(D.filter(e=>typeof e==`string`))].sort()),Le=[k,Fe,w,E,ne,a,r,M,N,C,we,Te,Ee,Ie,!!A?.manifest?.sharedWork,A?.capability?.operation],Re=(0,Q.useRef)(null);if(!Re.current||Le.some((e,t)=>!Object.is(e,Re.current.inputs[t]))){let e;try{if(Fe?.loading)throw Object.assign(Error(`Loading the interface files.`),{loading:!0});if(Fe?.error)throw Error(Fe.error);let t=XV(),n=XV();e={session:t,nativeTextToken:n,html:cH(k,t,ge.current,E,we,JSON.parse(Ie),n,!!A?.manifest?.sharedWork,A?.capability?.operation===`connection.execute`,{assets:Fe?.assets||{}})}}catch(t){e=t.loading?{loading:!0}:{error:t.message}}Re.current={inputs:Le,document:e}}let ze=Re.current.document,Be=(0,Q.useMemo)(()=>({state:{},outputs:{},memory:null,canEdit:!0,localOnly:!0}),[ze.session]),Ve=(0,Q.useRef)(n);Ve.current=n??Be;let He=(0,Q.useRef)(n==null);He.current=n==null;let Ue=(0,Q.useRef)({session:null,count:0}),We=(0,Q.useRef)(null),Ge=(0,Q.useRef)(null),Ke=(0,Q.useRef)(null),qe=(0,Q.useRef)(null),Je=(0,Q.useRef)(null);qe.current={key:r,peers:i,actorId:a};let Ye=(0,Q.useRef)(null),Xe=(0,Q.useRef)(null);Xe.current={input:Oe.signature,error:Oe.error,view:k,policyContent:A,policyParent:j,resetKey:w,appearance:E,policyReady:je};let Ze=(0,Q.useRef)(null);Ze.current=dt([O?.projectId,O?.placementId,O?.sourceDigest,a].map(e=>e??null));let[Qe,$e]=(0,Q.useState)(null),et=dt([Et(),a,Ze.current,ze.session,Oe.signature,je].map(e=>e??null));(0,Q.useEffect)(()=>{let e=!0;if($e(null),!O?.projectId||!O?.placementId||!O?.sourceDigest||Oe.error||!je||a!==Et())return()=>{e=!1};let t=et;return ft(Oe.value).then(n=>{e&&$e({basis:t,value:{version:1,actorId:a,projectId:O.projectId,placementId:O.placementId,sourceDigest:O.sourceDigest,inputDigest:n}})},()=>{e&&$e(null)}),()=>{e=!1}},[et]),Qe?.basis===et&&Qe.value;let[tt,nt]=(0,Q.useState)(null),rt=(0,Q.useRef)(null),it=(0,Q.useRef)(null),[at,ot]=(0,Q.useState)(null),[st,ct]=(0,Q.useState)(!1),[lt,ut]=(0,Q.useState)(!1),[pt,L]=(0,Q.useState)(null);pt&&pt.actor===a&&pt.runtimeActor===Et()&&pt.identity===Ze.current&&pt.session===ze.session&&Object.keys(pt.authority).every(e=>pt.authority[e]===Xe.current[e])&&pt.evidence,{...O},A?.manifest?.id,A?.manifest?.version,ze.session,Oe.signature,Ve.current?.canEdit,{...O},ze.session,Oe.signature,Ve.current?.canEdit,(0,Q.useEffect)(()=>{if(nt(null),ot(null),ut(!1),ct(!1),L(null),te(``),le(null),de(null),pe(null),ze.error||ze.loading||!je)return;let e=!0,t=!1,n=!1,i=null,o=null,s=null,c=0,l=0,u=[],d=[],f=0,p=0,m,h=0,g=null,_=[],v=0,y=null,b=0,x=0,w=null,T=gV(k),E=()=>{let t;return t=bR(A,{onStatus:n=>{e&&m===t&&se(n)},storageScope:`${a||`anonymous`}:${r||`preview`}`}),t};m=E(),ie.current=m,se(null);let D=()=>{if(!e||!Ve.current?.canEdit)return;let t=m;m=E(),ie.current=m,g=null,se(null),Promise.resolve(t.close()).catch(()=>{})};ae.current=D;let O=t=>{e&&P.current?.contentWindow?.postMessage({channel:YV,session:ze.session,...t},`*`)},j=null,ee=null,ne=0,re=!1,oe=a,ce=Xe.current,ue=Ze.current,fe=(t,n)=>{if(!e||re||t?.signal?.aborted||Et()!==oe||Ze.current!==ue||ee&&I.current.signature!==ee.inputIdentity||j&&I.current.signature!==j.inputIdentity&&I.current.signature!==n||Object.keys(ce).filter(e=>e!==`input`).some(e=>ce[e]!==Xe.current[e]))throw re=!0,ut(!1),Error(`The declared interface source, account or task changed. Reload the preview before further assisted edits.`)},me=e=>{if(!j)return;let t=j;j=null,clearTimeout(t.timer),t.context?.signal?.removeEventListener(`abort`,t.abort),ct(!1),t.reject(e)};it.current={request:(e,n,r={})=>new Promise((a,o)=>{try{if(fe(r),!t||j)throw Error(`The declared interface is loading or busy.`);if(e===`dispatch-view-control`&&!r.taskFence)throw Error(`The declared interface requires its active project task.`);let s=String(++ne),c=()=>{re=!0,ut(!1),i?.abort(),me(Error(`Declared action stopped; reload the preview before more assisted edits.`))},l=setTimeout(c,N);j={id:s,op:e,inputIdentity:I.current.signature,offset:n.offset,context:r,resolve:a,reject:o,timer:l,abort:c},r.signal?.addEventListener(`abort`,c,{once:!0}),e===`dispatch-view-control`&&ct(!0),O({op:e,id:s,...n})}catch(e){o(e)}})},rt.current={request:(e,n)=>new Promise((r,i)=>{try{if(fe(n),!t||j||ee||!n.taskFence||n.signal?.aborted)throw Error(`The original text requires its idle current task.`);let a=String(++ne),o=()=>{re=!0,ut(!1),ee?.id===a&&(ee=null,ct(!1),i(Error(`Original text stopped; retain its pending request.`)))},s=setTimeout(o,N);ee={id:a,field:e.field,inputIdentity:I.current.signature,context:n,resolve:r,reject:i,timer:s,abort:o},n.signal?.addEventListener(`abort`,o,{once:!0}),ct(!0),O({op:`dispatch-named-text`,id:a,control:e})}catch(e){i(e)}})};let he=()=>{if(re)throw Error(`This previous assisted interface is no longer writable. Reload it to recover.`);return j?.op===`dispatch-view-control`?(fe(j.context),j.context):null},xe=!1,Se=0,De=[],Oe=0,ke=!1,Ae=0,Me=[],Ne=0,Pe=0,Fe=[],Ie=null,Le=!1,Re={projectId:Te,placementId:Ee,actorId:a},Be=()=>e&&ye.current?.projectId===Re.projectId&&ye.current?.placementId===Re.placementId,Ue=e=>({message:String(e?.message||`Shared text failed.`).slice(0,1e3),...typeof e?.code==`string`&&/^[A-Z][A-Z0-9_]{0,79}$/.test(e.code)?{code:e.code}:{}}),Qe=ye.current?.projectId&&a?Rn({projectId:ye.current.projectId,actorId:a,headers:zn,onChange:e=>{if(Be()){if(e.kind===`revoked`){Le=!0,O({op:`shared-view`,value:{...Ve.current,canEdit:!1}});return}[`text`,`document`,`resync`].includes(e.kind)&&(e.scope&&e.scope!==`canvas`||Ie===null&&(Ie=setTimeout(()=>{Ie=null,t&&Be()&&!Le&&O({op:`text-refresh`})},100)))}}}):null,$e=ve.current?.projectId&&a?Rn({projectId:ve.current.projectId,actorId:a,headers:zn,onChange:e=>{t&&[`document`,`resync`,`revoked`,`connection-access`].includes(e.kind)&&(Oe++,O({op:`shared-work-refresh`}))}}):null,et=()=>{t&&O({op:`theme`,mode:ge.current})};Je.current=et;let tt=`[]`,at=()=>{if(!t)return;let{key:e,peers:n,actorId:r}=qe.current,i=!He.current&&e&&localStorage.getItem(`stillmade:show-shared-cursors`)!==`false`?n.filter(t=>t.user_id!==r&&t.selection?.cursor?.visible&&t.selection.cursor.surface===e).slice(0,50).flatMap(e=>{let t=AV(e.selection.cursor.anchor);return t?[{id:String(e.session_id).slice(0,200),label:String(e.label||`Teammate`).slice(0,120),anchor:t}]:[]}):[],a=JSON.stringify(i);a!==tt&&(tt=a,O({op:`peer-cursors`,peers:i}))};Ke.current=at,window.addEventListener(`stillmade:cursor-preferences`,at),window.addEventListener(`storage`,at);let st=e=>{te(e),F.current.onError?.(Error(e))},lt=()=>{e&&(clearInterval(y),w?.disconnect(),st(`This interface stopped responding and was closed. Reload it to try again.`),e=!1,i?.abort(),P.current&&(P.current.src=`about:blank`))};We.current=T?()=>{e&&(clearInterval(y),st(`This interface tried to leave its frame and was closed. Reload it to try again.`),e=!1,i?.abort(),P.current&&(P.current.src=`about:blank`))}:null;let ft=()=>{if(typeof PerformanceObserver!=`function`||!PerformanceObserver.supportedEntryTypes?.includes(`longtask`))return;let e=[],t=e=>Array.from(e.attribution||[]).some(e=>e.containerType===`iframe`&&typeof e.containerSrc==`string`&&e.containerSrc.endsWith(`#${ze.session}`));w=new PerformanceObserver(n=>{for(let r of n.getEntries()){if(!t(r))continue;let n=r.startTime+r.duration;if(e=e.filter(e=>e.end>n-5e3),e.push({end:n,duration:r.duration}),r.duration>=dV.longTaskMs||e.reduce((e,t)=>e+t.duration,0)>=3500)return lt()}});try{w.observe({type:`longtask`})}catch{w=null}},pt=()=>{b=Date.now(),y=setInterval(()=>{if(!e)return clearInterval(y);if(globalThis.document.visibilityState!==`hidden`&&Date.now()-b>8e3)return lt();O({op:`ping`,id:String(++x)})},2e3)},ht=setTimeout(()=>{e&&!t&&(st(`The preview could not start. Reload it to try again.`),e=!1,i?.abort(),P.current&&(P.current.src=`about:blank`))},15e3),gt=e=>{let t=o;t&&(L(null),o=null,t.controller.abort(),e&&O({op:t.media?`preview-media-result`:`preview-image-result`,id:t.id,error:e}))},_t=()=>{if(!t)return;let e=I.current;if(e.error){gt(`Preview input is unavailable.`),st(e.error);return}s!==e.signature&&(gt(`Preview input changed. Use its current image.`),s=e.signature,O({op:`input`,input:e.value}))};Ye.current=_t;let vt=null,yt=!1,bt=0,xt=[],St=null,wt=0,Tt=null,Dt=Pn(()=>{if(He.current||!t)return Promise.resolve();if(!e)return Promise.reject(Error(`The Block interface is unavailable. Its latest edits could not be checked.`));if(St)return St.promise;let n=String(++wt),r,i,a=new Promise((e,t)=>{r=e,i=t}),o=setTimeout(()=>{St?.id===n&&(St=null,i(Error(`The Block did not confirm its pending edits. Stay here to recover the draft.`)))},17e3);return St={id:n,promise:a,resolve:r,reject:i,timer:o},O({op:`flush-shared`,id:n}),a}),Ot=()=>{if(t&&Ve.current)try{let e=eH(Ve.current),t=dt(e);if(t===vt)return;vt=t,O({op:`shared-view`,value:e})}catch(e){st(e.message)}};Ge.current=Ot;let kt=t=>{e&&He.current&&(Ve.current.outputs=t,Ot())},At=r=>{let s=r.data;if(T&&e&&mt(s)&&s.op===`navigated`&&s.channel===YV&&s.session===ze.session&&(r.source===null||r.source===P.current?.contentWindow)){We.current?.();return}if(!e||r.source!==P.current?.contentWindow||!mt(s)||s.channel!==YV||s.session!==ze.session)return;if(s.op===`document-ready`){n||(n=!0,O({op:`document`,html:ze.html}));return}if(s.op===`ready`){t||(t=!0,clearTimeout(ht),T&&(pt(),ft()),et(),_t(),Ot(),at(),O({op:`inspect-view-controls`,offset:0}),O({op:`inspect-named-text`}));return}if(s.op===`flush-shared-result`){if(!St||s.id!==St.id)return;let e=St;St=null,clearTimeout(e.timer);let t=s.error||Tt;t?e.reject(Error(String(t).slice(0,1e3))):e.resolve({queued:!0});return}if(s.op===`escape`){let e=Date.now();globalThis.document.activeElement===P.current&&e-v>=300&&(v=e,window.dispatchEvent(new KeyboardEvent(`keydown`,{key:`Escape`,bubbles:!0})));return}if(s.op===`pong`){T&&typeof s.id==`string`&&(b=Date.now());return}if(s.op===`unresponsive`){T&&lt();return}if(s.op===`interface-error`){st(String(s.error||`The Block interface could not display its input`).slice(0,1e3));return}if(s.op===`document-store-status`){let e=s.status;mt(e)&&[`count`,`dirty`,`pending`,`readonly`].every(t=>Number.isInteger(e[t])&&e[t]>=0&&e[t]<=8)&&[`dirty`,`pending`,`readonly`].every(t=>e[t]<=e.count)&&(e.error===null||typeof e.error==`string`&&e.error.length<=1e3)&&de(e);return}if(s.op===`text-recovery-status`){let e=s.status;we&&mt(e)&&Object.keys(e).every(e=>[`count`,`dirty`,`pending`,`readonly`,`error`,`retryable`].includes(e))&&[`count`,`dirty`,`pending`,`readonly`].every(t=>Number.isInteger(e[t])&&e[t]>=0&&e[t]<=100)&&[`dirty`,`pending`,`readonly`].every(t=>e[t]<=e.count)&&(e.error===null||typeof e.error==`string`&&e.error.length<=1e3)&&typeof e.retryable==`boolean`&&pe(e);return}if(!t)return;if(s.op===`named-text-controls`){if(s.token===ze.nativeTextToken&&Array.isArray(s.snapshot)&&s.snapshot.length<=50){let e=eH(s.snapshot);e.every(e=>mt(e)&&typeof e.field==`string`&&typeof e.identity==`string`&&typeof e.value==`string`&&e.value.length<=1e4&&typeof e.partial==`boolean`&&typeof e.ready==`boolean`&&typeof e.disabled==`boolean`)&&nt(e)}return}if(s.op===`named-text-result`){let e=ee;if(!e||s.id!==e.id||s.token!==ze.nativeTextToken)return;try{if(fe(e.context),s.error)throw Error(String(s.error).slice(0,1e3));e.resolve()}catch(t){e.reject(t)}finally{ee=null,clearTimeout(e.timer),e.context.signal?.removeEventListener(`abort`,e.abort),ct(!1)}return}if(s.op===`view-controls`){try{let e=eH(s.snapshot);if(!mt(e)||!Number.isSafeInteger(e.revision)||!Number.isSafeInteger(e.total)||e.total<0||e.total>1e4||!Number.isSafeInteger(e.offset)||!Array.isArray(e.controls)||e.controls.length>20||e.controls.some(e=>!mt(e)||typeof e.id!=`string`||typeof e.identity!=`string`||typeof e.action!=`string`||typeof e.disabled!=`boolean`||typeof e.hidden!=`boolean`))throw Error(`Invalid declared interface controls.`);if(ot(e),ut(!re),j?.op===`inspect-view-controls`&&e.offset===j.offset){let e=j;fe(e.context),j=null,clearTimeout(e.timer),e.context.signal?.removeEventListener(`abort`,e.abort),e.resolve()}}catch(e){me(e)}return}if(s.op===`view-controls-error`){me(Error(String(s.error||`Declared controls are unavailable.`).slice(0,1e3)));return}if(s.op===`view-control-result`){if(j?.op!==`dispatch-view-control`||s.id!==j.id)return;let e=j;try{if(fe(e.context),s.error)throw Error(String(s.error).slice(0,1e3));j=null,clearTimeout(e.timer),e.context.signal?.removeEventListener(`abort`,e.abort),ct(!1),e.resolve()}catch(e){me(e)}return}if(s.op===`connected-app-request`){if(typeof s.id!=`string`||!/^\d{1,9}$/.test(s.id)||Number(s.id)<=Se)return;Se=Number(s.id);let t=e=>O({op:`connected-app-result`,id:s.id,...e}),n=_e.current,r=Xe.current;De=De.filter(e=>Date.now()-e<6e4);try{if(A?.capability?.operation!==`connection.execute`||!n?.request)throw Error(`Open the saved connected Block to choose its task.`);let i=Ct(s.operation,eH(s.args));if(i.operation!==`tasks`&&!Ve.current?.canEdit)throw Error(`This workspace is read only.`);if(xe||De.length>=30)throw Error(`Wait for the current task request.`);xe=!0,De.push(Date.now()),Promise.resolve().then(()=>n.request(i.operation,i.args)).then(i=>{if(!e||n.projectId!==_e.current?.projectId||n.placementId!==_e.current?.placementId||Object.keys(r).some(e=>r[e]!==Xe.current[e]))throw Error(`The installed app changed. Open its current workspace.`);t({result:eH(i)})},e=>t({error:String(e.message||`Task selection failed.`).slice(0,1e3)})).catch(e=>t({error:String(e.message).slice(0,1e3)})).finally(()=>{xe=!1})}catch(e){t({error:String(e.message).slice(0,1e3)})}return}if(s.op===`shared-work-media-request`){if(typeof s.id!=`string`||!/^\d{1,9}$/.test(s.id)||Number(s.id)<=Ae)return;Ae=Number(s.id);let t=ve.current,n=Xe.current,r=Oe,i=e=>O({op:`shared-work-result`,id:s.id,...e});try{if(!A?.manifest?.sharedWork||!A.manifest.permissions?.project?.includes(`work.shared`)||!t?.previewMedia||typeof s.contributionId!=`string`||!/^[0-9a-f-]{36}$/i.test(s.contributionId))throw Error(`Choose a permitted saved creative in this workspace.`);if(Me=Me.filter(e=>Date.now()-e<6e4),ke||Me.length>=60)throw Error(`Wait for the current media preview.`);ke=!0,Me.push(Date.now()),Promise.resolve().then(()=>t.previewMedia(s.contributionId,{signal:AbortSignal.timeout(3e4)})).then(t=>{if(!e||r!==Oe||Object.keys(n).some(e=>n[e]!==Xe.current[e]))throw Error(`This workspace changed before the creative preview.`);if(!(t.media instanceof Blob)||!t.media.size||t.media.size>67108864||![`image`,`video`,`audio`].includes(t.kind)||!t.media.type.startsWith(t.kind+`/`))throw Error(`This preview exceeds the media limit.`);i(t)},e=>i({error:String(e.message||`Media preview failed.`).slice(0,1e3)})).catch(e=>i({error:String(e.message).slice(0,1e3)})).finally(()=>{ke=!1})}catch(e){i({error:String(e.message).slice(0,1e3)})}return}if(s.op===`shared-work-request`){if(typeof s.id!=`string`||!/^\d{1,9}$/.test(s.id)||Number(s.id)<=Ae)return;Ae=Number(s.id);let t=e=>O({op:`shared-work-result`,id:s.id,...e}),n=ve.current,r=Xe.current,i=Oe;Me=Me.filter(e=>Date.now()-e<6e4);try{if(!A?.manifest?.permissions?.project?.includes(`work.shared`)||!A.manifest.sharedWork||!n?.request)throw Error(`Shared work is unavailable in this preview. Open the saved Block in its project.`);let a=S(s.operation,eH(s.args));if(![`read`,`list`,`accounts`,`grants`,`creatives`].includes(a.operation)&&!Ve.current?.canEdit)throw Error(`This workspace is read only.`);if(ke||Me.length>=60)throw Error(`Wait for the current shared-work request.`);ke=!0,Me.push(Date.now()),Promise.resolve().then(()=>n.request(a.operation,a.args)).then(o=>{if(!e||n.projectId!==ve.current?.projectId||n.placementId!==ve.current?.placementId||Object.keys(r).some(e=>r[e]!==Xe.current[e]))throw Error(`This Block changed before the shared-work response. Reopen its current version.`);if(i!==Oe){if([`read`,`list`,`accounts`,`grants`,`creatives`].includes(a.operation))throw Error(`Saved-work access changed. Read its current version.`);t({result:{saved:!0,refreshRequired:!0}});return}t({result:eH(o)})},e=>t({error:String(e.message||`Shared work failed.`).slice(0,1e3)})).catch(e=>t({error:String(e.message).slice(0,1e3)})).finally(()=>{ke=!1})}catch(e){t({error:String(e.message).slice(0,1e3)})}return}if(s.op===`text-request`){if(typeof s.id!=`string`||!/^\d{1,9}$/.test(s.id)||Number(s.id)<=Pe)return;Pe=Number(s.id);let e=e=>O({op:`text-result`,id:s.id,...e}),t=ye.current,n=I.current.signature,r=Xe.current;if(Fe=Fe.filter(e=>Date.now()-e<6e4),!we||!Be()||!t||typeof t.request!=`function`||![`read`,`initialize`,`update`,`reset`].includes(s.action)||typeof s.key!=`string`||!/^[a-zA-Z][a-zA-Z0-9_-]{0,99}$/.test(s.key)||[`constructor`,`prototype`,`__proto__`].includes(s.key)){e({error:{message:`Shared text is unavailable for this field.`}});return}if(Ne>=16||Fe.length>=1200){e({error:{message:`Shared text requests are arriving too quickly. Your draft is retained.`}});return}let i=()=>{if(!Be()||I.current.error||I.current.signature!==n||Object.keys(r).some(e=>r[e]!==Xe.current[e]))throw Error(`Shared text input or workspace changed. Your draft is retained.`);if(Le||s.action!==`read`&&!Ve.current?.canEdit)throw Object.assign(Error(`Shared text is read only.`),{code:`READ_ONLY`})},a;try{if(i(),a=eH(s.body),!mt(a)||new TextEncoder().encode(JSON.stringify(a)).length>5e4||Object.keys(a).some(e=>![`protocol`,`requestId`,`sourceIdentity`,`epoch`,`textRevision`,`value`,`update`].includes(e)))throw Error(`Invalid shared text request.`)}catch(t){e({error:Ue(t)});return}Ne++,Fe.push(Date.now()),Promise.resolve().then(async()=>{if(i(),he()&&s.action!==`read`)throw Error(`Assisted shared-text writes require a task-safe native commit interface; this control is unavailable.`);try{let e=ee,n;if(e&&s.action!==`read`){if(fe(e.context),s.action!==`update`||s.key!==e.field||s.nativeText?.token!==ze.nativeTextToken||s.nativeText?.callId!==e.id)throw Error(`Unrelated text events cannot use this native task.`);n=e.context}else if(s.nativeText)throw Error(`The original text invocation is no longer current; do not replay.`);return await t.request(s.action,{...a,placementId:t.placementId,fieldKey:s.key},n)}catch(e){if(s.action===`read`&&e.code===`SHARED_TEXT_FIELD_UNSUPPORTED`&&typeof Ve.current?.state?.[s.key]!=`string`)return{unsupported:!0};throw e}}).then(t=>{i(),e({result:eH(t)})}).catch(t=>e({error:Ue(t)})).finally(()=>{Ne--});return}if(s.op===`cursor`){let e=s.cursor;if(mt(e)&&Number.isFinite(e.x)&&Number.isFinite(e.y)&&e.x>=0&&e.x<=1&&e.y>=0&&e.y<=1){let t=P.current?.getBoundingClientRect(),n=AV(e.anchor),r=qe.current.key;t&&window.dispatchEvent(new CustomEvent(`stillmade:sandbox-cursor`,{detail:{x:(t.left+e.x*t.width)/Math.max(1,window.innerWidth),y:(t.top+e.y*t.height)/Math.max(1,window.innerHeight),visible:e.visible!==!1,...n&&typeof r==`string`&&r.length>0&&r.length<=200&&!He.current?{anchor:n,surface:r}:{}}}))}return}if(s.op===`shared-view-update`){if(typeof s.id!=`string`||!/^\d{1,9}$/.test(s.id)||Number(s.id)<=bt)return;bt=Number(s.id);let t=e=>{Tt=e.error?String(e.error):null,O({op:`shared-view-result`,id:s.id,...e})};if(xt=xt.filter(e=>Date.now()-e<6e4),yt||xt.length>=240){t({error:`Shared edits are arriving too quickly. Wait and retry.`});return}if(!Ve.current?.canEdit||!He.current&&typeof F.current.onSharedChange!=`function`){t({error:`Shared editing is unavailable or read only.`});return}let n;try{if(n=eH(s.request),new TextEncoder().encode(JSON.stringify(n)).length>Wn.requestBytes)throw Error(`Shared edit exceeds the limit`)}catch(e){t({error:e.message});return}yt=!0,xt.push(Date.now()),Promise.resolve().then(()=>{if(!e||!Ve.current?.canEdit)throw Error(`Shared editing is unavailable or read only.`);if(he(),He.current){Ve.current.state=Gn(Ve.current.state,n),Ot();return}let t=he();return F.current.onSharedChange(n,t||void 0)}).then(()=>t({queued:!0}),e=>t({error:String(e.message).slice(0,1e3)})).finally(()=>{yt=!1});return}if(s.op===`content-size`){C&&Number.isInteger(s.height)&&s.height>0&&s.height<=1e5&&le(Math.max(280,Math.min(3e4,s.height)));return}if(s.op===`desktop`){if(typeof s.id!=`string`||!/^\d{1,9}$/.test(s.id)||Number(s.id)<=h)return;h=Number(s.id);let t=e=>O({op:`desktop-result`,id:s.id,...e});if(_=_.filter(e=>Date.now()-e<6e4),g||_.length>=120){t({error:`Too many desktop requests. Wait before trying again.`});return}let n;try{if(n=eH(s.args||{}),JSON.stringify(n).length>131072||!mt(n))throw Error(`Desktop arguments exceed the limit`)}catch(e){t({error:e.message});return}let r=![`tool.status`,`storage.info`,`storage.list`,`storage.read`,`record.status`,`device.info`,`record.cancel`,`session.close`].includes(s.operation);if(r&&!Ve.current?.canEdit){t({error:`Desktop changes are unavailable while this workspace is read only.`});return}if(s.operation===`record.cut`){let e=n?.source,r=tH(e),i=[];try{i=rH(I.current?.value).map(tH)}catch{}if(!r||!(m.authorizesMedia(e)||i.includes(r))){t({error:`Cut a video this Block received or recorded in this session.`});return}}let i={native:m};_.push(Date.now()),g=i,Promise.resolve().then(()=>{if(!e||i.native!==m||r&&!Ve.current?.canEdit)throw Error(`Desktop access or edit permission changed before this request.`);if(he()&&r)throw Error(`Assisted desktop mutations require a task-safe native interface; this control is unavailable.`);return i.native.call(s.operation,n)}).then(n=>{if(!e||i.native!==m||r&&!Ve.current?.canEdit)throw Error(`Desktop access or edit permission changed before this result could be used.`);t({result:eH(n)})},e=>t({error:String(e.message).slice(0,1e3)})).catch(e=>t({error:String(e.message).slice(0,1e3)})).finally(()=>{g===i&&(g=null)});return}if(s.op===`use-output`){if(typeof s.id!=`string`||!/^[0-9]{1,9}$/.test(s.id))return;let e=e=>O({op:`use-output-result`,id:s.id,...e});try{if(he())throw Error(`Assisted media adoption requires a task-safe native commit interface; this control is unavailable.`);if(T&&!Ve.current?.canEdit)throw Error(`This workspace is read only.`);let t=eH(s.outputs),n=F.current.onUseOutput;if(typeof n!=`function`)throw Error(`Choosing an existing media output is unavailable in this workspace.`);aH(t,I.current.value,m),Promise.resolve(n(t)).then(t=>{let n=eH(t);kt(n),e({outputs:n})},t=>e({error:String(t?.message||`The media output could not be saved`).slice(0,1e3)}))}catch(t){e({error:String(t.message).slice(0,1e3)})}return}if(s.op===`preview-image`||s.op===`preview-media`){let t=s.op===`preview-media`;if(typeof s.id!=`string`||!/^\d{1,9}$/.test(s.id)||Number(s.id)<=l)return;L(null),l=Number(s.id);let n=e=>O({op:t?`preview-media-result`:`preview-image-result`,id:s.id,...e}),r=Date.now();if(d=d.filter(e=>r-e<6e4),o||d.length>=$B.imagePreviewsPerMinute){++p<=3&&n({error:o?`An image preview is already loading`:`Image preview limit reached. Wait a minute before trying again.`}),p===4&&(st(`Preview paused after too many image requests. Reset it to continue.`),e=!1,gt(),i?.abort(),P.current&&(P.current.src=`about:blank`));return}d.push(r);let c;try{if(c=t?eH(s.value):oH(s.value),t&&(!mt(c)||![`video`,`audio`].includes(c.kind)||![`assetId`,`versionId`,`url`].every(e=>typeof c[e]==`string`&&c[e].length>0&&c[e].length<=32768)))throw Error(`Keep the complete audio or video reference supplied by this workspace.`)}catch(e){n({error:e.message});return}let u=t&&m?.authorizesMedia?.(c)?(e,t)=>Mn(e,t):t?F.current.onPreviewMedia:F.current.onPreviewImage;if(typeof u!=`function`){n({error:t?`Audio/video preview is unavailable in this workspace.`:`Image preview is unavailable in this workspace. Choose an image with the host controls.`});return}let f=new AbortController,h=Xe.current,g={controller:f,id:s.id,media:t};o=g;let _=Ze.current,v=a,y=Et(),b=()=>{if(f.signal.aborted||y!==Et()||_!==Ze.current||Object.keys(h).some(e=>h[e]!==Xe.current[e]))throw Error(`Image preview input or workspace changed.`)},x=setTimeout(()=>{e&&o===g&&gt(`Image preview timed out. Try a smaller image.`)},$B.imagePreviewMs);f.signal.addEventListener(`abort`,()=>clearTimeout(x),{once:!0}),Promise.resolve().then(()=>(b(),u(c,{signal:f.signal}))).then(r=>{if(e&&!f.signal.aborted&&o===g){if(b(),t&&r?.kind!==c.kind)throw Error(`The host returned a different media kind.`);let e=t?An(r):sH(r);b(),typeof c.assetId==`string`&&c.assetId.length<=512&&typeof c.versionId==`string`&&c.versionId.length<=512&&L({actor:v,runtimeActor:y,identity:_,session:ze.session,authority:h,evidence:{assetId:c.assetId,versionId:c.versionId,kind:t?e.kind:`image`,mime:t?e.blob.type:`image/png`,...t?{byteLength:e.blob.size}:{width:e.width,height:e.height},status:`broker-loaded`}}),n({preview:e})}},t=>{e&&!f.signal.aborted&&o===g&&n({error:String(t?.message||`This image could not be previewed`).slice(0,1e3)})}).catch(t=>{e&&!f.signal.aborted&&o===g&&n({error:String(t?.message||`This image could not be previewed`).slice(0,1e3)})}).finally(()=>{clearTimeout(x),o===g&&(o=null)});return}if(s.op!==`run`||typeof s.id!=`string`||!/^\d{1,9}$/.test(s.id)||Number(s.id)<=c)return;c=Number(s.id);let y=e=>O({op:`result`,id:s.id,...e});if(T&&!Ve.current?.canEdit){y({error:`Shared editing is unavailable or read only.`});return}let x=Date.now();if(u=u.filter(e=>x-e<6e4),i||u.length>=$B.runsPerMinute){++f<=3&&y({error:i?`A run is already in progress`:`Preview run limit reached. Wait a minute before trying again.`}),f===4&&(st(`Preview paused after too many requests. Reset it to continue.`),e=!1,gt(),i?.abort(),P.current&&(P.current.src=`about:blank`));return}let w;try{if(!mt(s.input))throw Error(`Expected input values`);w=eH(s.input)}catch(e){y({error:e.message});return}u.push(x),te(``);let E=new AbortController;i=E,be.current=!0,j?.context.signal?.addEventListener(`abort`,()=>E.abort(),{once:!0});let D=setTimeout(()=>{e&&i===E&&(E.abort(),i=null,y({error:M?`Preview confirmation or execution timed out. Cancellation was requested; the backend may still be finishing.`:`Preview execution timed out. Try a smaller input.`}))},M?N:15e3);E.signal.addEventListener(`abort`,()=>clearTimeout(D),{once:!0});let k=j?.op===`dispatch-view-control`?j:null,ne=k?async e=>{if(j!==k||i!==E||E.signal.aborted||!mt(e)||e.receipt?.status!==`completed`||e.receipt.saved!==!0||dt(e.taskFence)!==dt(k.context.taskFence)||dt([e.projectId,e.placementId,e.sourceDigest,e.actorId])!==ue||dt(eH(e.beforeInput))!==k.inputIdentity)throw Error(`The native input commit does not match this active declared action.`);let t=dt(eH(e.input));for(let e=0;e<25&&I.current.signature!==t;e++)if(fe(k.context,t),await new Promise(e=>setTimeout(e,10)),j!==k||i!==E||E.signal.aborted)throw Error(`The native input commit was stopped before its render.`);if(fe(k.context,t),I.current.signature!==t)throw Error(`The native input commit does not match the current rendered inputs.`);k.inputIdentity=t}:void 0;Promise.resolve().then(()=>F.current.onRun(w,{...he(),signal:E.signal,...ne?{onInputCommitted:ne}:{},...A?.manifest?.desktopTools?.length?{nativeDesktopSession:m}:{}})).then(t=>{if(e&&!E.signal.aborted){if(!mt(t))throw Error(`Block execution must return named outputs`);let e=eH(t);kt(e),y({outputs:e})}},t=>{e&&!E.signal.aborted&&y({error:String(t?.message||`The Block could not run`).slice(0,1e3)})}).catch(t=>{e&&!E.signal.aborted&&y({error:String(t.message).slice(0,1e3)})}).finally(()=>{clearTimeout(D),i===E&&(i=null),be.current=!1,setTimeout(()=>{e&&!be.current&&Ce()},250)})};return window.addEventListener(`message`,At),()=>{ee&&=(clearTimeout(ee.timer),ee.context.signal?.removeEventListener(`abort`,ee.abort),ee.reject(Error(`Original text closed; retain its pending request.`)),null),rt.current=null,me(Error(`The declared interface was closed.`)),it.current=null,Qe?.(),$e?.(),clearTimeout(Ie),Dt(),St&&=(clearTimeout(St.timer),St.reject(Error(`Block closed before pending edits were confirmed.`)),null),clearTimeout(ht),clearInterval(y),w?.disconnect(),O({op:`dispose`}),e=!1,m.close(),ie.current===m&&(ie.current=null),ae.current===D&&(ae.current=null),gt(),i?.abort(),be.current=!1,window.removeEventListener(`message`,At),window.removeEventListener(`stillmade:cursor-preferences`,at),window.removeEventListener(`storage`,at),Ke.current=null,Ye.current=null,Ge.current=null}},[ze,je,M,N,C,r,a,Te,Ee]),(0,Q.useEffect)(()=>{Ye.current?.()},[t]),(0,Q.useEffect)(()=>{Ge.current?.(),n?.canEdit===!1&&Promise.resolve(ie.current?.close()).catch(()=>{})},[n,je]),(0,Q.useEffect)(()=>{Ke.current?.()},[i,r,a,n]),(0,Q.useEffect)(()=>{Je.current?.()},[T,me]);let ht=!!globalThis.stillmadeDesktop?.blockDesktop;return(0,$.jsxs)(`div`,{className:`bs-sandbox-ui`,children:[oe?.awaitingStart&&(0,$.jsxs)(`div`,{className:`bs-notice`,role:`status`,children:[(0,$.jsx)(`p`,{children:oe.kind===`camera`?`Ready to record your camera. This Block records only after you press Start.`:oe.kind===`microphone`?`Ready to record your microphone. This Block records only after you press Start.`:oe.microphone?`Ready to record your screen with your microphone. Choose your screen or window after pressing Start.`:`Ready to record. Choose your screen or window after pressing Start.`}),(0,$.jsx)(`button`,{type:`button`,className:`btn`,onClick:oe.start,children:oe.kind===`camera`?`Start camera recording`:oe.kind===`microphone`?`Start microphone recording`:`Start screen recording`}),(0,$.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>ie.current?.close(),children:`Cancel`})]}),oe?.active&&(0,$.jsxs)(`div`,{role:`status`,className:`bs-notice`,children:[(0,$.jsxs)(`strong`,{children:[oe.ended?`Recording stopped`:`Recording`,` `,oe.kind||`media`]}),(0,$.jsxs)(`span`,{children:[` · `,oe.ended?oe.message:ht?`This Block has temporary desktop access.`:`Recording runs in StillMade, outside the Block.`]}),(0,$.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>ie.current?.close(),children:ht?`Cancel recording and revoke access`:`Discard recording`})]}),ht&&oe?.closed&&A?.manifest?.permissions?.desktop?.length>0&&(0,$.jsx)(`button`,{type:`button`,className:`btn`,disabled:!je||!Ve.current?.canEdit,onClick:()=>ae.current?.(),children:`Reopen desktop access`}),ht&&!oe?.closed&&!oe?.active&&A?.manifest?.permissions?.desktop?.length>0&&(0,$.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>ie.current?.close(),children:`Revoke this Block’s desktop access`}),ze.loading?(0,$.jsx)(`p`,{role:`status`,children:`Loading the interface…`}):ze.error?(0,$.jsxs)(`p`,{role:`alert`,children:[`This interface cannot be previewed: `,ze.error]}):je?(0,$.jsx)(`iframe`,{ref:P,onLoad:()=>{Ue.current.session!==ze.session&&(Ue.current={session:ze.session,count:0}),++Ue.current.count>2&&We.current?.()},title:v,sandbox:`allow-scripts`,referrerPolicy:`no-referrer`,src:`${b(`/block-ui-sandbox.html`)}#${ze.session}`,style:{width:`100%`,height:C&&ce||y,minHeight:280,border:`1px solid var(--border-tok)`,borderRadius:`var(--r-3)`,background:`var(--bg)`}},ze.session):(0,$.jsx)(`p`,{role:ke?.error?`alert`:`status`,children:ke?.error||`Checking Block safety…`}),ue?.count>0&&(ue.error?(0,$.jsx)(`p`,{role:`alert`,className:`bs-notice`,children:ue.error}):ue.dirty||ue.pending?(0,$.jsx)(`p`,{role:`status`,className:`bs-notice`,children:`Sharing changes…`}):null),fe?.count>0&&(fe.error||fe.dirty||fe.pending)?(0,$.jsxs)(`div`,{className:`bs-notice`,role:fe.error?`alert`:`status`,children:[(0,$.jsx)(`p`,{children:fe.error||`Saving shared text…`}),fe.error&&(0,$.jsx)(`p`,{children:`Your text is retained here. Copy it before leaving; reloading cannot safely recover an unacknowledged draft.`}),fe.retryable&&(0,$.jsx)(`button`,{type:`button`,className:`btn`,disabled:fe.pending>0||!Ve.current?.canEdit,onClick:()=>P.current?.contentWindow?.postMessage({channel:YV,session:ze.session,op:`text-retry`},`*`),children:`Retry save`})]}):null,(ee||ke?.error)&&(0,$.jsxs)($.Fragment,{children:[ee&&(0,$.jsx)(`p`,{role:`alert`,children:ee}),(0,$.jsx)(`button`,{type:`button`,className:`btn`,disabled:De,onClick:()=>{De||re(e=>e+1)},children:`Reload preview`})]})]})}var uH=[[`light`,`Light`],[`dark`,`Dark`],[`white`,`White`]],dH=[[`full`,`Full width`,null],[`tablet`,`Tablet`,768],[`phone`,`Phone`,390]],fH=e=>{let t=JSON.stringify(e);return t.length>160?`${t.slice(0,157)}...`:t},pH=(e,t)=>{try{return localStorage.getItem(e)||t}catch{return t}},mH=(e,t)=>{try{localStorage.setItem(e,t)}catch{}};async function hH(e){return(await fetch(`/__dev/run`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({input:e})})).json()}async function gH(e,{signal:t}={}){if(typeof e?.url!=`string`||!e.url.startsWith(`/api/media/`))throw Error(`The local preview shows stand-in media and files mapped in tests/mocks.json.`);let n=await fetch(e.url,{signal:t});if(!n.ok)throw Error(`This image is not available in the local preview. Map it to a file under files in tests/mocks.json.`);let r=await createImageBitmap(await n.blob()),i=Math.min(1,512/Math.max(r.width,r.height)),a=document.createElement(`canvas`);return a.width=Math.max(1,Math.round(r.width*i)),a.height=Math.max(1,Math.round(r.height*i)),a.getContext(`2d`).drawImage(r,0,0,a.width,a.height),r.close?.(),{url:a.toDataURL(`image/png`),width:a.width,height:a.height}}function _H(e,{signal:t}={}){return typeof e?.url!=`string`||!e.url.startsWith(`/api/media/`)?Promise.reject(Error(`The local preview plays stand-in media and files mapped in tests/mocks.json.`)):Mn(e,{signal:t})}function vH({value:e,onCommit:t,disabled:n}){let r=(0,Q.useMemo)(()=>JSON.stringify(e,null,2),[e]),[i,a]=(0,Q.useState)(r),[o,s]=(0,Q.useState)(``);return(0,Q.useEffect)(()=>{a(r),s(``)},[r]),(0,$.jsxs)(`div`,{className:`dh-input`,children:[(0,$.jsx)(`textarea`,{"aria-label":`Input JSON`,spellCheck:!1,rows:8,value:i,disabled:n,onChange:e=>a(e.target.value),onBlur:()=>{if(i!==r)try{let e=JSON.parse(i||`{}`);if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`The input is one JSON object, keyed by input port.`);s(``),t(e)}catch(e){s(e.message)}}}),o&&(0,$.jsx)(`p`,{role:`alert`,children:o})]})}var yH=(0,Q.memo)(function({entries:e,onClear:t}){let n=(0,Q.useRef)(null);return(0,Q.useEffect)(()=>{let e=n.current;e&&(e.scrollTop=e.scrollHeight)},[e]),(0,$.jsxs)(`section`,{className:`dh-console`,"aria-label":`Console`,children:[(0,$.jsxs)(`div`,{className:`dh-section-head`,children:[(0,$.jsx)(`h2`,{children:`Console`}),(0,$.jsx)(`button`,{type:`button`,className:`btn btn-ghost`,onClick:t,disabled:!e.length,children:`Clear`})]}),(0,$.jsx)(`ol`,{ref:n,children:e.map(e=>(0,$.jsxs)(`li`,{className:`dh-entry dh-${e.kind}`,children:[(0,$.jsx)(`time`,{children:e.time}),(0,$.jsx)(`span`,{className:`dh-kind`,children:e.label}),(0,$.jsx)(`pre`,{children:e.text})]},e.id))}),!e.length&&(0,$.jsx)(`p`,{className:`dh-muted`,children:`Runs, logs, stand-ins, reloads and errors appear here.`})]})}),bH={run:`Run`,log:`Log`,"stand-in":`Stand-in`,reload:`Reload`,build:`Build`,error:`Error`,view:`View`};function xH(){let[e,t]=(0,Q.useState)({revision:0,content:null,problem:null,folder:``}),[n,r]=(0,Q.useState)(0),[i,a]=(0,Q.useState)(()=>pH(`stillmade.dev.theme`,`light`)),[o,s]=(0,Q.useState)(()=>pH(`stillmade.dev.width`,`full`)),[c,l]=(0,Q.useState)(0),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)([]),[v,y]=(0,Q.useState)({}),b=(0,Q.useRef)({}),x=(0,Q.useRef)(0),S=(0,Q.useCallback)((e,t)=>_(n=>[...n.slice(-299),{id:++x.current,kind:e,label:bH[e]||e,time:new Date().toLocaleTimeString(),text:String(t)}]),[]),C=(0,Q.useCallback)(async()=>{let e=await(await fetch(`/__dev/package`,{cache:`no-store`})).json();return t(e),e},[]);(0,Q.useEffect)(()=>{let e=!0;C().then(t=>{e&&(d(e=>e??(t.content?.tests?.[0]?.input||{})),S(`reload`,`Previewing ${t.folder}`),t.problem&&S(`error`,t.problem))}).catch(e=>S(`error`,e.message));let t=new EventSource(`/__dev/events`);return t.addEventListener(`package`,async t=>{let n=JSON.parse(t.data);try{if(await C(),!e)return;r(e=>e+1),S(n.problem?`error`:`reload`,n.problem?`Reloaded with a problem: ${n.problem}`:`Reloaded after a change`)}catch(e){S(`error`,e.message)}}),t.addEventListener(`build`,e=>{let t=JSON.parse(e.data);t.state===`running`?S(`build`,`Building: ${t.command}`):t.state===`done`?S(`build`,`Build finished`):S(`error`,`Build failed${t.output?`\n${t.output}`:``}`)}),()=>{e=!1,t.close()}},[]),(0,Q.useEffect)(()=>{document.documentElement.dataset.mode=i,mH(`stillmade.dev.theme`,i)},[i]),(0,Q.useEffect)(()=>{mH(`stillmade.dev.width`,o)},[o]);let w=e.content,T=w?.manifest,E=w?.tests||[],D=e=>{l(e),d(E[e]?.input||{})},O=(0,Q.useCallback)(async(e,{signal:t}={})=>{S(`run`,`Run with ${fH(e)}`),h(!0);try{let n=await hH(e);if(t?.aborted)throw Object.assign(Error(`Run cancelled`),{code:`CANCELLED`});for(let e of n.logs||[])S(`log`,e);for(let e of n.standIns||[])S(`stand-in`,`${e.api} ${e.name} (${e.source===`mocks`?`tests/mocks.json`:`recorded stand-in`})`);if(n.error)throw S(`error`,`${n.error}${n.code?` (${n.code})`:``}`),Object.assign(Error(n.error),{code:n.code});return p(n.outputs),S(`run`,`Finished in ${n.ms} ms`),n.outputs}finally{h(!1)}},[S]),k=(0,Q.useCallback)(async e=>{let t=Gn(b.current,e);b.current=t,y(t)},[]),A=()=>{b.current={},y({}),r(e=>e+1),S(`view`,`Shared state cleared`)},j=(0,Q.useMemo)(()=>({state:v,outputs:{},memory:null,canEdit:!0}),[v]),M=(0,Q.useCallback)(async e=>{p(e),S(`view`,`The view chose outputs ${fH(e)}`)},[S]),N=(0,Q.useCallback)(e=>S(`error`,String(e?.message||e)),[S]),P=u||{},F=dH.find(([e])=>e===o)?.[2];return(0,$.jsxs)(`div`,{className:`dh-page`,children:[(0,$.jsxs)(`header`,{className:`dh-header`,children:[(0,$.jsxs)(`div`,{className:`dh-title`,children:[(0,$.jsx)(`span`,{className:`dh-wordmark`,children:`StillMade AI`}),(0,$.jsx)(`h1`,{children:T?.name||`Block preview`}),T&&(0,$.jsxs)(`span`,{className:`dh-meta`,children:[T.id,` · `,T.version,` · `,T.runtime,w.view?.runtime===`frame`?` · frame view`:w.view?` · view`:``]})]}),(0,$.jsxs)(`div`,{className:`dh-controls`,children:[(0,$.jsxs)(`label`,{children:[`Appearance`,(0,$.jsx)(`select`,{value:i,onChange:e=>a(e.target.value),children:uH.map(([e,t])=>(0,$.jsx)(`option`,{value:e,children:t},e))})]}),(0,$.jsxs)(`label`,{children:[`Width`,(0,$.jsx)(`select`,{value:o,onChange:e=>s(e.target.value),children:dH.map(([e,t])=>(0,$.jsx)(`option`,{value:e,children:t},e))})]}),E.length>1&&(0,$.jsxs)(`label`,{children:[`Fixture`,(0,$.jsx)(`select`,{value:c,onChange:e=>D(Number(e.target.value)),children:E.map((e,t)=>(0,$.jsx)(`option`,{value:t,children:e.name},t))})]}),(0,$.jsx)(`button`,{type:`button`,className:`btn btn-secondary`,onClick:()=>r(e=>e+1),children:`Reload view`})]})]}),e.problem&&(0,$.jsx)(`p`,{className:`dh-problem`,role:`alert`,children:e.problem}),(0,$.jsxs)(`main`,{className:`dh-main`,children:[(0,$.jsx)(`section`,{className:`dh-stage`,"aria-label":`Preview`,children:(0,$.jsx)(`div`,{className:`dh-frame`,style:F?{maxWidth:F}:void 0,children:w?w.view?(0,$.jsx)(lH,{view:w.view,policyContent:w,input:P,sharedView:j,onSharedChange:k,onRun:O,onUseOutput:M,onPreviewImage:gH,onPreviewMedia:_H,onError:N,actorId:`dev-preview`,title:`${T.name} preview`,height:560,fitContent:!0},n):(0,$.jsxs)(`div`,{className:`dh-noview`,children:[(0,$.jsx)(`p`,{children:`This Block has no interface. StillMade shows controls for its inputs; run it here with the input on the right.`}),(0,$.jsx)(`button`,{type:`button`,className:`btn btn-primary`,disabled:m,onClick:()=>O(P).catch(()=>{}),children:m?`Running`:`Run`})]}):(0,$.jsx)(`p`,{className:`dh-muted`,role:`status`,children:`Loading the Block`})})}),(0,$.jsxs)(`aside`,{className:`dh-panel`,children:[(0,$.jsxs)(`section`,{"aria-label":`Input`,children:[(0,$.jsxs)(`div`,{className:`dh-section-head`,children:[(0,$.jsx)(`h2`,{children:`Input`}),(0,$.jsx)(`button`,{type:`button`,className:`btn btn-ghost`,disabled:m||!w,onClick:()=>O(P).catch(()=>{}),children:`Run with this input`})]}),u&&(0,$.jsx)(vH,{value:u,onCommit:d,disabled:!w})]}),(0,$.jsxs)(`section`,{"aria-label":`Outputs`,children:[(0,$.jsxs)(`div`,{className:`dh-section-head`,children:[(0,$.jsx)(`h2`,{children:`Last outputs`}),w?.view&&(0,$.jsx)(`button`,{type:`button`,className:`btn btn-ghost`,onClick:A,children:`Clear shared state`})]}),f?(0,$.jsx)(`pre`,{className:`dh-json`,children:JSON.stringify(f,null,2)}):(0,$.jsx)(`p`,{className:`dh-muted`,children:`Nothing has run yet.`})]}),(0,$.jsx)(yH,{entries:g,onClear:()=>_([])})]})]})]})}(0,v.createRoot)(document.getElementById(`root`)).render((0,$.jsx)(xH,{}));
1729
+ `;function AV(e){let t=e=>Number.isFinite(e)&&e>=0&&e<=1;return!e||typeof e!=`object`||Array.isArray(e)||!t(e.x)||!t(e.y)||e.id!==void 0&&(typeof e.id!=`string`||!e.id.length||e.id.length>160)?null:{x:e.x,y:e.y,...e.id===void 0?{}:{id:e.id}}}function jV(e,t,n){if(t=AV(t),!t)return null;let r,i;if(t.id!==void 0){let n=e.getElementById(t.id);if(!n)return null;let a=n.getBoundingClientRect();if(a.width<=0||a.height<=0)return null;r=a.left+a.width*t.x,i=a.top+a.height*t.y;let o=e.elementFromPoint?.(r,i);if(o&&!n.contains(o))return null}else r=t.x*e.documentElement.scrollWidth-n.scrollX,i=t.y*e.documentElement.scrollHeight-n.scrollY;return Number.isFinite(r)&&Number.isFinite(i)&&r>=0&&i>=0&&r<=n.width&&i<=n.height?{x:r,y:i}:null}function MV(e,t,n){let r=null,i=null,a=null,o=!1,s=e=>Math.max(0,Math.min(1,e)),c=[],l=null,u=null,d=null,f=new Map,p=()=>{if(u=null,o||!n)return;!l&&c.length&&(l=document.createElement(`div`),l.style.cssText=`position:fixed;inset:0;pointer-events:none;z-index:2147483647;overflow:hidden`,l.setAttribute(`aria-hidden`,`true`),document.body.append(l));let e=new Set(c.map(e=>e.id));for(let[t,n]of f)e.has(t)||(n.remove(),f.delete(t));for(let e of c){let t=f.get(e.id);t||(t=document.createElement(`div`),t.style.cssText=`position:absolute;left:0;top:0;pointer-events:none;color:var(--fg);white-space:nowrap;font:12px var(--font-body,sans-serif)`,typeof matchMedia==`function`&&!matchMedia(`(prefers-reduced-motion: reduce)`).matches&&(t.style.transition=`transform 100ms linear`),l.append(t),f.set(e.id,t)),t.textContent=`↖ `+e.label;let r=n(document,e.anchor,{width:innerWidth,height:innerHeight,scrollX,scrollY});t.hidden=!r,r&&(t.style.transform=`translate(`+r.x+`px,`+r.y+`px)`)}},m=()=>{u===null&&(u=setTimeout(p,50))},h=()=>{if(i=null,!o&&r){if(r.visible&&a){let e=(document.elementFromPoint?.(a.x,a.y)||a.target)?.closest?.(`[id]`),t=e?.id,n=t&&t.length<=160?e.getBoundingClientRect():null;if(n?.width>0&&n?.height>0)r.anchor={id:t,x:s((a.x-n.left)/n.width),y:s((a.y-n.top)/n.height)};else{let e=document.documentElement;r.anchor={x:s((a.x+scrollX)/Math.max(1,e.scrollWidth)),y:s((a.y+scrollY)/Math.max(1,e.scrollHeight))}}}parent.postMessage({channel:e,session:t,op:`cursor`,cursor:r},`*`),r=null}},g=e=>{a={x:e.clientX,y:e.clientY,target:e.target},r={x:s(e.clientX/Math.max(1,innerWidth)),y:s(e.clientY/Math.max(1,innerHeight)),visible:!0},i===null&&(i=setTimeout(h,50))},_=()=>{a=null,r={x:0,y:0,visible:!1},i===null&&(i=setTimeout(h,0))},v=()=>{a&&g({clientX:a.x,clientY:a.y,target:a.target}),m()},y=n=>{let s=n.data;if(!(o||n.source!==parent||s?.channel!==e||s.session!==t)){if(s.op===`peer-cursors`){c=(Array.isArray(s.peers)?s.peers:[]).slice(0,50).filter(e=>e&&typeof e.id==`string`&&e.id.length<=200&&typeof e.label==`string`&&e.label.length<=120).map(e=>({id:e.id,label:e.label,anchor:e.anchor})),m();return}s.op===`dispose`&&(o=!0,clearTimeout(i),clearTimeout(u),d?.disconnect(),r=null,a=null,c=[],f.clear(),l?.remove(),removeEventListener(`pointermove`,g),removeEventListener(`scroll`,v,!0),removeEventListener(`resize`,v),removeEventListener(`blur`,_),removeEventListener(`message`,y),document.documentElement.removeEventListener(`pointerleave`,_))}};addEventListener(`pointermove`,g,{passive:!0}),addEventListener(`scroll`,v,{passive:!0,capture:!0}),addEventListener(`resize`,v,{passive:!0}),document.documentElement.addEventListener(`pointerleave`,_),addEventListener(`blur`,_),addEventListener(`message`,y),typeof MutationObserver==`function`&&(d=new MutationObserver(e=>{c.length&&e.some(e=>!l?.contains(e.target))&&m()}),d.observe(document.body,{subtree:!0,childList:!0,attributes:!0,characterData:!0}))}function NV(e,t){let n=r=>{let i=r.data;r.source===parent&&i&&i.channel===e&&i.session===t&&(i.op===`theme`&&[`light`,`dark`,`white`].includes(i.mode)&&(document.documentElement.dataset.mode=i.mode),i.op===`dispose`&&removeEventListener(`message`,n))};addEventListener(`message`,n)}function PV(e,t){let n=parent,r=null,i=0,a=!1,o=()=>{if(r=null,a)return;let o=Math.ceil(Math.max(document.body.scrollHeight,document.body.getBoundingClientRect().height));o!==i&&(i=o,n.postMessage({channel:e,session:t,op:`content-size`,height:o},`*`))},s=()=>{!a&&r===null&&(r=setTimeout(o,100))},c=new ResizeObserver(s);c.observe(document.body);let l=i=>{i.source===n&&i.data?.channel===e&&i.data?.session===t&&i.data?.op===`dispose`&&(a=!0,clearTimeout(r),c.disconnect(),removeEventListener(`message`,l))};addEventListener(`message`,l),s()}var Q=u(f(),1),FV=(0,Q.createContext)(null);xt();function IV(e){return L(Array.isArray(e)&&e.length>0&&e.length<=128&&e.every(e=>typeof e==`string`&&/^[a-f0-9]{64}$/.test(e)),`SCHEMA`,`Provide 1–128 exact source digests`),[...new Set(e)]}async function LV(e){ut(e);let t=e?.stages&&e.packages||[];return L(Array.isArray(t)&&t.length<128,`LIMIT`,`Too many packaged Blocks for execution review`),IV(await Promise.all([e,...t].map(e=>ft(e))))}async function RV(e){let t=await LV(e),n=new Set(t),r=e?.stages?e.packages||[]:[e],i=e=>{L(e&&typeof e.digest==`string`&&/^[a-f0-9]{64}$/.test(e.digest),`SCHEMA`,`Block lineage needs exact source digests`),n.add(e.digest),L(n.size<=128,`LIMIT`,`Block source and ancestry exceed the security review limit`)};for(let e of r){let t=e.manifest?.provenance;t?.remixedFrom!==void 0&&i(t.remixedFrom);let n=t?.remixAncestors??[];L(Array.isArray(n)&&n.length<=64,`SCHEMA`,`Block ancestry must contain at most 64 exact source references`),n.forEach(i);let r=e.portable?.lineage?.parents??[];L(Array.isArray(r)&&r.length<=16,`SCHEMA`,`Portable lineage must contain at most 16 exact source references`),r.forEach(i)}return IV([...n])}var zV=`stillmade.block-security.v1`,BV=new Map;function VV(e,t){let n=e?.revision||0,r=t.revision||0;return{revision:Math.max(n,r),published:t.published||e?.published===!0,revoked:n>r?e.revoked:n===r?t.revoked||e?.revoked===!0:t.revoked}}function HV(){try{let e=JSON.parse(globalThis.localStorage?.getItem(zV)||`{}`);for(let[t,n]of Object.entries(e))/^[a-f0-9]{64}$/.test(t)&&n&&typeof n.revoked==`boolean`&&typeof n.published==`boolean`&&Number.isInteger(n.revision)&&n.revision>=0&&BV.set(t,VV(BV.get(t),n))}catch{}return BV}function UV(e){let t=HV();for(let n of e){let e=t.get(n.digest);(n.revoked||n.published||e)&&t.set(n.digest,VV(e,n))}try{globalThis.localStorage?.setItem(zV,JSON.stringify(Object.fromEntries(t)))}catch{}}var WV=()=>Object.assign(Error(`This exact Block version has been quarantined by StillMade. Use a reviewed replacement.`),{code:`BLOCK_REVOKED`});async function GV(e,{signal:t}={}){let n=await RV(e),r=HV();if(t?.aborted)throw Object.assign(Error(`Cancelled`),{code:`CANCELLED`});let i=new AbortController,a=()=>i.abort();t?.addEventListener(`abort`,a,{once:!0});let o=setTimeout(a,3e3),s;try{let e=await fetch(`/api/blocks/runtime-policy`,{method:`POST`,credentials:`omit`,cache:`no-store`,headers:{"Content-Type":`application/json`},body:JSON.stringify({digests:n}),signal:i.signal});if(!e.ok)throw Error(`Block security check unavailable`);if(s=await e.json(),!Array.isArray(s.digests)||s.digests.length!==n.length||new Set(s.digests.map(e=>e.digest)).size!==n.length||s.digests.some(e=>!n.includes(e.digest)||typeof e.revoked!=`boolean`||typeof e.published!=`boolean`||!Number.isInteger(e.revision)||e.revision<0))throw Error(`Invalid security response`);UV(s.digests)}catch{if(t?.aborted)throw Object.assign(Error(`Cancelled`),{code:`CANCELLED`});if(n.some(e=>r.get(e)?.revoked))throw WV();if(n.some(e=>r.get(e)?.published))throw Object.assign(Error(`Reconnect to check the safety of this published Block before running it.`),{code:`REVOCATION_UNAVAILABLE`});return{checked:!1}}finally{clearTimeout(o),t?.removeEventListener(`abort`,a)}if(n.some(e=>HV().get(e)?.revoked))throw WV();return{checked:!0}}var KV=c({loadViewAssets:()=>qV});async function qV(e,{signal:t}={}){let n={};for(let[r,i]of Object.entries(e?.files||{})){let a=await fetch(`/__dev/files/`+i.sha256,{signal:t});if(!a.ok)throw Error(r+` is missing from the Block folder.`);let o=await ZB(e,r,new Uint8Array(await a.arrayBuffer()));n[r]={mediaType:i.mediaType,base64:JV(o)}}return n}var JV,YV=o((()=>{QB(),JV=e=>{let t=``;for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)}}));T(),xt();var $=af();Cr();var XV=`stillmade.block.view.v1`,ZV=()=>globalThis.crypto.randomUUID(),QV=`*{box-sizing:border-box}html{container:stillmade-view/inline-size;overflow-wrap:anywhere}body{min-width:0;margin:0;padding:max(16px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) max(16px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left));overflow-x:hidden;background:var(--bg);color:var(--fg);font:16px/1.5 var(--font-body)}h1,h2{font:200 italic clamp(26px,8cqi,32px)/1.1 var(--font-display);letter-spacing:var(--tr-display)}button,input,textarea,select,summary{font:inherit;color:inherit;max-width:100%}button,input,textarea,select{min-height:44px;border:1px solid var(--border-tok);border-radius:var(--r-3);padding:10px 14px;background:transparent}summary{display:flex;align-items:center;min-height:44px;cursor:pointer}button{min-width:44px;cursor:pointer;border-radius:var(--r-pill);background:var(--fg);color:var(--bg)}button:disabled{opacity:.5;cursor:default}textarea{display:block;width:100%;min-height:120px}img,video,canvas{max-width:100%}:focus-visible{outline:2px solid var(--signal);outline-offset:3px}@container stillmade-view (max-width:360px){body{padding:12px}button,input,textarea,select{font-size:16px}}`,$V=`*{box-sizing:border-box}html{overflow-wrap:anywhere}body{min-width:0;margin:0;padding:16px;overflow-x:hidden;background:var(--bg);color:var(--fg);font:16px/1.5 var(--font-body)}`,eH=e=>JSON.stringify(e).replace(/</g,`\\u003c`).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`);function tH(e){if(ut(e),new TextEncoder().encode(JSON.stringify(e)).length>$B.messageBytes)throw Error(`Preview data exceeds 4 MiB`);return structuredClone(e)}var nH=e=>mt(e)&&[`image`,`video`,`audio`].includes(e.kind)&&[`assetId`,`versionId`,`url`].every(t=>typeof e[t]==`string`&&e[t])?dt([e.kind,e.assetId,e.versionId,e.url]):``;function rH(e){let t=(0,Q.useRef)({has:!1,original:null,signature:null,value:null});if(t.current.has&&Object.is(t.current.original,e))return t.current.value;let n=e===void 0?`undefined`:dt(e);return t.current.signature===n?t.current.original=e:t.current={has:!0,original:e,signature:n,value:e},t.current.value}function iH(e,t=[]){return Array.isArray(e)?(e.forEach(e=>iH(e,t)),t):mt(e)?nH(e)?(t.push(e),t):(Object.values(e).forEach(e=>iH(e,t)),t):t}var aH=e=>Array.isArray(e)?e.length>0&&e.every(aH):!!nH(e);function oH(e,t,n){if(!mt(e)||!Object.values(e).length||!Object.values(e).every(aH))throw Error(`Only complete saved media references can be chosen as outputs.`);let r=new Set(iH(t).map(nH));for(let t of iH(e))if(!r.has(nH(t))&&!n?.authorizesMedia(t))throw Error(`Choose media supplied by this workspace or recorded in this session.`);return tH(e)}function sH(e){let t=tH(e);if(!mt(t)||!pt(t,`image`))throw Error(`Choose a valid image supplied by this workspace.`);if(t.role!==void 0&&(typeof t.role!=`string`||!/^[a-z][a-z0-9_]{0,79}$/.test(t.role)))throw Error(`This image has an invalid semantic role.`);if(!Array.isArray(t.data)&&!([`assetId`,`versionId`,`url`].every(e=>typeof t[e]==`string`&&t[e].length>0)&&t.assetId.length<=512&&t.versionId.length<=512&&t.url.length<=32768))throw Error(`Keep the complete image reference supplied by this workspace.`);return t}function cH(e){let t=tH(e);if(!(mt(t)&&Object.keys(t).length===3&&[`url`,`width`,`height`].every(e=>Object.hasOwn(t,e))&&[`width`,`height`].every(e=>Number.isInteger(t[e])&&t[e]>0&&t[e]<=$B.imagePreviewEdge))||typeof t.url!=`string`||!/^data:image\/png;base64,[A-Za-z0-9+/]+={0,2}$/.test(t.url))throw Error(`The host returned an invalid image preview.`);let n=t.url.slice(22);if(n.length%4!=0)throw Error(`The host returned an invalid image preview.`);let r=atob(n.slice(0,44)),i=e=>r.charCodeAt(e),a=e=>i(e)*16777216+i(e+1)*65536+i(e+2)*256+i(e+3);if(r.length<33||![137,80,78,71,13,10,26,10].every((e,t)=>i(t)===e)||a(8)!==13||r.slice(12,16)!==`IHDR`||a(16)!==t.width||a(20)!==t.height)throw Error(`The host returned an invalid image preview.`);return t}function lH(e,t,n=`light`,r=`package`,i=!1,a=[],o=null,s=!1,c=!1,{assets:l={}}={}){lV(e);let u=gV(e),d=r===`package`?e.appearance??`host`:r;d!==`original`&&!u&&EV(e,{appearance:`host`});let f=(d===`original`?e.css??``:e.themedCss??e.css??``)+`
1730
+ `+(u?``:OV),p=globalThis.crypto.randomUUID().replaceAll(`-`,``),m=`__sm_view_${p}`,h=`__sm_guard_${globalThis.crypto.randomUUID().replaceAll(`-`,``)}`,g=`(()=>{"use strict";document.currentScript.remove();const session=${eH(t)},channel=${eH(XV)},send=parent.postMessage.bind(parent);let input={},ready=false,inputRevision=0,editRevision=0,sequence=0,pending=null,pendingAdopt=null,adoptSequence=0,pendingImage=null,imageSequence=0,pendingDesktop=null,desktopSequence=0;const mediaURLs=new Set();const clearMedia=()=>{for(const url of mediaURLs)URL.revokeObjectURL(url);mediaURLs.clear()};const listeners=new Set();let calls=0,started=0;const now=performance.now.bind(performance),resetTask=setTimeout.bind(globalThis);${u?`for(const meta of document.querySelectorAll("meta[http-equiv]"))meta.remove();const frameRuntime=(${bV.toString()})(channel,session,send,${eH({guardName:h,taskMs:dV.taskMs,assets:l})});`:`Object.defineProperty(globalThis,${eH(m)},{configurable:true,value:()=>{if(calls===0){started=now();resetTask(()=>{calls=0},0)}if(++calls>10000||now()-started>50)throw Error("Interface is doing too much work. Move processing into the Block runtime.")}});addEventListener("message",event=>{if(event.isTrusted&&event.source===parent)calls=0},true);`}let controlEffects=0;let assisted=false,trackedCalls=new Set(),trackedFailure=null,controlOffset=0;const track=promise=>{if(assisted){trackedCalls.add(promise);promise.then(()=>trackedCalls.delete(promise),error=>{trackedFailure=error;trackedCalls.delete(promise)})}return promise};const controlSnapshot=(offset=controlOffset,automatic=true)=>{try{let snapshot;try{snapshot=dynamicUI.inspectControls({offset})}catch(error){if(!automatic||error.message!=="Choose a current control page"||!Number.isSafeInteger(offset)||offset<0)throw error;snapshot=dynamicUI.inspectControls({offset:0});}controlOffset=snapshot.offset;send({channel,session,op:"view-controls",snapshot},"*")}catch(error){send({channel,session,op:"view-controls-error",error:String(error.message).slice(0,1000)},"*")}};const dynamicUI=(${qn.toString()})(document,error=>send({channel,session,op:"interface-error",error},"*"),()=>Promise.resolve().then(controlSnapshot));const sharedLifecycle={};const sharedAPI=(${Kn.toString()})(channel,session,${eH(Wn)},sharedLifecycle);const textControls=${i?`(()=>{${In};return StillMadeTextFrame.installTextFrame(document,sharedAPI,error=>send({channel,session,op:"interface-error",error},"*"),channel,session,{token:${eH(o)},send});})()`:`null`};const sharedControls=(${Fn.toString()})(document,sharedAPI,error=>send({channel,session,op:"interface-error",error},"*"),textControls,${eH(a)});const {documentTools,sharedDocuments}=(${Ln})(sharedAPI,status=>send({channel,session,op:"document-store-status",status},"*"));const previews=(${Tt.toString()})((kind,value)=>{if(kind==="media"){if(mediaURLs.size>=2)throw Error("Release a previous media preview before opening another");if(!["video","audio"].includes(value.kind))throw Error("Choose an audio or video reference");}return new Promise((resolve,reject)=>{const id=String(++imageSequence);pendingImage={id,resolve,reject,media:kind==="media"};send({channel,session,op:kind==="media"?"preview-media":"preview-image",id,value},"*")})});const connectionAPI=(${wt.toString()})(${eH(XV)},${eH(t)},${c},send),workAPI=(${C.toString()})(${eH(XV)},${eH(t)},${s},send);const api=Object.freeze({...connectionAPI,...workAPI,${u?`asset:frameRuntime.asset,assetBytes:frameRuntime.assetBytes,`:``}connectedApp(...args){controlEffects++;return track(connectionAPI.connectedApp(...args))},sharedWork(...args){controlEffects++;return track(workAPI.sharedWork(...args))},previewSharedWorkMedia(...args){controlEffects++;return track(workAPI.previewSharedWorkMedia(...args))},schemaFields:(${Jn.toString()})(${JSON.stringify(a)}),...sharedAPI,...documentTools,connectDocument:sharedDocuments.connectDocument,bindShared:sharedControls.bindShared,setSharedDefaults:sharedControls.setSharedDefaults,scheduleSharedEdit:sharedControls.scheduleSharedEdit,render:dynamicUI.render,onAction:dynamicUI.onAction,releaseMedia(url){if(mediaURLs.delete(url))URL.revokeObjectURL(url)},previewMedia(value){if(!ready)return Promise.reject(Error("Preview is loading"));return track(previews.request("media",value))},desktop(operation,args={}){controlEffects++;if(!ready)return Promise.reject(Error("Preview is loading"));if(pendingDesktop)return Promise.reject(Error("A desktop request is already pending"));if(typeof operation!=="string"||JSON.stringify(args).length>131072)return Promise.reject(Error("Invalid desktop request"));return track(new Promise((resolve,reject)=>{const id=String(++desktopSequence);pendingDesktop={id,resolve,reject};send({channel,session,op:"desktop",id,operation,args},"*")}))},get input(){return structuredClone(input)},onInput(fn){if(typeof fn!=="function")throw Error("Expected a function");listeners.add(fn);if(ready)fn(structuredClone(input));return()=>listeners.delete(fn)},useOutput(values){controlEffects++;if(!ready)return Promise.reject(Error("Preview is loading"));if(pendingAdopt)return Promise.reject(Error("An output choice is already pending"));let serialized;try{serialized=JSON.stringify(values);if(!values||Array.isArray(values)||typeof values!=="object"||serialized.length>4194304)throw Error("Expected bounded output values")}catch(error){return Promise.reject(error)}return track(new Promise((resolve,reject)=>{const id=String(++adoptSequence);pendingAdopt={id,resolve,reject};send({channel,session,op:"use-output",id,outputs:values},"*")}))},previewImage(value){if(!ready)return Promise.reject(Error("Preview is loading"));return track(previews.request("image",value))},run(values){controlEffects++;if(!ready)return Promise.reject(Error("Preview is loading"));if(pending)return Promise.reject(Error("A run is already in progress"));try{dynamicUI.assertCommitted();sharedControls.assertNoComposition();}catch(error){return Promise.reject(error);}let serialized;try{serialized=JSON.stringify(values);if(!values||Array.isArray(values)||typeof values!=="object"||serialized.length>4194304)throw Error("Expected bounded input values")}catch(error){return Promise.reject(error)}return track(new Promise((resolve,reject)=>{const id=String(++sequence),requested=JSON.parse(serialized),sourceRevision=inputRevision,localRevision=editRevision,call={id,resolve,reject,sent:false};pending=call;Promise.resolve().then(()=>dynamicUI.flushAll()).then(()=>sharedControls.flushAll()).then(()=>sharedDocuments.flushAll()).then(()=>sharedLifecycle.flushSharedWrites()).then(()=>{dynamicUI.assertCommitted();sharedControls.assertNoComposition();if(pending!==call||!ready)throw Error("Preview was closed before its edits were saved.");if(inputRevision!==sourceRevision||editRevision!==localRevision)throw Error("The input changed while edits were saving. Review it before running again.");const savedText=textControls?.getValues?.()||{};for(const [key,value] of Object.entries(savedText)){const captured=typeof requested[key]==="string"?requested[key]:typeof requested[key]?.text==="string"?requested[key].text:null;if(captured!==null&&captured!==value)throw Error("The input changed while shared text was saving. Review it before running again.");}if(!sharedAPI.getShared().canEdit)throw Error("Shared editing is unavailable or read only.");call.sent=true;send({channel,session,op:"run",id,input:requested},"*");}).catch(error=>{if(pending===call){pending=null;call.reject(error);}});}))}});Object.defineProperty(globalThis,"StillMade",{value:api,writable:false,configurable:false});addEventListener("message",event=>{if(event.source!==parent||!event.data||event.data.channel!==channel||event.data.session!==session)return;const data=event.data;if(data.op==="inspect-view-controls"){controlSnapshot(data.offset,false);return;}if(data.op==="dispatch-named-text"&&typeof data.id==="string"){Promise.resolve().then(()=>textControls.dispatchNative(data.control,data.id)).then(()=>send({channel,session,op:"named-text-result",token:${eH(o)},id:data.id},"*"),error=>send({channel,session,op:"named-text-result",token:${eH(o)},id:data.id,error:String(error.message).slice(0,1000)},"*")).finally(()=>send({channel,session,op:"named-text-controls",token:${eH(o)},snapshot:textControls.inspectNative()},"*"));return;}if(data.op==="inspect-named-text"){if(textControls)send({channel,session,op:"named-text-controls",token:${eH(o)},snapshot:textControls.inspectNative()},"*");return;}if(data.op==="dispatch-view-control"&&typeof data.id==="string"){if(assisted){send({channel,session,op:"view-control-result",id:data.id,error:"A declared control is already running"},"*");return;}assisted=true;trackedFailure=null;const controlDocumentSeal=sharedDocuments.captureControlSettlement(),controlSharedSeal=sharedLifecycle.captureControlState(),controlInputRevision=inputRevision,controlEffectRevision=controlEffects;const personalControlUnchanged=()=>controlDocumentSeal&&inputRevision===controlInputRevision&&controlEffects===controlEffectRevision&&JSON.stringify(sharedLifecycle.captureControlState())===JSON.stringify(controlSharedSeal)&&!controlSharedSeal.closed&&controlSharedSeal.ready&&!controlSharedSeal.pending&&!controlSharedSeal.queued&&!controlSharedSeal.failed&&sharedDocuments.unchangedControlSettlement(controlDocumentSeal);dynamicUI.dispatchControl(data.control,async()=>{for(let round=0;round<16;round++){await Promise.allSettled(Array.from(trackedCalls));await dynamicUI.flushAll();await sharedControls.flushAll();if(personalControlUnchanged())await sharedDocuments.settleControl(controlDocumentSeal);else await sharedDocuments.flushAll();await sharedLifecycle.flushSharedWrites();await new Promise(resolve=>setTimeout(resolve,0));if(trackedFailure)throw trackedFailure;if(!trackedCalls.size){if(controlDocumentSeal&&!personalControlUnchanged())await sharedDocuments.flushAll();dynamicUI.assertCommitted();sharedControls.assertNoComposition();return;}}throw Error("Declared action did not settle");}).then(()=>send({channel,session,op:"view-control-result",id:data.id},"*"),error=>send({channel,session,op:"view-control-result",id:data.id,error:String(error?.message||"Declared action failed").slice(0,1000)},"*")).finally(()=>{assisted=false;controlSnapshot()});return;}if(data.op==="flush-shared"&&typeof data.id==="string"){Promise.resolve().then(()=>dynamicUI.flushAll()).then(()=>sharedControls.flushAll()).then(()=>sharedDocuments.flushAll()).then(()=>sharedLifecycle.flushSharedWrites()).then(()=>dynamicUI.flushAll()).then(()=>sharedControls.assertNoComposition()).then(()=>send({channel,session,op:"flush-shared-result",id:data.id},"*"),error=>send({channel,session,op:"flush-shared-result",id:data.id,error:String(error?.message||"Pending edits could not be confirmed").slice(0,1000)},"*"));return;}if(data.op==="desktop-result"&&pendingDesktop&&data.id===pendingDesktop.id){const call=pendingDesktop;pendingDesktop=null;data.error?call.reject(Error(data.error)):call.resolve(data.result)}else if(data.op==="use-output-result"&&pendingAdopt&&data.id===pendingAdopt.id){const call=pendingAdopt;pendingAdopt=null;data.error?call.reject(Error(data.error)):call.resolve(data.outputs)}else if(data.op==="input"){inputRevision+=1;if(pending&&!pending.sent){pending.reject(Error("Preview input changed before its edits were saved."));pending=null;}clearMedia();previews.reset();if(pendingImage)pendingImage.reject(Error("Preview input changed"));pendingImage=null;if(pendingAdopt)pendingAdopt.reject(Error("Preview input changed"));pendingAdopt=null;input=data.input;ready=true;for(const fn of listeners)try{fn(structuredClone(input))}catch(error){send({channel,session,op:"interface-error",error:String(error?.message||"The Block interface could not display its input").slice(0,1000)},"*")}}else if(data.op==="result"&&pending?.sent&&data.id===pending.id){const call=pending;pending=null;data.error?call.reject(Error(data.error)):call.resolve(data.outputs)}else if(data.op==="preview-media-result"&&pendingImage?.media&&data.id===pendingImage.id){const call=pendingImage;pendingImage=null;if(data.error)call.reject(Error(data.error));else{try{const url=URL.createObjectURL(data.preview.blob);mediaURLs.add(url);call.resolve({kind:data.preview.kind,url,mimeType:data.preview.blob.type,bytes:data.preview.blob.size})}catch(error){call.reject(error)}}}else if(data.op==="preview-image-result"&&pendingImage&&data.id===pendingImage.id){const call=pendingImage;pendingImage=null;data.error?call.reject(Error(data.error)):call.resolve(data.preview)}else if(data.op==="dispose"){clearMedia();previews.reset("Preview was reset");dynamicUI.dispose();sharedControls.dispose();textControls?.dispose();sharedDocuments.dispose();if(pendingDesktop)pendingDesktop.reject(Error("Block was closed"));pendingDesktop=null;if(pendingAdopt)pendingAdopt.reject(Error("Preview was reset"));pendingAdopt=null;if(pendingImage)pendingImage.reject(Error("Preview was reset"));pendingImage=null;if(pending)pending.reject(Error("Preview was reset"));pending=null;listeners.clear();ready=false}});addEventListener("input",()=>{editRevision+=1;},true);addEventListener("change",()=>{editRevision+=1;},true);addEventListener("compositionstart",()=>{editRevision+=1;},true);addEventListener("keydown",event=>{if(event.key==="Escape")send({channel,session,op:"escape"},"*")},true);addEventListener("click",event=>{if(event.target.closest?.("a,area"))event.preventDefault()},true);send({channel,session,op:"ready"},"*");})();`,_=u?`document.currentScript.remove();for(const node of document.querySelectorAll("[data-stillmade-share]")){if(!node.id||document.getElementById(node.id)!==node)throw Error("Each shared control needs a unique ID");StillMade.bindShared(node.getAttribute("data-stillmade-share"),node.id)}\n${yV(e.javascript||``,h)}`.replace(/<\/script/gi,`<\\/script`):`document.currentScript.remove();((${m})=>{"use strict";delete globalThis[${eH(m)}];for(const node of document.querySelectorAll("[data-stillmade-share]")){if(!node.id||document.getElementById(node.id)!==node)throw Error("Each shared control needs a unique ID");StillMade.bindShared(node.getAttribute("data-stillmade-share"),node.id)}\n${uV(e.javascript||``,m)}\n})(globalThis[${eH(m)}]);`.replace(/<\/script/gi,`<\\/script`);return`<!doctype html><html data-mode="${[`dark`,`white`].includes(n)?n:`light`}"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover"><meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'nonce-${p}'; style-src 'unsafe-inline'; img-src data: blob:; media-src data: blob:;${u?` font-src data: blob:;`:``} connect-src 'none'; frame-src 'none'; worker-src ${u?`blob:`:`'none'`}; object-src 'none'; base-uri 'none'; form-action 'none';"><meta name="referrer" content="no-referrer"><style>${DV.replace(/@font-face\s*\{[^}]*\}/g,``)}${u?$V:QV}${kV}${(f||``).replace(/<\/style/gi,`<\\/style`)}@media(pointer:coarse){input,textarea,select{font-size:16px!important}}</style></head><body>${e.html}<script nonce="${p}">${g.replace(/<\/script/gi,`<\\/script`)}<\/script><script nonce="${p}">document.currentScript.remove();(${NV.toString()})(${eH(XV)},${eH(t)});(${PV.toString()})(${eH(XV)},${eH(t)});(${MV.toString()})(${eH(XV)},${eH(t)},((validateCursorAnchor)=>(${jV.toString()}))(${AV.toString()}));<\/script><script nonce="${p}">${_}<\/script></body></html>`}function uH({view:e,input:t={},sharedView:n=null,presenceKey:r=null,peers:i=[],actorId:a=null,onSharedChange:o,sharedText:s=null,sharedWork:c=null,connectedApp:l=null,onRun:u,onUseOutput:d,onPreviewImage:f,onPreviewMedia:p,onError:m,policyContent:h,policyParent:g,currentAppViewPolicy:_=null,title:v=`Block preview`,height:y=480,fitContent:C=!1,resetKey:w=0,theme:T,appearance:E=`package`,lockedInputKeys:D=[],agentContext:O=null}){let k=rH(e),A=rH(h),j=rH(g),M=[`comfyui`,`capability`].includes(A?.manifest?.runtime)||!!A?.manifest?.desktopTools?.length,N=A?.capability?.operation===`image.generate`?9e5:36e4,P=(0,Q.useRef)(null),F=(0,Q.useRef)({onSharedChange:o,onRun:u,onUseOutput:d,onPreviewImage:f,onPreviewMedia:p,onError:m}),I=(0,Q.useRef)(t),[ee,te]=(0,Q.useState)(``),[ne,re]=(0,Q.useState)(0),ie=(0,Q.useRef)(null),ae=(0,Q.useRef)(null),[oe,se]=(0,Q.useState)(null),[ce,le]=(0,Q.useState)(null),ue=(0,Q.useContext)(FV),de=(0,Q.useRef)(ue);de.current=ue;let[fe,pe]=(0,Q.useState)(null),[me,he]=(0,Q.useState)(null),[ge,_e]=(0,Q.useState)(()=>globalThis.document?.documentElement?.dataset.mode||`light`),ve=(0,Q.useRef)(`light`);ve.current=[`dark`,`white`].includes(T||ge)?T||ge:`light`;let ye=(0,Q.useRef)(l);ye.current=l;let be=(0,Q.useRef)(c);be.current=c;let xe=(0,Q.useRef)(s);xe.current=s;let Se=(0,Q.useRef)(!1),[Ce,we]=(0,Q.useState)(()=>({enabled:!!s,projectId:s?.projectId??null,placementId:s?.placementId??null})),Te=()=>{let e={enabled:!!xe.current,projectId:xe.current?.projectId??null,placementId:xe.current?.placementId??null};we(t=>t.enabled===e.enabled&&t.projectId===e.projectId&&t.placementId===e.placementId?t:e)};(0,Q.useEffect)(()=>{Se.current||Te()},[!!s,s?.projectId,s?.placementId]);let Ee=Ce.enabled,De=Ce.projectId,Oe=Ce.placementId,ke=!!me?.count&&!!(me.dirty||me.pending||me.error);(0,Q.useEffect)(()=>{let e=globalThis.document.documentElement,t=new MutationObserver(()=>_e(e.dataset.mode||`light`));return t.observe(e,{attributes:!0,attributeFilter:[`data-mode`]}),()=>t.disconnect()},[]);let Ae=(0,Q.useMemo)(()=>{try{let e=tH(t);return{value:e,signature:dt(e)}}catch(e){return{error:e.message}}},[t]);F.current={onSharedChange:o,onRun:u,onUseOutput:d,onPreviewImage:f,onPreviewMedia:p,onError:m},I.current=Ae;let[je,Me]=(0,Q.useState)(null),Ne=_?je?.handle===_&&je.allowed:!A||je?.content===A&&je.parent===j&&je.allowed;(0,Q.useEffect)(()=>{if(!A&&!_)return;let e=!0,t=new AbortController;return Me(null),(_?x(_,{signal:t.signal}):Promise.all([A,...j?[j]:[]].map(e=>GV(e,{signal:t.signal})))).then(()=>{e&&Me({handle:_,content:A,parent:j,allowed:!0})},t=>{e&&(Me({handle:_,content:A,parent:j,allowed:!1,error:t.message}),F.current.onError?.(t))}),()=>{e=!1,t.abort()}},[A,j,_,ne]);let Pe=gV(k)&&k.files?k.files:null,[Fe,Ie]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{if(!Pe||!Ne){Ie(null);return}let e=!0,t=new AbortController;return Ie(null),Promise.resolve().then(()=>(lV(k),Sr(()=>Promise.resolve().then(()=>(YV(),KV)),void 0))).then(({loadViewAssets:e})=>e(Pe,{signal:t.signal})).then(t=>{e&&Ie({files:Pe,assets:t})},t=>{e&&Ie({files:Pe,error:String(t?.message||`The interface files could not be loaded.`)})}),()=>{e=!1,t.abort()}},[k,Pe,Ne]);let Le=Pe?Fe?.files===Pe?Fe:{loading:!0}:null,Re=JSON.stringify([...new Set(D.filter(e=>typeof e==`string`))].sort()),ze=[k,Le,w,E,ne,a,r,M,N,C,Ee,De,Oe,Re,!!A?.manifest?.sharedWork,A?.capability?.operation],Be=(0,Q.useRef)(null);if(!Be.current||ze.some((e,t)=>!Object.is(e,Be.current.inputs[t]))){let e;try{if(Le?.loading)throw Object.assign(Error(`Loading the interface files.`),{loading:!0});if(Le?.error)throw Error(Le.error);let t=ZV(),n=ZV();e={session:t,nativeTextToken:n,html:lH(k,t,ve.current,E,Ee,JSON.parse(Re),n,!!A?.manifest?.sharedWork,A?.capability?.operation===`connection.execute`,{assets:Le?.assets||{}})}}catch(t){e=t.loading?{loading:!0}:{error:t.message}}Be.current={inputs:ze,document:e}}let Ve=Be.current.document,He=(0,Q.useMemo)(()=>({state:{},outputs:{},memory:null,canEdit:!0,localOnly:!0}),[Ve.session]),Ue=(0,Q.useRef)(n);Ue.current=n??He;let We=(0,Q.useRef)(n==null);We.current=n==null;let Ge=(0,Q.useRef)({session:null,count:0}),Ke=(0,Q.useRef)(null),qe=(0,Q.useRef)(null),Je=(0,Q.useRef)(null),Ye=(0,Q.useRef)(null),Xe=(0,Q.useRef)(null);Ye.current={key:r,peers:i,actorId:a};let Ze=(0,Q.useRef)(null),Qe=(0,Q.useRef)(null);Qe.current={input:Ae.signature,error:Ae.error,view:k,policyContent:A,policyParent:j,resetKey:w,appearance:E,policyReady:Ne};let $e=(0,Q.useRef)(null);$e.current=dt([O?.projectId,O?.placementId,O?.sourceDigest,a].map(e=>e??null));let[et,tt]=(0,Q.useState)(null),nt=dt([Et(),a,$e.current,Ve.session,Ae.signature,Ne].map(e=>e??null));(0,Q.useEffect)(()=>{let e=!0;if(tt(null),!O?.projectId||!O?.placementId||!O?.sourceDigest||Ae.error||!Ne||a!==Et())return()=>{e=!1};let t=nt;return ft(Ae.value).then(n=>{e&&tt({basis:t,value:{version:1,actorId:a,projectId:O.projectId,placementId:O.placementId,sourceDigest:O.sourceDigest,inputDigest:n}})},()=>{e&&tt(null)}),()=>{e=!1}},[nt]),et?.basis===nt&&et.value;let[rt,it]=(0,Q.useState)(null),at=(0,Q.useRef)(null),ot=(0,Q.useRef)(null),[st,ct]=(0,Q.useState)(null),[lt,ut]=(0,Q.useState)(!1),[pt,L]=(0,Q.useState)(!1),[ht,gt]=(0,Q.useState)(null);ht&&ht.actor===a&&ht.runtimeActor===Et()&&ht.identity===$e.current&&ht.session===Ve.session&&Object.keys(ht.authority).every(e=>ht.authority[e]===Qe.current[e])&&ht.evidence,{...O},A?.manifest?.id,A?.manifest?.version,Ve.session,Ae.signature,Ue.current?.canEdit,{...O},Ve.session,Ae.signature,Ue.current?.canEdit,(0,Q.useEffect)(()=>{if(it(null),ct(null),L(!1),ut(!1),gt(null),te(``),le(null),pe(null),he(null),Ve.error||Ve.loading||!Ne)return;let e=!0,t=!1,n=!1,i=null,o=null,s=null,c=0,l=0,u=[],d=[],f=0,p=0,m,h=0,g=null,_=[],v=0,y=null,b=0,x=0,w=null,T=gV(k),E=()=>{let t;return t=bR(A,{onStatus:n=>{e&&m===t&&se(n)},storageScope:`${a||`anonymous`}:${r||`preview`}`}),t};m=E(),ie.current=m,se(null);let D=()=>{if(!e||!Ue.current?.canEdit)return;let t=m;m=E(),ie.current=m,g=null,se(null),Promise.resolve(t.close()).catch(()=>{})};ae.current=D;let O=t=>{e&&P.current?.contentWindow?.postMessage({channel:XV,session:Ve.session,...t},`*`)},j=null,ee=null,ne=0,re=!1,oe=a,ce=Qe.current,ue=$e.current,fe=(t,n)=>{if(!e||re||t?.signal?.aborted||Et()!==oe||$e.current!==ue||ee&&I.current.signature!==ee.inputIdentity||j&&I.current.signature!==j.inputIdentity&&I.current.signature!==n||Object.keys(ce).filter(e=>e!==`input`).some(e=>ce[e]!==Qe.current[e]))throw re=!0,L(!1),Error(`The declared interface source, account or task changed. Reload the preview before further assisted edits.`)},me=e=>{if(!j)return;let t=j;j=null,clearTimeout(t.timer),t.context?.signal?.removeEventListener(`abort`,t.abort),ut(!1),t.reject(e)};ot.current={request:(e,n,r={})=>new Promise((a,o)=>{try{if(fe(r),!t||j)throw Error(`The declared interface is loading or busy.`);if(e===`dispatch-view-control`&&!r.taskFence)throw Error(`The declared interface requires its active project task.`);let s=String(++ne),c=()=>{re=!0,L(!1),i?.abort(),me(Error(`Declared action stopped; reload the preview before more assisted edits.`))},l=setTimeout(c,N);j={id:s,op:e,inputIdentity:I.current.signature,offset:n.offset,context:r,resolve:a,reject:o,timer:l,abort:c},r.signal?.addEventListener(`abort`,c,{once:!0}),e===`dispatch-view-control`&&ut(!0),O({op:e,id:s,...n})}catch(e){o(e)}})},at.current={request:(e,n)=>new Promise((r,i)=>{try{if(fe(n),!t||j||ee||!n.taskFence||n.signal?.aborted)throw Error(`The original text requires its idle current task.`);let a=String(++ne),o=()=>{re=!0,L(!1),ee?.id===a&&(ee=null,ut(!1),i(Error(`Original text stopped; retain its pending request.`)))},s=setTimeout(o,N);ee={id:a,field:e.field,inputIdentity:I.current.signature,context:n,resolve:r,reject:i,timer:s,abort:o},n.signal?.addEventListener(`abort`,o,{once:!0}),ut(!0),O({op:`dispatch-named-text`,id:a,control:e})}catch(e){i(e)}})};let ge=()=>{if(re)throw Error(`This previous assisted interface is no longer writable. Reload it to recover.`);return j?.op===`dispatch-view-control`?(fe(j.context),j.context):null},_e=!1,Ce=0,we=[],ke=0,Ae=!1,je=0,Me=[],Pe=0,Fe=0,Ie=[],Le=null,Re=!1,ze={projectId:De,placementId:Oe,actorId:a},Be=()=>e&&xe.current?.projectId===ze.projectId&&xe.current?.placementId===ze.placementId,He=e=>({message:String(e?.message||`Shared text failed.`).slice(0,1e3),...typeof e?.code==`string`&&/^[A-Z][A-Z0-9_]{0,79}$/.test(e.code)?{code:e.code}:{}}),Ge=xe.current?.projectId&&a?Rn({projectId:xe.current.projectId,actorId:a,headers:zn,onChange:e=>{if(Be()){if(e.kind===`revoked`){Re=!0,O({op:`shared-view`,value:{...Ue.current,canEdit:!1}});return}[`text`,`document`,`resync`].includes(e.kind)&&(e.scope&&e.scope!==`canvas`||Le===null&&(Le=setTimeout(()=>{Le=null,t&&Be()&&!Re&&O({op:`text-refresh`})},100)))}}}):null,et=be.current?.projectId&&a?Rn({projectId:be.current.projectId,actorId:a,headers:zn,onChange:e=>{t&&[`document`,`resync`,`revoked`,`connection-access`].includes(e.kind)&&(ke++,O({op:`shared-work-refresh`}))}}):null,tt=()=>{t&&O({op:`theme`,mode:ve.current})};Xe.current=tt;let nt=`[]`,rt=()=>{if(!t)return;let{key:e,peers:n,actorId:r}=Ye.current,i=!We.current&&e&&localStorage.getItem(`stillmade:show-shared-cursors`)!==`false`?n.filter(t=>t.user_id!==r&&t.selection?.cursor?.visible&&t.selection.cursor.surface===e).slice(0,50).flatMap(e=>{let t=AV(e.selection.cursor.anchor);return t?[{id:String(e.session_id).slice(0,200),label:String(e.label||`Teammate`).slice(0,120),anchor:t}]:[]}):[],a=JSON.stringify(i);a!==nt&&(nt=a,O({op:`peer-cursors`,peers:i}))};Je.current=rt,window.addEventListener(`stillmade:cursor-preferences`,rt),window.addEventListener(`storage`,rt);let st=e=>{te(e),F.current.onError?.(Error(e))},lt=()=>{e&&(clearInterval(y),w?.disconnect(),st(`This interface stopped responding and was closed. Reload it to try again.`),e=!1,i?.abort(),P.current&&(P.current.src=`about:blank`))};Ke.current=T?()=>{e&&(clearInterval(y),st(`This interface tried to leave its frame and was closed. Reload it to try again.`),e=!1,i?.abort(),P.current&&(P.current.src=`about:blank`))}:null;let ft=()=>{if(typeof PerformanceObserver!=`function`||!PerformanceObserver.supportedEntryTypes?.includes(`longtask`))return;let e=[],t=e=>Array.from(e.attribution||[]).some(e=>e.containerType===`iframe`&&typeof e.containerSrc==`string`&&e.containerSrc.endsWith(`#${Ve.session}`));w=new PerformanceObserver(n=>{for(let r of n.getEntries()){if(!t(r))continue;let n=r.startTime+r.duration;if(e=e.filter(e=>e.end>n-5e3),e.push({end:n,duration:r.duration}),r.duration>=dV.longTaskMs||e.reduce((e,t)=>e+t.duration,0)>=3500)return lt()}});try{w.observe({type:`longtask`})}catch{w=null}},pt=()=>{b=Date.now(),y=setInterval(()=>{if(!e)return clearInterval(y);if(globalThis.document.visibilityState!==`hidden`&&Date.now()-b>8e3)return lt();O({op:`ping`,id:String(++x)})},2e3)},ht=setTimeout(()=>{e&&!t&&(st(`The preview could not start. Reload it to try again.`),e=!1,i?.abort(),P.current&&(P.current.src=`about:blank`))},15e3),_t=e=>{let t=o;t&&(gt(null),o=null,t.controller.abort(),e&&O({op:t.media?`preview-media-result`:`preview-image-result`,id:t.id,error:e}))},vt=()=>{if(!t)return;let e=I.current;if(e.error){_t(`Preview input is unavailable.`),st(e.error);return}s!==e.signature&&(_t(`Preview input changed. Use its current image.`),s=e.signature,O({op:`input`,input:e.value}))};Ze.current=vt;let yt=null,bt=!1,xt=0,St=[],wt=null,Tt=0,Dt=null,Ot=Pn(()=>{if(We.current||!t)return Promise.resolve();if(!e)return Promise.reject(Error(`The Block interface is unavailable. Its latest edits could not be checked.`));if(wt)return wt.promise;let n=String(++Tt),r,i,a=new Promise((e,t)=>{r=e,i=t}),o=setTimeout(()=>{wt?.id===n&&(wt=null,i(Error(`The Block did not confirm its pending edits. Stay here to recover the draft.`)))},17e3);return wt={id:n,promise:a,resolve:r,reject:i,timer:o},O({op:`flush-shared`,id:n}),a}),kt=()=>{if(t&&Ue.current)try{let e=tH(Ue.current),t=dt(e);if(t===yt)return;yt=t,O({op:`shared-view`,value:e})}catch(e){st(e.message)}};qe.current=kt;let At=t=>{e&&We.current&&(Ue.current.outputs=t,kt())},jt=r=>{let s=r.data;if(T&&e&&mt(s)&&s.op===`navigated`&&s.channel===XV&&s.session===Ve.session&&(r.source===null||r.source===P.current?.contentWindow)){Ke.current?.();return}if(!e||r.source!==P.current?.contentWindow||!mt(s)||s.channel!==XV||s.session!==Ve.session)return;if(s.op===`document-ready`){n||(n=!0,O({op:`document`,html:Ve.html}));return}if(s.op===`ready`){t||(t=!0,clearTimeout(ht),T&&(pt(),ft()),tt(),vt(),kt(),rt(),O({op:`inspect-view-controls`,offset:0}),O({op:`inspect-named-text`}));return}if(s.op===`flush-shared-result`){if(!wt||s.id!==wt.id)return;let e=wt;wt=null,clearTimeout(e.timer);let t=s.error||Dt;t?e.reject(Error(String(t).slice(0,1e3))):e.resolve({queued:!0});return}if(s.op===`escape`){let e=Date.now();globalThis.document.activeElement===P.current&&e-v>=300&&(v=e,window.dispatchEvent(new KeyboardEvent(`keydown`,{key:`Escape`,bubbles:!0})));return}if(s.op===`pong`){T&&typeof s.id==`string`&&(b=Date.now());return}if(s.op===`unresponsive`){T&&lt();return}if(s.op===`interface-error`){st(String(s.error||`The Block interface could not display its input`).slice(0,1e3));return}if(s.op===`document-store-status`){let e=s.status;mt(e)&&[`count`,`dirty`,`pending`,`readonly`].every(t=>Number.isInteger(e[t])&&e[t]>=0&&e[t]<=8)&&[`dirty`,`pending`,`readonly`].every(t=>e[t]<=e.count)&&(e.error===null||typeof e.error==`string`&&e.error.length<=1e3)&&pe(e);return}if(s.op===`text-recovery-status`){let e=s.status;Ee&&mt(e)&&Object.keys(e).every(e=>[`count`,`dirty`,`pending`,`readonly`,`error`,`retryable`].includes(e))&&[`count`,`dirty`,`pending`,`readonly`].every(t=>Number.isInteger(e[t])&&e[t]>=0&&e[t]<=100)&&[`dirty`,`pending`,`readonly`].every(t=>e[t]<=e.count)&&(e.error===null||typeof e.error==`string`&&e.error.length<=1e3)&&typeof e.retryable==`boolean`&&he(e);return}if(!t)return;if(s.op===`named-text-controls`){if(s.token===Ve.nativeTextToken&&Array.isArray(s.snapshot)&&s.snapshot.length<=50){let e=tH(s.snapshot);e.every(e=>mt(e)&&typeof e.field==`string`&&typeof e.identity==`string`&&typeof e.value==`string`&&e.value.length<=1e4&&typeof e.partial==`boolean`&&typeof e.ready==`boolean`&&typeof e.disabled==`boolean`)&&it(e)}return}if(s.op===`named-text-result`){let e=ee;if(!e||s.id!==e.id||s.token!==Ve.nativeTextToken)return;try{if(fe(e.context),s.error)throw Error(String(s.error).slice(0,1e3));e.resolve()}catch(t){e.reject(t)}finally{ee=null,clearTimeout(e.timer),e.context.signal?.removeEventListener(`abort`,e.abort),ut(!1)}return}if(s.op===`view-controls`){try{let e=tH(s.snapshot);if(!mt(e)||!Number.isSafeInteger(e.revision)||!Number.isSafeInteger(e.total)||e.total<0||e.total>1e4||!Number.isSafeInteger(e.offset)||!Array.isArray(e.controls)||e.controls.length>20||e.controls.some(e=>!mt(e)||typeof e.id!=`string`||typeof e.identity!=`string`||typeof e.action!=`string`||typeof e.disabled!=`boolean`||typeof e.hidden!=`boolean`))throw Error(`Invalid declared interface controls.`);if(ct(e),L(!re),j?.op===`inspect-view-controls`&&e.offset===j.offset){let e=j;fe(e.context),j=null,clearTimeout(e.timer),e.context.signal?.removeEventListener(`abort`,e.abort),e.resolve()}}catch(e){me(e)}return}if(s.op===`view-controls-error`){me(Error(String(s.error||`Declared controls are unavailable.`).slice(0,1e3)));return}if(s.op===`view-control-result`){if(j?.op!==`dispatch-view-control`||s.id!==j.id)return;let e=j;try{if(fe(e.context),s.error)throw Error(String(s.error).slice(0,1e3));j=null,clearTimeout(e.timer),e.context.signal?.removeEventListener(`abort`,e.abort),ut(!1),e.resolve()}catch(e){me(e)}return}if(s.op===`connected-app-request`){if(typeof s.id!=`string`||!/^\d{1,9}$/.test(s.id)||Number(s.id)<=Ce)return;Ce=Number(s.id);let t=e=>O({op:`connected-app-result`,id:s.id,...e}),n=ye.current,r=Qe.current;we=we.filter(e=>Date.now()-e<6e4);try{if(A?.capability?.operation!==`connection.execute`||!n?.request)throw Error(`Open the saved connected Block to choose its task.`);let i=Ct(s.operation,tH(s.args));if(i.operation!==`tasks`&&!Ue.current?.canEdit)throw Error(`This workspace is read only.`);if(_e||we.length>=30)throw Error(`Wait for the current task request.`);_e=!0,we.push(Date.now()),Promise.resolve().then(()=>n.request(i.operation,i.args)).then(i=>{if(!e||n.projectId!==ye.current?.projectId||n.placementId!==ye.current?.placementId||Object.keys(r).some(e=>r[e]!==Qe.current[e]))throw Error(`The installed app changed. Open its current workspace.`);t({result:tH(i)})},e=>t({error:String(e.message||`Task selection failed.`).slice(0,1e3)})).catch(e=>t({error:String(e.message).slice(0,1e3)})).finally(()=>{_e=!1})}catch(e){t({error:String(e.message).slice(0,1e3)})}return}if(s.op===`shared-work-media-request`){if(typeof s.id!=`string`||!/^\d{1,9}$/.test(s.id)||Number(s.id)<=je)return;je=Number(s.id);let t=be.current,n=Qe.current,r=ke,i=e=>O({op:`shared-work-result`,id:s.id,...e});try{if(!A?.manifest?.sharedWork||!A.manifest.permissions?.project?.includes(`work.shared`)||!t?.previewMedia||typeof s.contributionId!=`string`||!/^[0-9a-f-]{36}$/i.test(s.contributionId))throw Error(`Choose a permitted saved creative in this workspace.`);if(Me=Me.filter(e=>Date.now()-e<6e4),Ae||Me.length>=60)throw Error(`Wait for the current media preview.`);Ae=!0,Me.push(Date.now()),Promise.resolve().then(()=>t.previewMedia(s.contributionId,{signal:AbortSignal.timeout(3e4)})).then(t=>{if(!e||r!==ke||Object.keys(n).some(e=>n[e]!==Qe.current[e]))throw Error(`This workspace changed before the creative preview.`);if(!(t.media instanceof Blob)||!t.media.size||t.media.size>67108864||![`image`,`video`,`audio`].includes(t.kind)||!t.media.type.startsWith(t.kind+`/`))throw Error(`This preview exceeds the media limit.`);i(t)},e=>i({error:String(e.message||`Media preview failed.`).slice(0,1e3)})).catch(e=>i({error:String(e.message).slice(0,1e3)})).finally(()=>{Ae=!1})}catch(e){i({error:String(e.message).slice(0,1e3)})}return}if(s.op===`shared-work-request`){if(typeof s.id!=`string`||!/^\d{1,9}$/.test(s.id)||Number(s.id)<=je)return;je=Number(s.id);let t=e=>O({op:`shared-work-result`,id:s.id,...e}),n=be.current,r=Qe.current,i=ke;Me=Me.filter(e=>Date.now()-e<6e4);try{if(!A?.manifest?.permissions?.project?.includes(`work.shared`)||!A.manifest.sharedWork||!n?.request)throw Error(`Shared work is unavailable in this preview. Open the saved Block in its project.`);let a=S(s.operation,tH(s.args));if(![`read`,`list`,`accounts`,`grants`,`creatives`].includes(a.operation)&&!Ue.current?.canEdit)throw Error(`This workspace is read only.`);if(Ae||Me.length>=60)throw Error(`Wait for the current shared-work request.`);Ae=!0,Me.push(Date.now()),Promise.resolve().then(()=>n.request(a.operation,a.args)).then(o=>{if(!e||n.projectId!==be.current?.projectId||n.placementId!==be.current?.placementId||Object.keys(r).some(e=>r[e]!==Qe.current[e]))throw Error(`This Block changed before the shared-work response. Reopen its current version.`);if(i!==ke){if([`read`,`list`,`accounts`,`grants`,`creatives`].includes(a.operation))throw Error(`Saved-work access changed. Read its current version.`);t({result:{saved:!0,refreshRequired:!0}});return}t({result:tH(o)})},e=>t({error:String(e.message||`Shared work failed.`).slice(0,1e3)})).catch(e=>t({error:String(e.message).slice(0,1e3)})).finally(()=>{Ae=!1})}catch(e){t({error:String(e.message).slice(0,1e3)})}return}if(s.op===`text-request`){if(typeof s.id!=`string`||!/^\d{1,9}$/.test(s.id)||Number(s.id)<=Fe)return;Fe=Number(s.id);let e=e=>O({op:`text-result`,id:s.id,...e}),t=xe.current,n=I.current.signature,r=Qe.current;if(Ie=Ie.filter(e=>Date.now()-e<6e4),!Ee||!Be()||!t||typeof t.request!=`function`||![`read`,`initialize`,`update`,`reset`].includes(s.action)||typeof s.key!=`string`||!/^[a-zA-Z][a-zA-Z0-9_-]{0,99}$/.test(s.key)||[`constructor`,`prototype`,`__proto__`].includes(s.key)){e({error:{message:`Shared text is unavailable for this field.`}});return}if(Pe>=16||Ie.length>=1200){e({error:{message:`Shared text requests are arriving too quickly. Your draft is retained.`}});return}let i=()=>{if(!Be()||I.current.error||I.current.signature!==n||Object.keys(r).some(e=>r[e]!==Qe.current[e]))throw Error(`Shared text input or workspace changed. Your draft is retained.`);if(Re||s.action!==`read`&&!Ue.current?.canEdit)throw Object.assign(Error(`Shared text is read only.`),{code:`READ_ONLY`})},a;try{if(i(),a=tH(s.body),!mt(a)||new TextEncoder().encode(JSON.stringify(a)).length>5e4||Object.keys(a).some(e=>![`protocol`,`requestId`,`sourceIdentity`,`epoch`,`textRevision`,`value`,`update`].includes(e)))throw Error(`Invalid shared text request.`)}catch(t){e({error:He(t)});return}Pe++,Ie.push(Date.now()),Promise.resolve().then(async()=>{if(i(),ge()&&s.action!==`read`)throw Error(`Assisted shared-text writes require a task-safe native commit interface; this control is unavailable.`);try{let e=ee,n;if(e&&s.action!==`read`){if(fe(e.context),s.action!==`update`||s.key!==e.field||s.nativeText?.token!==Ve.nativeTextToken||s.nativeText?.callId!==e.id)throw Error(`Unrelated text events cannot use this native task.`);n=e.context}else if(s.nativeText)throw Error(`The original text invocation is no longer current; do not replay.`);return await t.request(s.action,{...a,placementId:t.placementId,fieldKey:s.key},n)}catch(e){if(s.action===`read`&&e.code===`SHARED_TEXT_FIELD_UNSUPPORTED`&&typeof Ue.current?.state?.[s.key]!=`string`)return{unsupported:!0};throw e}}).then(t=>{i(),e({result:tH(t)})}).catch(t=>e({error:He(t)})).finally(()=>{Pe--});return}if(s.op===`cursor`){let e=s.cursor;if(mt(e)&&Number.isFinite(e.x)&&Number.isFinite(e.y)&&e.x>=0&&e.x<=1&&e.y>=0&&e.y<=1){let t=P.current?.getBoundingClientRect(),n=AV(e.anchor),r=Ye.current.key;t&&window.dispatchEvent(new CustomEvent(`stillmade:sandbox-cursor`,{detail:{x:(t.left+e.x*t.width)/Math.max(1,window.innerWidth),y:(t.top+e.y*t.height)/Math.max(1,window.innerHeight),visible:e.visible!==!1,...n&&typeof r==`string`&&r.length>0&&r.length<=200&&!We.current?{anchor:n,surface:r}:{}}}))}return}if(s.op===`shared-view-update`){if(typeof s.id!=`string`||!/^\d{1,9}$/.test(s.id)||Number(s.id)<=xt)return;xt=Number(s.id);let t=e=>{Dt=e.error?String(e.error):null,O({op:`shared-view-result`,id:s.id,...e})};if(St=St.filter(e=>Date.now()-e<6e4),bt||St.length>=240){t({error:`Shared edits are arriving too quickly. Wait and retry.`});return}if(!Ue.current?.canEdit||!We.current&&typeof F.current.onSharedChange!=`function`){t({error:`Shared editing is unavailable or read only.`});return}let n;try{if(n=tH(s.request),new TextEncoder().encode(JSON.stringify(n)).length>Wn.requestBytes)throw Error(`Shared edit exceeds the limit`)}catch(e){t({error:e.message});return}bt=!0,St.push(Date.now()),Promise.resolve().then(()=>{if(!e||!Ue.current?.canEdit)throw Error(`Shared editing is unavailable or read only.`);if(ge(),We.current){Ue.current.state=Gn(Ue.current.state,n),kt();return}let t=ge();return F.current.onSharedChange(n,t||void 0)}).then(()=>t({queued:!0}),e=>t({error:String(e.message).slice(0,1e3)})).finally(()=>{bt=!1});return}if(s.op===`content-size`){Number.isInteger(s.height)&&s.height>0&&s.height<=1e5&&de.current?.(s.height),C&&Number.isInteger(s.height)&&s.height>0&&s.height<=1e5&&le(Math.max(280,Math.min(3e4,s.height)));return}if(s.op===`desktop`){if(typeof s.id!=`string`||!/^\d{1,9}$/.test(s.id)||Number(s.id)<=h)return;h=Number(s.id);let t=e=>O({op:`desktop-result`,id:s.id,...e});if(_=_.filter(e=>Date.now()-e<6e4),g||_.length>=120){t({error:`Too many desktop requests. Wait before trying again.`});return}let n;try{if(n=tH(s.args||{}),JSON.stringify(n).length>131072||!mt(n))throw Error(`Desktop arguments exceed the limit`)}catch(e){t({error:e.message});return}let r=![`tool.status`,`storage.info`,`storage.list`,`storage.read`,`record.status`,`device.info`,`record.cancel`,`session.close`].includes(s.operation);if(r&&!Ue.current?.canEdit){t({error:`Desktop changes are unavailable while this workspace is read only.`});return}if(s.operation===`record.cut`){let e=n?.source,r=nH(e),i=[];try{i=iH(I.current?.value).map(nH)}catch{}if(!r||!(m.authorizesMedia(e)||i.includes(r))){t({error:`Cut a video this Block received or recorded in this session.`});return}}let i={native:m};_.push(Date.now()),g=i,Promise.resolve().then(()=>{if(!e||i.native!==m||r&&!Ue.current?.canEdit)throw Error(`Desktop access or edit permission changed before this request.`);if(ge()&&r)throw Error(`Assisted desktop mutations require a task-safe native interface; this control is unavailable.`);return i.native.call(s.operation,n,s.operation===`record.cut`?{received:(()=>{try{return iH(I.current?.value)}catch{return[]}})()}:void 0)}).then(n=>{if(!e||i.native!==m||r&&!Ue.current?.canEdit)throw Error(`Desktop access or edit permission changed before this result could be used.`);t({result:tH(n)})},e=>t({error:String(e.message).slice(0,1e3)})).catch(e=>t({error:String(e.message).slice(0,1e3)})).finally(()=>{g===i&&(g=null)});return}if(s.op===`use-output`){if(typeof s.id!=`string`||!/^[0-9]{1,9}$/.test(s.id))return;let e=e=>O({op:`use-output-result`,id:s.id,...e});try{if(ge())throw Error(`Assisted media adoption requires a task-safe native commit interface; this control is unavailable.`);if(T&&!Ue.current?.canEdit)throw Error(`This workspace is read only.`);let t=tH(s.outputs),n=F.current.onUseOutput;if(typeof n!=`function`)throw Error(`Choosing an existing media output is unavailable in this workspace.`);oH(t,I.current.value,m),Promise.resolve(n(t)).then(t=>{let n=tH(t);At(n),e({outputs:n})},t=>e({error:String(t?.message||`The media output could not be saved`).slice(0,1e3)}))}catch(t){e({error:String(t.message).slice(0,1e3)})}return}if(s.op===`preview-image`||s.op===`preview-media`){let t=s.op===`preview-media`;if(typeof s.id!=`string`||!/^\d{1,9}$/.test(s.id)||Number(s.id)<=l)return;gt(null),l=Number(s.id);let n=e=>O({op:t?`preview-media-result`:`preview-image-result`,id:s.id,...e}),r=Date.now();if(d=d.filter(e=>r-e<6e4),o||d.length>=$B.imagePreviewsPerMinute){++p<=3&&n({error:o?`An image preview is already loading`:`Image preview limit reached. Wait a minute before trying again.`}),p===4&&(st(`Preview paused after too many image requests. Reset it to continue.`),e=!1,_t(),i?.abort(),P.current&&(P.current.src=`about:blank`));return}d.push(r);let c;try{if(c=t?tH(s.value):sH(s.value),t&&(!mt(c)||![`video`,`audio`].includes(c.kind)||![`assetId`,`versionId`,`url`].every(e=>typeof c[e]==`string`&&c[e].length>0&&c[e].length<=32768)))throw Error(`Keep the complete audio or video reference supplied by this workspace.`)}catch(e){n({error:e.message});return}let u=t&&m?.authorizesMedia?.(c)?(e,t)=>Mn(e,t):t?F.current.onPreviewMedia:F.current.onPreviewImage;if(typeof u!=`function`){n({error:t?`Audio/video preview is unavailable in this workspace.`:`Image preview is unavailable in this workspace. Choose an image with the host controls.`});return}let f=new AbortController,h=Qe.current,g={controller:f,id:s.id,media:t};o=g;let _=$e.current,v=a,y=Et(),b=()=>{if(f.signal.aborted||y!==Et()||_!==$e.current||Object.keys(h).some(e=>h[e]!==Qe.current[e]))throw Error(`Image preview input or workspace changed.`)},x=setTimeout(()=>{e&&o===g&&_t(`Image preview timed out. Try a smaller image.`)},$B.imagePreviewMs);f.signal.addEventListener(`abort`,()=>clearTimeout(x),{once:!0}),Promise.resolve().then(()=>(b(),u(c,{signal:f.signal}))).then(r=>{if(e&&!f.signal.aborted&&o===g){if(b(),t&&r?.kind!==c.kind)throw Error(`The host returned a different media kind.`);let e=t?An(r):cH(r);b(),typeof c.assetId==`string`&&c.assetId.length<=512&&typeof c.versionId==`string`&&c.versionId.length<=512&&gt({actor:v,runtimeActor:y,identity:_,session:Ve.session,authority:h,evidence:{assetId:c.assetId,versionId:c.versionId,kind:t?e.kind:`image`,mime:t?e.blob.type:`image/png`,...t?{byteLength:e.blob.size}:{width:e.width,height:e.height},status:`broker-loaded`}}),n({preview:e})}},t=>{e&&!f.signal.aborted&&o===g&&n({error:String(t?.message||`This image could not be previewed`).slice(0,1e3)})}).catch(t=>{e&&!f.signal.aborted&&o===g&&n({error:String(t?.message||`This image could not be previewed`).slice(0,1e3)})}).finally(()=>{clearTimeout(x),o===g&&(o=null)});return}if(s.op!==`run`||typeof s.id!=`string`||!/^\d{1,9}$/.test(s.id)||Number(s.id)<=c)return;c=Number(s.id);let y=e=>O({op:`result`,id:s.id,...e});if(T&&!Ue.current?.canEdit){y({error:`Shared editing is unavailable or read only.`});return}let x=Date.now();if(u=u.filter(e=>x-e<6e4),i||u.length>=$B.runsPerMinute){++f<=3&&y({error:i?`A run is already in progress`:`Preview run limit reached. Wait a minute before trying again.`}),f===4&&(st(`Preview paused after too many requests. Reset it to continue.`),e=!1,_t(),i?.abort(),P.current&&(P.current.src=`about:blank`));return}let w;try{if(!mt(s.input))throw Error(`Expected input values`);w=tH(s.input)}catch(e){y({error:e.message});return}u.push(x),te(``);let E=new AbortController;i=E,Se.current=!0,j?.context.signal?.addEventListener(`abort`,()=>E.abort(),{once:!0});let D=setTimeout(()=>{e&&i===E&&(E.abort(),i=null,y({error:M?`Preview confirmation or execution timed out. Cancellation was requested; the backend may still be finishing.`:`Preview execution timed out. Try a smaller input.`}))},M?N:15e3);E.signal.addEventListener(`abort`,()=>clearTimeout(D),{once:!0});let k=j?.op===`dispatch-view-control`?j:null,ne=k?async e=>{if(j!==k||i!==E||E.signal.aborted||!mt(e)||e.receipt?.status!==`completed`||e.receipt.saved!==!0||dt(e.taskFence)!==dt(k.context.taskFence)||dt([e.projectId,e.placementId,e.sourceDigest,e.actorId])!==ue||dt(tH(e.beforeInput))!==k.inputIdentity)throw Error(`The native input commit does not match this active declared action.`);let t=dt(tH(e.input));for(let e=0;e<25&&I.current.signature!==t;e++)if(fe(k.context,t),await new Promise(e=>setTimeout(e,10)),j!==k||i!==E||E.signal.aborted)throw Error(`The native input commit was stopped before its render.`);if(fe(k.context,t),I.current.signature!==t)throw Error(`The native input commit does not match the current rendered inputs.`);k.inputIdentity=t}:void 0;Promise.resolve().then(()=>F.current.onRun(w,{...ge(),signal:E.signal,...ne?{onInputCommitted:ne}:{},...A?.manifest?.desktopTools?.length?{nativeDesktopSession:m}:{}})).then(t=>{if(e&&!E.signal.aborted){if(!mt(t))throw Error(`Block execution must return named outputs`);let e=tH(t);At(e),y({outputs:e})}},t=>{e&&!E.signal.aborted&&y({error:String(t?.message||`The Block could not run`).slice(0,1e3)})}).catch(t=>{e&&!E.signal.aborted&&y({error:String(t.message).slice(0,1e3)})}).finally(()=>{clearTimeout(D),i===E&&(i=null),Se.current=!1,setTimeout(()=>{e&&!Se.current&&Te()},250)})};return window.addEventListener(`message`,jt),()=>{ee&&=(clearTimeout(ee.timer),ee.context.signal?.removeEventListener(`abort`,ee.abort),ee.reject(Error(`Original text closed; retain its pending request.`)),null),at.current=null,me(Error(`The declared interface was closed.`)),ot.current=null,Ge?.(),et?.(),clearTimeout(Le),Ot(),wt&&=(clearTimeout(wt.timer),wt.reject(Error(`Block closed before pending edits were confirmed.`)),null),clearTimeout(ht),clearInterval(y),w?.disconnect(),O({op:`dispose`}),e=!1,m.close(),ie.current===m&&(ie.current=null),ae.current===D&&(ae.current=null),_t(),i?.abort(),Se.current=!1,window.removeEventListener(`message`,jt),window.removeEventListener(`stillmade:cursor-preferences`,rt),window.removeEventListener(`storage`,rt),Je.current=null,Ze.current=null,qe.current=null}},[Ve,Ne,M,N,C,r,a,De,Oe]),(0,Q.useEffect)(()=>{Ze.current?.()},[t]),(0,Q.useEffect)(()=>{qe.current?.(),n?.canEdit===!1&&Promise.resolve(ie.current?.close()).catch(()=>{})},[n,Ne]),(0,Q.useEffect)(()=>{Je.current?.()},[i,r,a,n]),(0,Q.useEffect)(()=>{Xe.current?.()},[T,ge]);let _t=!!globalThis.stillmadeDesktop?.blockDesktop;return(0,$.jsxs)(`div`,{className:`bs-sandbox-ui`,children:[oe?.awaitingStart&&(0,$.jsxs)(`div`,{className:`bs-notice`,role:`status`,children:[(0,$.jsx)(`p`,{children:oe.kind===`camera`?`Ready to record your camera. This Block records only after you press Start.`:oe.kind===`microphone`?`Ready to record your microphone. This Block records only after you press Start.`:oe.microphone?`Ready to record your screen with your microphone. Choose your screen or window after pressing Start.`:`Ready to record. Choose your screen or window after pressing Start.`}),(0,$.jsx)(`button`,{type:`button`,className:`btn`,onClick:oe.start,children:oe.kind===`camera`?`Start camera recording`:oe.kind===`microphone`?`Start microphone recording`:`Start screen recording`}),(0,$.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>ie.current?.close(),children:`Cancel`})]}),oe?.active&&(0,$.jsxs)(`div`,{role:`status`,className:`bs-notice`,children:[(0,$.jsxs)(`strong`,{children:[oe.ended?`Recording stopped`:`Recording`,` `,oe.kind||`media`]}),(0,$.jsxs)(`span`,{children:[` · `,oe.ended?oe.message:_t?`This Block has temporary desktop access.`:`Recording runs in StillMade, outside the Block.`]}),(0,$.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>ie.current?.close(),children:_t?`Cancel recording and revoke access`:`Discard recording`})]}),_t&&oe?.closed&&A?.manifest?.permissions?.desktop?.length>0&&(0,$.jsx)(`button`,{type:`button`,className:`btn`,disabled:!Ne||!Ue.current?.canEdit,onClick:()=>ae.current?.(),children:`Reopen desktop access`}),_t&&!oe?.closed&&!oe?.active&&A?.manifest?.permissions?.desktop?.length>0&&(0,$.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>ie.current?.close(),children:`Revoke this Block’s desktop access`}),Ve.loading?(0,$.jsx)(`p`,{role:`status`,children:`Loading the interface…`}):Ve.error?(0,$.jsxs)(`p`,{role:`alert`,children:[`This interface cannot be previewed: `,Ve.error]}):Ne?(0,$.jsx)(`iframe`,{ref:P,onLoad:()=>{Ge.current.session!==Ve.session&&(Ge.current={session:Ve.session,count:0}),++Ge.current.count>2&&Ke.current?.()},title:v,sandbox:`allow-scripts`,referrerPolicy:`no-referrer`,src:`${b(`/block-ui-sandbox.html`)}#${Ve.session}`,style:{width:`100%`,height:C&&ce||y,minHeight:280,border:`1px solid var(--border-tok)`,borderRadius:`var(--r-3)`,background:`var(--bg)`}},Ve.session):(0,$.jsx)(`p`,{role:je?.error?`alert`:`status`,children:je?.error||`Checking Block safety…`}),fe?.count>0&&(fe.error?(0,$.jsx)(`p`,{role:`alert`,className:`bs-notice`,children:fe.error}):fe.dirty||fe.pending?(0,$.jsx)(`p`,{role:`status`,className:`bs-notice`,children:`Sharing changes…`}):null),me?.count>0&&(me.error||me.dirty||me.pending)?(0,$.jsxs)(`div`,{className:`bs-notice`,role:me.error?`alert`:`status`,children:[(0,$.jsx)(`p`,{children:me.error||`Saving shared text…`}),me.error&&(0,$.jsx)(`p`,{children:`Your text is retained here. Copy it before leaving; reloading cannot safely recover an unacknowledged draft.`}),me.retryable&&(0,$.jsx)(`button`,{type:`button`,className:`btn`,disabled:me.pending>0||!Ue.current?.canEdit,onClick:()=>P.current?.contentWindow?.postMessage({channel:XV,session:Ve.session,op:`text-retry`},`*`),children:`Retry save`})]}):null,(ee||je?.error)&&(0,$.jsxs)($.Fragment,{children:[ee&&(0,$.jsx)(`p`,{role:`alert`,children:ee}),(0,$.jsx)(`button`,{type:`button`,className:`btn`,disabled:ke,onClick:()=>{ke||re(e=>e+1)},children:`Reload preview`})]})]})}var dH=[[`light`,`Light`],[`dark`,`Dark`],[`white`,`White`]],fH=[[`full`,`Full width`,null],[`tablet`,`Tablet`,768],[`phone`,`Phone`,390]],pH=e=>{let t=JSON.stringify(e);return t.length>160?`${t.slice(0,157)}...`:t},mH=(e,t)=>{try{return localStorage.getItem(e)||t}catch{return t}},hH=(e,t)=>{try{localStorage.setItem(e,t)}catch{}};async function gH(e){return(await fetch(`/__dev/run`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({input:e})})).json()}async function _H(e,{signal:t}={}){if(typeof e?.url!=`string`||!e.url.startsWith(`/api/media/`))throw Error(`The local preview shows stand-in media and files mapped in tests/mocks.json.`);let n=await fetch(e.url,{signal:t});if(!n.ok)throw Error(`This image is not available in the local preview. Map it to a file under files in tests/mocks.json.`);let r=await createImageBitmap(await n.blob()),i=Math.min(1,512/Math.max(r.width,r.height)),a=document.createElement(`canvas`);return a.width=Math.max(1,Math.round(r.width*i)),a.height=Math.max(1,Math.round(r.height*i)),a.getContext(`2d`).drawImage(r,0,0,a.width,a.height),r.close?.(),{url:a.toDataURL(`image/png`),width:a.width,height:a.height}}function vH(e,{signal:t}={}){return typeof e?.url!=`string`||!e.url.startsWith(`/api/media/`)?Promise.reject(Error(`The local preview plays stand-in media and files mapped in tests/mocks.json.`)):Mn(e,{signal:t})}function yH({value:e,onCommit:t,disabled:n}){let r=(0,Q.useMemo)(()=>JSON.stringify(e,null,2),[e]),[i,a]=(0,Q.useState)(r),[o,s]=(0,Q.useState)(``);return(0,Q.useEffect)(()=>{a(r),s(``)},[r]),(0,$.jsxs)(`div`,{className:`dh-input`,children:[(0,$.jsx)(`textarea`,{"aria-label":`Input JSON`,spellCheck:!1,rows:8,value:i,disabled:n,onChange:e=>a(e.target.value),onBlur:()=>{if(i!==r)try{let e=JSON.parse(i||`{}`);if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`The input is one JSON object, keyed by input port.`);s(``),t(e)}catch(e){s(e.message)}}}),o&&(0,$.jsx)(`p`,{role:`alert`,children:o})]})}var bH=(0,Q.memo)(function({entries:e,onClear:t}){let n=(0,Q.useRef)(null);return(0,Q.useEffect)(()=>{let e=n.current;e&&(e.scrollTop=e.scrollHeight)},[e]),(0,$.jsxs)(`section`,{className:`dh-console`,"aria-label":`Console`,children:[(0,$.jsxs)(`div`,{className:`dh-section-head`,children:[(0,$.jsx)(`h2`,{children:`Console`}),(0,$.jsx)(`button`,{type:`button`,className:`btn btn-ghost`,onClick:t,disabled:!e.length,children:`Clear`})]}),(0,$.jsx)(`ol`,{ref:n,children:e.map(e=>(0,$.jsxs)(`li`,{className:`dh-entry dh-${e.kind}`,children:[(0,$.jsx)(`time`,{children:e.time}),(0,$.jsx)(`span`,{className:`dh-kind`,children:e.label}),(0,$.jsx)(`pre`,{children:e.text})]},e.id))}),!e.length&&(0,$.jsx)(`p`,{className:`dh-muted`,children:`Runs, logs, stand-ins, reloads and errors appear here.`})]})}),xH={run:`Run`,log:`Log`,"stand-in":`Stand-in`,reload:`Reload`,build:`Build`,error:`Error`,view:`View`};function SH(){let[e,t]=(0,Q.useState)({revision:0,content:null,problem:null,folder:``}),[n,r]=(0,Q.useState)(0),[i,a]=(0,Q.useState)(()=>mH(`stillmade.dev.theme`,`light`)),[o,s]=(0,Q.useState)(()=>mH(`stillmade.dev.width`,`full`)),[c,l]=(0,Q.useState)(0),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)([]),[v,y]=(0,Q.useState)({}),b=(0,Q.useRef)({}),x=(0,Q.useRef)(0),S=(0,Q.useCallback)((e,t)=>_(n=>[...n.slice(-299),{id:++x.current,kind:e,label:xH[e]||e,time:new Date().toLocaleTimeString(),text:String(t)}]),[]),C=(0,Q.useCallback)(async()=>{let e=await(await fetch(`/__dev/package`,{cache:`no-store`})).json();return t(e),e},[]);(0,Q.useEffect)(()=>{let e=!0;C().then(t=>{e&&(d(e=>e??(t.content?.tests?.[0]?.input||{})),S(`reload`,`Previewing ${t.folder}`),t.problem&&S(`error`,t.problem))}).catch(e=>S(`error`,e.message));let t=new EventSource(`/__dev/events`);return t.addEventListener(`package`,async t=>{let n=JSON.parse(t.data);try{if(await C(),!e)return;r(e=>e+1),S(n.problem?`error`:`reload`,n.problem?`Reloaded with a problem: ${n.problem}`:`Reloaded after a change`)}catch(e){S(`error`,e.message)}}),t.addEventListener(`build`,e=>{let t=JSON.parse(e.data);t.state===`running`?S(`build`,`Building: ${t.command}`):t.state===`done`?S(`build`,`Build finished`):S(`error`,`Build failed${t.output?`\n${t.output}`:``}`)}),()=>{e=!1,t.close()}},[]),(0,Q.useEffect)(()=>{document.documentElement.dataset.mode=i,hH(`stillmade.dev.theme`,i)},[i]),(0,Q.useEffect)(()=>{hH(`stillmade.dev.width`,o)},[o]);let w=e.content,T=w?.manifest,E=w?.tests||[],D=e=>{l(e),d(E[e]?.input||{})},O=(0,Q.useCallback)(async(e,{signal:t}={})=>{S(`run`,`Run with ${pH(e)}`),h(!0);try{let n=await gH(e);if(t?.aborted)throw Object.assign(Error(`Run cancelled`),{code:`CANCELLED`});for(let e of n.logs||[])S(`log`,e);for(let e of n.standIns||[])S(`stand-in`,`${e.api} ${e.name} (${e.source===`mocks`?`tests/mocks.json`:`recorded stand-in`})`);if(n.error)throw S(`error`,`${n.error}${n.code?` (${n.code})`:``}`),Object.assign(Error(n.error),{code:n.code});return p(n.outputs),S(`run`,`Finished in ${n.ms} ms`),n.outputs}finally{h(!1)}},[S]),k=(0,Q.useCallback)(async e=>{let t=Gn(b.current,e);b.current=t,y(t)},[]),A=()=>{b.current={},y({}),r(e=>e+1),S(`view`,`Shared state cleared`)},j=(0,Q.useMemo)(()=>({state:v,outputs:{},memory:null,canEdit:!0}),[v]),M=(0,Q.useCallback)(async e=>{p(e),S(`view`,`The view chose outputs ${pH(e)}`)},[S]),N=(0,Q.useCallback)(e=>S(`error`,String(e?.message||e)),[S]),P=u||{},F=fH.find(([e])=>e===o)?.[2];return(0,$.jsxs)(`div`,{className:`dh-page`,children:[(0,$.jsxs)(`header`,{className:`dh-header`,children:[(0,$.jsxs)(`div`,{className:`dh-title`,children:[(0,$.jsx)(`span`,{className:`dh-wordmark`,children:`StillMade AI`}),(0,$.jsx)(`h1`,{children:T?.name||`Block preview`}),T&&(0,$.jsxs)(`span`,{className:`dh-meta`,children:[T.id,` · `,T.version,` · `,T.runtime,w.view?.runtime===`frame`?` · frame view`:w.view?` · view`:``]})]}),(0,$.jsxs)(`div`,{className:`dh-controls`,children:[(0,$.jsxs)(`label`,{children:[`Appearance`,(0,$.jsx)(`select`,{value:i,onChange:e=>a(e.target.value),children:dH.map(([e,t])=>(0,$.jsx)(`option`,{value:e,children:t},e))})]}),(0,$.jsxs)(`label`,{children:[`Width`,(0,$.jsx)(`select`,{value:o,onChange:e=>s(e.target.value),children:fH.map(([e,t])=>(0,$.jsx)(`option`,{value:e,children:t},e))})]}),E.length>1&&(0,$.jsxs)(`label`,{children:[`Fixture`,(0,$.jsx)(`select`,{value:c,onChange:e=>D(Number(e.target.value)),children:E.map((e,t)=>(0,$.jsx)(`option`,{value:t,children:e.name},t))})]}),(0,$.jsx)(`button`,{type:`button`,className:`btn btn-secondary`,onClick:()=>r(e=>e+1),children:`Reload view`})]})]}),e.problem&&(0,$.jsx)(`p`,{className:`dh-problem`,role:`alert`,children:e.problem}),(0,$.jsxs)(`main`,{className:`dh-main`,children:[(0,$.jsx)(`section`,{className:`dh-stage`,"aria-label":`Preview`,children:(0,$.jsx)(`div`,{className:`dh-frame`,style:F?{maxWidth:F}:void 0,children:w?w.view?(0,$.jsx)(uH,{view:w.view,policyContent:w,input:P,sharedView:j,onSharedChange:k,onRun:O,onUseOutput:M,onPreviewImage:_H,onPreviewMedia:vH,onError:N,actorId:`dev-preview`,title:`${T.name} preview`,height:560,fitContent:!0},n):(0,$.jsxs)(`div`,{className:`dh-noview`,children:[(0,$.jsx)(`p`,{children:`This Block has no interface. StillMade shows controls for its inputs; run it here with the input on the right.`}),(0,$.jsx)(`button`,{type:`button`,className:`btn btn-primary`,disabled:m,onClick:()=>O(P).catch(()=>{}),children:m?`Running`:`Run`})]}):(0,$.jsx)(`p`,{className:`dh-muted`,role:`status`,children:`Loading the Block`})})}),(0,$.jsxs)(`aside`,{className:`dh-panel`,children:[(0,$.jsxs)(`section`,{"aria-label":`Input`,children:[(0,$.jsxs)(`div`,{className:`dh-section-head`,children:[(0,$.jsx)(`h2`,{children:`Input`}),(0,$.jsx)(`button`,{type:`button`,className:`btn btn-ghost`,disabled:m||!w,onClick:()=>O(P).catch(()=>{}),children:`Run with this input`})]}),u&&(0,$.jsx)(yH,{value:u,onCommit:d,disabled:!w})]}),(0,$.jsxs)(`section`,{"aria-label":`Outputs`,children:[(0,$.jsxs)(`div`,{className:`dh-section-head`,children:[(0,$.jsx)(`h2`,{children:`Last outputs`}),w?.view&&(0,$.jsx)(`button`,{type:`button`,className:`btn btn-ghost`,onClick:A,children:`Clear shared state`})]}),f?(0,$.jsx)(`pre`,{className:`dh-json`,children:JSON.stringify(f,null,2)}):(0,$.jsx)(`p`,{className:`dh-muted`,children:`Nothing has run yet.`})]}),(0,$.jsx)(bH,{entries:g,onClear:()=>_([])})]})]})]})}(0,v.createRoot)(document.getElementById(`root`)).render((0,$.jsx)(SH,{}));