@yschimke/livery-a2ui 0.0.0-stage → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +194 -2
- package/dist/angular.d.ts +32 -0
- package/dist/angular.js +51 -0
- package/dist/api.d.ts +35 -0
- package/dist/api.js +35 -0
- package/dist/catalog.d.ts +18 -0
- package/dist/catalog.js +55 -0
- package/dist/cmp-player.d.ts +3 -0
- package/dist/cmp-player.js +125 -0
- package/dist/controller.d.ts +61 -0
- package/dist/controller.js +330 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +4 -0
- package/dist/livery-web/livery-livery-web.d.mts +75 -0
- package/dist/livery-web/livery-livery-web.import-object.mjs +370 -0
- package/dist/livery-web/livery-livery-web.js-builtins.mjs +52 -0
- package/dist/livery-web/livery-livery-web.mjs +104 -0
- package/dist/livery-web/livery-livery-web.wasm +0 -0
- package/dist/livery-web-compose/fonts/NotoSansSymbols2-OFL.txt +117 -0
- package/dist/livery-web-compose/fonts/NotoSansSymbols2-Regular.ttf +0 -0
- package/dist/livery-web-compose/fonts/README.md +8 -0
- package/dist/livery-web-compose/fonts/RobotoFlex-OFL.txt +93 -0
- package/dist/livery-web-compose/fonts/RobotoFlex.ttf +0 -0
- package/dist/livery-web-compose/livery-livery-web-compose.d.mts +60 -0
- package/dist/livery-web-compose/livery-livery-web-compose.import-object.mjs +653 -0
- package/dist/livery-web-compose/livery-livery-web-compose.js-builtins.mjs +52 -0
- package/dist/livery-web-compose/livery-livery-web-compose.mjs +89 -0
- package/dist/livery-web-compose/livery-livery-web-compose.wasm +0 -0
- package/dist/livery-web-compose/skiko.mjs +1118 -0
- package/dist/livery-web-compose/skiko.wasm +0 -0
- package/dist/livery.d.ts +165 -0
- package/dist/livery.js +87 -0
- package/dist/player.d.ts +2 -0
- package/dist/player.js +2 -0
- package/dist/react.d.ts +24 -0
- package/dist/react.js +36 -0
- package/node_modules/@js-joda/core/CHANGELOG.md +363 -0
- package/node_modules/@js-joda/core/CheatSheet.md +947 -0
- package/node_modules/@js-joda/core/LICENSE +34 -0
- package/node_modules/@js-joda/core/README.md +155 -0
- package/node_modules/@js-joda/core/bower.json +21 -0
- package/node_modules/@js-joda/core/dist/js-joda.d.ts +2452 -0
- package/node_modules/@js-joda/core/dist/js-joda.esm.js +13564 -0
- package/node_modules/@js-joda/core/dist/js-joda.flow.js +949 -0
- package/node_modules/@js-joda/core/dist/js-joda.js +13630 -0
- package/node_modules/@js-joda/core/dist/js-joda.js.map +1 -0
- package/node_modules/@js-joda/core/dist/js-joda.min.js +5 -0
- package/node_modules/@js-joda/core/package.json +76 -0
- package/node_modules/@js-joda/core/src/Clock.js +330 -0
- package/node_modules/@js-joda/core/src/DayOfWeek.js +451 -0
- package/node_modules/@js-joda/core/src/Duration.js +1205 -0
- package/node_modules/@js-joda/core/src/Enum.js +30 -0
- package/node_modules/@js-joda/core/src/Instant.js +1012 -0
- package/node_modules/@js-joda/core/src/LocalDate.js +1703 -0
- package/node_modules/@js-joda/core/src/LocalDateTime.js +1686 -0
- package/node_modules/@js-joda/core/src/LocalTime.js +1415 -0
- package/node_modules/@js-joda/core/src/MathUtil.js +236 -0
- package/node_modules/@js-joda/core/src/Month.js +600 -0
- package/node_modules/@js-joda/core/src/MonthDay.js +730 -0
- package/node_modules/@js-joda/core/src/OffsetDateTime.js +757 -0
- package/node_modules/@js-joda/core/src/OffsetTime.js +621 -0
- package/node_modules/@js-joda/core/src/Period.js +933 -0
- package/node_modules/@js-joda/core/src/StringUtil.js +43 -0
- package/node_modules/@js-joda/core/src/Year.js +1015 -0
- package/node_modules/@js-joda/core/src/YearConstants.js +21 -0
- package/node_modules/@js-joda/core/src/YearMonth.js +1096 -0
- package/node_modules/@js-joda/core/src/ZoneId.js +236 -0
- package/node_modules/@js-joda/core/src/ZoneIdFactory.js +201 -0
- package/node_modules/@js-joda/core/src/ZoneOffset.js +486 -0
- package/node_modules/@js-joda/core/src/ZoneRegion.js +72 -0
- package/node_modules/@js-joda/core/src/ZonedDateTime.js +2007 -0
- package/node_modules/@js-joda/core/src/_init.js +68 -0
- package/node_modules/@js-joda/core/src/assert.js +33 -0
- package/node_modules/@js-joda/core/src/chrono/ChronoLocalDate.js +230 -0
- package/node_modules/@js-joda/core/src/chrono/ChronoLocalDateTime.js +130 -0
- package/node_modules/@js-joda/core/src/chrono/ChronoZonedDateTime.js +194 -0
- package/node_modules/@js-joda/core/src/chrono/IsoChronology.js +235 -0
- package/node_modules/@js-joda/core/src/convert.js +83 -0
- package/node_modules/@js-joda/core/src/errors.js +54 -0
- package/node_modules/@js-joda/core/src/format/DateTimeBuilder.js +535 -0
- package/node_modules/@js-joda/core/src/format/DateTimeFormatter.js +728 -0
- package/node_modules/@js-joda/core/src/format/DateTimeFormatterBuilder.js +1545 -0
- package/node_modules/@js-joda/core/src/format/DateTimeParseContext.js +297 -0
- package/node_modules/@js-joda/core/src/format/DateTimePrintContext.js +138 -0
- package/node_modules/@js-joda/core/src/format/DecimalStyle.js +113 -0
- package/node_modules/@js-joda/core/src/format/EnumMap.js +70 -0
- package/node_modules/@js-joda/core/src/format/ParsePosition.js +31 -0
- package/node_modules/@js-joda/core/src/format/ResolverStyle.js +93 -0
- package/node_modules/@js-joda/core/src/format/SignStyle.js +38 -0
- package/node_modules/@js-joda/core/src/format/StringBuilder.js +47 -0
- package/node_modules/@js-joda/core/src/format/TextStyle.js +114 -0
- package/node_modules/@js-joda/core/src/format/parser/CharLiteralPrinterParser.js +46 -0
- package/node_modules/@js-joda/core/src/format/parser/CompositePrinterParser.js +89 -0
- package/node_modules/@js-joda/core/src/format/parser/FractionPrinterParser.js +162 -0
- package/node_modules/@js-joda/core/src/format/parser/NumberPrinterParser.js +367 -0
- package/node_modules/@js-joda/core/src/format/parser/OffsetIdPrinterParser.js +177 -0
- package/node_modules/@js-joda/core/src/format/parser/PadPrinterParserDecorator.js +81 -0
- package/node_modules/@js-joda/core/src/format/parser/SettingsParser.js +44 -0
- package/node_modules/@js-joda/core/src/format/parser/StringLiteralPrinterParser.js +39 -0
- package/node_modules/@js-joda/core/src/format/parser/ZoneIdPrinterParser.js +218 -0
- package/node_modules/@js-joda/core/src/js-joda.js +210 -0
- package/node_modules/@js-joda/core/src/license-preamble.js +3 -0
- package/node_modules/@js-joda/core/src/temporal/ChronoField.js +470 -0
- package/node_modules/@js-joda/core/src/temporal/ChronoUnit.js +310 -0
- package/node_modules/@js-joda/core/src/temporal/DefaultInterfaceTemporal.js +118 -0
- package/node_modules/@js-joda/core/src/temporal/IsoFields.js +859 -0
- package/node_modules/@js-joda/core/src/temporal/NativeJsTemporal.js +105 -0
- package/node_modules/@js-joda/core/src/temporal/Temporal.js +346 -0
- package/node_modules/@js-joda/core/src/temporal/TemporalAccessor.js +125 -0
- package/node_modules/@js-joda/core/src/temporal/TemporalAdjuster.js +92 -0
- package/node_modules/@js-joda/core/src/temporal/TemporalAdjusters.js +464 -0
- package/node_modules/@js-joda/core/src/temporal/TemporalAmount.js +166 -0
- package/node_modules/@js-joda/core/src/temporal/TemporalField.js +248 -0
- package/node_modules/@js-joda/core/src/temporal/TemporalQueries.js +223 -0
- package/node_modules/@js-joda/core/src/temporal/TemporalQueriesFactory.js +77 -0
- package/node_modules/@js-joda/core/src/temporal/TemporalQuery.js +107 -0
- package/node_modules/@js-joda/core/src/temporal/TemporalUnit.js +179 -0
- package/node_modules/@js-joda/core/src/temporal/ValueRange.js +257 -0
- package/node_modules/@js-joda/core/src/use.js +20 -0
- package/node_modules/@js-joda/core/src/zone/SystemDefaultZoneId.js +31 -0
- package/node_modules/@js-joda/core/src/zone/SystemDefaultZoneRules.js +162 -0
- package/node_modules/@js-joda/core/src/zone/ZoneOffsetTransition.js +289 -0
- package/node_modules/@js-joda/core/src/zone/ZoneRules.js +464 -0
- package/node_modules/@js-joda/core/src/zone/ZoneRulesProvider.js +36 -0
- package/node_modules/@yschimke/livery-web/README.md +112 -0
- package/node_modules/@yschimke/livery-web/dist/descriptor.d.ts +24 -0
- package/node_modules/@yschimke/livery-web/dist/descriptor.js +32 -0
- package/node_modules/@yschimke/livery-web/dist/index.d.ts +9 -0
- package/node_modules/@yschimke/livery-web/dist/index.js +5 -0
- package/node_modules/@yschimke/livery-web/dist/livery-web/livery-livery-web-core.d.mts +63 -0
- package/node_modules/@yschimke/livery-web/dist/livery-web/livery-livery-web-core.import-object.mjs +333 -0
- package/node_modules/@yschimke/livery-web/dist/livery-web/livery-livery-web-core.js-builtins.mjs +52 -0
- package/node_modules/@yschimke/livery-web/dist/livery-web/livery-livery-web-core.mjs +92 -0
- package/node_modules/@yschimke/livery-web/dist/livery-web/livery-livery-web-core.wasm +0 -0
- package/node_modules/@yschimke/livery-web/dist/player.d.ts +65 -0
- package/node_modules/@yschimke/livery-web/dist/player.js +117 -0
- package/node_modules/@yschimke/livery-web/dist/preview.d.ts +57 -0
- package/node_modules/@yschimke/livery-web/dist/preview.js +214 -0
- package/node_modules/@yschimke/livery-web/dist/publication.d.ts +7 -0
- package/node_modules/@yschimke/livery-web/dist/publication.js +103 -0
- package/node_modules/@yschimke/livery-web/dist/session.d.ts +71 -0
- package/node_modules/@yschimke/livery-web/dist/session.js +55 -0
- package/node_modules/@yschimke/livery-web/dist/viewer.d.ts +1 -0
- package/node_modules/@yschimke/livery-web/dist/viewer.js +18 -0
- package/node_modules/@yschimke/livery-web/package.json +39 -0
- package/node_modules/@yschimke/livery-web/vendor/PROVENANCE.md +18 -0
- package/node_modules/@yschimke/livery-web/vendor/remote-compose-player.d.mts +30 -0
- package/node_modules/@yschimke/livery-web/vendor/remote-compose-player.mjs +86 -0
- package/package.json +102 -4
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
function uo(o,e){return{x:o.a*e.x+o.c*e.y+o.e,y:o.b*e.x+o.d*e.y+o.f}}function Tm(o,e){let t=o.a*o.d-o.b*o.c;return{x:(o.d*(e.x-o.e)-o.c*(e.y-o.f))/t,y:(-o.b*(e.x-o.e)+o.a*(e.y-o.f))/t}}function Om(o,e){let t=(s,a,m)=>(a.x-s.x)*(m.y-s.y)-(a.y-s.y)*(m.x-s.x),i=e.reduce((s,a,m)=>{let u=e[(m+1)%e.length];return s+a.x*u.y-u.x*a.y},0);if(Math.abs(i)<1e-7)return[];let r=i>=0?1:-1,n=o;for(let s=0;s<e.length&&n.length;s++){let a=e[s],m=e[(s+1)%e.length],u=n;n=[];let l=u[u.length-1],h=r*t(a,m,l);for(let c of u){let f=r*t(a,m,c);if(f>=-1e-7!=h>=-1e-7){let d=h/(h-f);n.push({x:l.x+(c.x-l.x)*d,y:l.y+(c.y-l.y)*d})}f>=-1e-7&&n.push(c),l=c,h=f}}return n}var ee=class{constructor(e){this.mNeedsRepaint=!1;this.mMeasureVersion=0;this.mContext=e}static{this.TEXT_MEASURE_MONOSPACE_WIDTH=1}static{this.TEXT_MEASURE_FONT_HEIGHT=2}static{this.TEXT_MEASURE_SPACES=4}static{this.TEXT_COMPLEX=8}static{this.TEXT_MEASURE_AUTOSIZE=16}getContext(){return this.mContext}setContext(e){this.mContext=e}doesNeedsRepaint(){return this.mNeedsRepaint}clearNeedsRepaint(){this.mNeedsRepaint=!1}needsRepaint(){this.mNeedsRepaint=!0}setNeedsRepaint(e){this.mNeedsRepaint=e}setMeasureVersion(e){this.mMeasureVersion=e}getMeasureVersion(){return this.mMeasureVersion}save(){this.matrixSave()}restore(){this.matrixRestore()}saveLayer(e,t,i,r){this.matrixSave()}getDensity(){return this.mContext.getDensity()}getDensityBehavior(){return this.mContext.getDensityBehavior()}getClock(){return this.mContext.getClock()}isDebug(){return this.mContext.isBasicDebug()}isAnimationEnabled(){return this.mContext.isAnimationEnabled()}isVisualDebug(){return this.mContext.isVisualDebug()}supportsVersion(e,t,i){return this.mContext.supportsVersion(e,t,i)}log(e){console.log(`[LOG] ${e}`)}wakeIn(e){this.mContext.mRemoteComposeState.wakeIn(e)}setMesh(e,t,i,r,n,s,a,m){}drawMesh(e,t,i){}matrixFromMesh(e,t,i,r){}};var dt=Math.fround;function W(o,e){return dt(o*e)}function K(o,e){return dt(o+e)}function pa(o,e,t){return dt(Math.sqrt(K(K(W(o,o),W(e,e)),W(t,t))))}function yi(){let o=new Float32Array(16);return mr(o),o}function mr(o){o[0]=1,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=1,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=1,o[11]=0,o[12]=0,o[13]=0,o[14]=0,o[15]=1}var _h=new Float32Array(16);function qe(o,e,t){let i=_h;for(let r=0;r<4;r++){let n=r*4;for(let s=0;s<4;s++)i[n+s]=K(K(K(W(e[s],t[n]),W(e[4+s],t[n+1])),W(e[8+s],t[n+2])),W(e[12+s],t[n+3]))}o.set(i)}function xm(o,e,t,i){o[12]=K(o[12],K(K(W(o[0],e),W(o[4],t)),W(o[8],i))),o[13]=K(o[13],K(K(W(o[1],e),W(o[5],t)),W(o[9],i))),o[14]=K(o[14],K(K(W(o[2],e),W(o[6],t)),W(o[10],i))),o[15]=K(o[15],K(K(W(o[3],e),W(o[7],t)),W(o[11],i)))}function Am(o,e,t,i){o[0]=W(o[0],e),o[1]=W(o[1],e),o[2]=W(o[2],e),o[3]=W(o[3],e),o[4]=W(o[4],t),o[5]=W(o[5],t),o[6]=W(o[6],t),o[7]=W(o[7],t),o[8]=W(o[8],i),o[9]=W(o[9],i),o[10]=W(o[10],i),o[11]=W(o[11],i)}function Em(o,e,t,i,r){let n=pa(t,i,r);if(n===0)return;let s=dt(t/n),a=dt(i/n),m=dt(r/n),u=dt(Math.cos(e)),l=dt(Math.sin(e)),h=dt(1-u),c=K(W(W(s,s),h),u),f=K(W(W(a,s),h),W(m,l)),d=dt(W(W(m,s),h)-W(a,l)),p=dt(W(W(s,a),h)-W(m,l)),b=K(W(W(a,a),h),u),g=K(W(W(m,a),h),W(s,l)),C=K(W(W(s,m),h),W(a,l)),y=dt(W(W(a,m),h)-W(s,l)),I=K(W(W(m,m),h),u),T=o[0],v=o[1],_=o[2],P=o[3],E=o[4],L=o[5],V=o[6],B=o[7],U=o[8],H=o[9],N=o[10],k=o[11];o[0]=K(K(W(T,c),W(E,f)),W(U,d)),o[1]=K(K(W(v,c),W(L,f)),W(H,d)),o[2]=K(K(W(_,c),W(V,f)),W(N,d)),o[3]=K(K(W(P,c),W(B,f)),W(k,d)),o[4]=K(K(W(T,p),W(E,b)),W(U,g)),o[5]=K(K(W(v,p),W(L,b)),W(H,g)),o[6]=K(K(W(_,p),W(V,b)),W(N,g)),o[7]=K(K(W(P,p),W(B,b)),W(k,g)),o[8]=K(K(W(T,C),W(E,y)),W(U,I)),o[9]=K(K(W(v,C),W(L,y)),W(H,I)),o[10]=K(K(W(_,C),W(V,y)),W(N,I)),o[11]=K(K(W(P,C),W(B,y)),W(k,I))}function Mm(o,e,t,i,r){let n=dt(1/Math.tan(e*.5)),s=dt(1/dt(i-r));o[0]=dt(n/t),o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=n,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=W(K(r,i),s),o[11]=-1,o[12]=0,o[13]=0,o[14]=W(W(W(2,r),i),s),o[15]=0}function Fm(o,e,t,i,r,n,s){let a=dt(1/dt(e-t)),m=dt(1/dt(i-r)),u=dt(1/dt(n-s));o[0]=W(-2,a),o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=W(-2,m),o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=W(2,u),o[11]=0,o[12]=W(K(e,t),a),o[13]=W(K(r,i),m),o[14]=W(K(s,n),u),o[15]=1}function Sm(o,e,t,i,r,n,s,a,m,u){let l=dt(r-e),h=dt(n-t),c=dt(s-i),f=pa(l,h,c);if(f===0){mr(o);return}l=dt(l/f),h=dt(h/f),c=dt(c/f);let d=dt(W(h,u)-W(c,m)),p=dt(W(c,a)-W(l,u)),b=dt(W(l,m)-W(h,a)),g=pa(d,p,b);if(g===0){mr(o);return}d=dt(d/g),p=dt(p/g),b=dt(b/g);let C=dt(W(p,c)-W(b,h)),y=dt(W(b,l)-W(d,c)),I=dt(W(d,h)-W(p,l));o[0]=d,o[1]=C,o[2]=-l,o[3]=0,o[4]=p,o[5]=y,o[6]=-h,o[7]=0,o[8]=b,o[9]=I,o[10]=-c,o[11]=0,o[12]=-K(K(W(d,e),W(p,t)),W(b,i)),o[13]=-K(K(W(C,e),W(y,t)),W(I,i)),o[14]=K(K(W(l,e),W(h,t)),W(c,i)),o[15]=1}function Ze(o,e,t,i,r){r[0]=K(K(K(W(o[0],e),W(o[4],t)),W(o[8],i)),o[12]),r[1]=K(K(K(W(o[1],e),W(o[5],t)),W(o[9],i)),o[13]),r[2]=K(K(K(W(o[2],e),W(o[6],t)),W(o[10],i)),o[14]),r[3]=K(K(K(W(o[3],e),W(o[7],t)),W(o[11],i)),o[15])}function Vr(o,e,t,i,r){r[0]=K(K(W(o[0],e),W(o[4],t)),W(o[8],i)),r[1]=K(K(W(o[1],e),W(o[5],t)),W(o[9],i)),r[2]=K(K(W(o[2],e),W(o[6],t)),W(o[10],i))}var Q=Math.fround;function At(o){return Number.isNaN(o)?0:o>=2147483647?2147483647:o<=-2147483648?-2147483648:Math.trunc(o)}function fe(o,e,t,i,r,n){return Q(Q(Q(Q(o*e)+Q(t*i)))+Q(r*n))}function Pm(o,e,t){return o>e?e>t?t:e:o>t?t:o}function _m(o,e,t){return o<e?e<t?t:e:o<t?t:o}function fa(o){o.fill(Number.POSITIVE_INFINITY)}var Rh={ok:!1,dx:0,dy:0,zoff:0,minx:0,maxx:0,miny:0,maxy:0,fdx12:0,fdx23:0,fdx31:0,fdy12:0,fdy23:0,fdy31:0,cy1:0,cy2:0,cy3:0,swapped:!1},we=new Float32Array(9);function lo(o,e,t,i,r,n,s,a,m,u,l){let h=Rh;if(h.swapped=!1,(m-n)*(i-s)-(u-s)*(t-n)<0){let w=m,X=u,z=l;m=n,u=s,l=a,n=w,s=X,a=z,h.swapped=!0}we[0]=t,we[1]=i,we[2]=r,we[3]=n,we[4]=s,we[5]=a,we[6]=m,we[7]=u,we[8]=l;let c=m*(i-s)-n*i+t*s+(n-t)*u;if(c===0)return h.ok=!1,h;let f=-(u*(r-a)-s*r+i*a+(s-i)*l),d=m*(r-a)-n*r+t*a+(n-t)*l,p=m*(i*a-s*r)+u*(n*r-t*a)+(t*s-n*i)*l;h.dx=Q(f/c),h.dy=Q(d/c),h.zoff=Q(p/c);let b=At(Q(Q(16*u)+.5)),g=At(Q(Q(16*s)+.5)),C=At(Q(Q(16*i)+.5)),y=At(Q(Q(16*m)+.5)),I=At(Q(Q(16*n)+.5)),T=At(Q(Q(16*t)+.5)),v=y-I|0,_=I-T|0,P=T-y|0,E=b-g|0,L=g-C|0,V=C-b|0;h.fdx12=v<<4,h.fdx23=_<<4,h.fdx31=P<<4,h.fdy12=E<<4,h.fdy23=L<<4,h.fdy31=V<<4;let B=Pm(y,I,T)+15>>4,U=_m(y,I,T)+15>>4,H=Pm(b,g,C)+15>>4,N=_m(b,g,C)+15>>4;H<0&&(H=0),B<0&&(B=0),U>o&&(U=o),N>e&&(N=e),h.minx=B,h.maxx=U,h.miny=H,h.maxy=N;let k=E*y-v*b,Y=L*I-_*g,$=V*T-P*C;return(E<0||E===0&&v>0)&&(k=k+1),(L<0||L===0&&_>0)&&(Y=Y+1),(V<0||V===0&&P>0)&&($=$+1),h.cy1=k+v*(H<<4)-E*(B<<4),h.cy2=Y+_*(H<<4)-L*(B<<4),h.cy3=$+P*(H<<4)-V*(B<<4),h.ok=!0,h}function Rm(o,e,t,i,r,n,s,a,m,u,l,h,c,f){let d=lo(i,r,n,s,a,m,u,l,h,c,f);if(!d.ok)return;let{dx:p,dy:b,zoff:g,minx:C,maxx:y,miny:I,maxy:T,fdx12:v,fdx23:_,fdx31:P,fdy12:E,fdy23:L,fdy31:V}=d,B=d.cy1|0,U=d.cy2|0,H=d.cy3|0,N=I*i;for(let k=I;k<T;k++){let Y=B,$=U,w=H,X=Q(g+b*k);for(let z=C;z<y;z++){if(Y>0&&$>0&&w>0){let j=z+N,rt=Q(X+p*z);o[j]>rt&&(o[j]=rt,e[j]=t)}Y=Y-E|0,$=$-L|0,w=w-V|0}B=B+v|0,U=U+_|0,H=H+P|0,N+=i}}function Bm(o,e,t,i,r,n,s,a,m,u,l,h,c,f,d,p){let b=lo(n,s,a,m,u,l,h,c,f,d,p);if(!b.ok)return;if(b.swapped){let Dt=r;r=i,i=Dt}let{dx:g,dy:C,zoff:y,minx:I,maxx:T,miny:v,maxy:_,fdx12:P,fdx23:E,fdx31:L,fdy12:V,fdy23:B,fdy31:U}=b,H=b.cy1|0,N=b.cy2|0,k=b.cy3|0,Y=H+N+k;if(Y===0)return;let $=Q(1/Q(Y)),w=r>>>24&255,X=r>>>16&255,z=r>>>8&255,j=r&255,rt=i>>>24&255,nt=i>>>16&255,ut=i>>>8&255,It=i&255,Ft=t>>>24&255,Tt=t>>>16&255,St=t>>>8&255,Pt=t&255,Zt=v*n;for(let Dt=v;Dt<_;Dt++){let wt=H,Lt=N,Nt=k,te=Q(y+C*Dt);for(let de=I;de<T;de++){if(wt>0&&Lt>0&&Nt>0){let Ae=de+Zt,Qt=Q(te+g*de);if(o[Ae]>Qt){o[Ae]=Qt;let xt=Q(Q(Lt)*$),ae=Q(Q(Nt)*$),pe=Q(Q(wt)*$),je=At(fe(xt,w,ae,rt,pe,Ft)),Ke=At(fe(xt,X,ae,nt,pe,Tt)),Ee=At(fe(xt,z,ae,ut,pe,St)),sr=At(fe(xt,j,ae,It,pe,Pt));e[Ae]=je<<24|Ke<<16|Ee<<8|sr|0}}wt=wt-V|0,Lt=Lt-B|0,Nt=Nt-U|0}H=H+P|0,N=N+E|0,k=k+L|0,Zt+=n}}function Dm(o,e,t,i,r,n,s,a,m,u,l,h,c,f,d,p,b,g,C,y,I,T,v,_,P,E,L,V){let B=lo(m,u,l,h,c,b,g,C,v,_,P);if(!B.ok)return;if(B.swapped){let Xt=a;a=s,s=Xt,Xt=E,E=y,y=Xt,Xt=L,L=I,I=Xt,Xt=V,V=T,T=Xt}let{dx:U,dy:H,zoff:N,minx:k,maxx:Y,miny:$,maxy:w,fdx12:X,fdx23:z,fdx31:j,fdy12:rt,fdy23:nt,fdy31:ut}=B,It=B.cy1,Ft=B.cy2,Tt=B.cy3,St=It+Ft+Tt;if(St===0)return;let Pt=Q(1/Q(St)),Zt=a>>>24&255,Dt=a>>>16&255,wt=a>>>8&255,Lt=a&255,Nt=s>>>24&255,te=s>>>16&255,de=s>>>8&255,Ae=s&255,Qt=n>>>24&255,xt=n>>>16&255,ae=n>>>8&255,pe=n&255,je=Q(E*V),Ke=Q(y*T),Ee=Q(f*p),sr=Q(L*V),or=Q(I*T),ar=Q(d*p),pi=$*m;for(let Xt=$;Xt<w;Xt++){let Rr=It,Br=Ft,Dr=Tt,wr=Q(N+H*Xt);for(let ao=k;ao<Y;ao++){if(Rr>0&&Br>0&&Dr>0){let da=ao+pi,Im=Q(wr+U*ao);if(o[da]>Im){let fi=Q(Q(Br)*Pt),gi=Q(Q(Dr)*Pt),bi=Q(Q(Rr)*Pt),Cm=Q(1/fe(fi,V,gi,T,bi,p)),vh=Q(fe(fi,je,gi,Ke,bi,Ee)*Cm),Th=Q(fe(fi,sr,gi,or,bi,ar)*Cm),Lr=At(Q(vh*i)),Nr=At(Q(Q(1-Th)*r));Lr<0?Lr=0:Lr>=i&&(Lr=i-1),Nr<0?Nr=0:Nr>=r&&(Nr=r-1);let mo=t[Nr*i+Lr],vm=mo>>>24&255;if(vm!==0){o[da]=Im;let Oh=At(fe(fi,Zt,gi,Nt,bi,Qt)),xh=At(fe(fi,Dt,gi,te,bi,xt)),Ah=At(fe(fi,wt,gi,de,bi,ae)),Eh=At(fe(fi,Lt,gi,Ae,bi,pe)),Mh=Math.trunc(vm*Oh/255),Fh=Math.trunc((mo>>>16&255)*xh/255),Sh=Math.trunc((mo>>>8&255)*Ah/255),Ph=Math.trunc((mo&255)*Eh/255);e[da]=Mh<<24|Fh<<16|Sh<<8|Ph|0}}}Rr-=rt,Br-=nt,Dr-=ut}It+=X,Ft+=z,Tt+=j,pi+=m}}function wm(o,e,t,i,r,n,s,a,m,u,l,h){let c=lo(e,t,i,r,n,s,a,m,u,l,h);if(!c.ok)return;let{dx:f,dy:d,zoff:p,minx:b,maxx:g,miny:C,maxy:y,fdx12:I,fdx23:T,fdx31:v,fdy12:_,fdy23:P,fdy31:E}=c,L=c.cy1|0,V=c.cy2|0,B=c.cy3|0,U=C*e;for(let H=C;H<y;H++){let N=L,k=V,Y=B,$=Q(p+d*H);for(let w=b;w<g;w++){if(N>0&&k>0&&Y>0){let X=w+U,z=Q($+f*w);o[X]>z&&(o[X]=z)}N=N-_|0,k=k-P|0,Y=Y-E|0}L=L+I|0,V=V+T|0,B=B+v|0,U+=e}}function ho(o,e,t,i,r,n,s,a,m,u,l,h){let c=Q(m-n),f=Q(u-s),d=c<0?-c:c,p=f<0?-f:f,b=At(d>p?d:p);b<1&&(b=1);let g=Q(1/b),C=Q(c*g),y=Q(f*g),I=Q(Q(l-a)*g),T=n,v=s,_=a;for(let P=0;P<=b;P++){let E=At(T),L=At(v);if(E>=0&&E<i&&L>=0&&L<r){let V=E+L*i;o[V]>=_-h&&(e[V]=t)}T=Q(T+C),v=Q(v+y),_=Q(_+I)}}function ge(o){return!!o&&typeof o.drawMesh3D=="function"}var J=Math.fround;function q(o,e){return J(o*e)}function at(o,e){return J(o+e)}var ba=Math.fround(1/255),ya=1e-4,Le=Math.fround(.2),Gh=32,Ia=6e-4;function Nm(){return{positions:new Float32Array(0),colors:new Int32Array(0),uvs:new Float32Array(0),depths:new Float32Array(0),hasUv:!1,vertexCount:0}}var co=class{constructor(){this.mProj=yi();this.mView=yi();this.mModel=yi();this.mPV=yi();this.mMVP=yi();this.mMV=yi();this.mMeshes=new Map;this.mColor=null;this.mZbuf=null;this.mWidth=0;this.mHeight=0;this.mBaseColorArgb=-1;this.mLights=[];this.mLightsTouched=!1;this.mNumEyeLights=0;this.mEType=new Int32Array(0);this.mElx=new Float32Array(0);this.mEly=new Float32Array(0);this.mElz=new Float32Array(0);this.mElr=new Float32Array(0);this.mElg=new Float32Array(0);this.mElb=new Float32Array(0);this.mScratch4=new Float32Array(4);this.mLightScratch3=new Float32Array(3);this.mNormal3=new Float32Array(3);this.mTexPixels=null;this.mTexW=0;this.mTexH=0;this.mSpecStrength=0;this.mShininess=32;this.mDepthBiasC=0;this.mDepthBiasS=0;this.mTriScreen=new Float32Array(9);this.mTriColor=new Int32Array(3);this.mTriInvW=new Float32Array(3);this.mSuper=1;this.cvTriXY=new Float32Array(0);this.cvTriUv=new Float32Array(0);this.cvTriColor=new Int32Array(0);this.cvTriDepth=new Float32Array(0);this.cvTriZ=new Float32Array(0);this.cvOrder=new Int32Array(0)}setSize(e,t){e<=0||t<=0||(this.mColor===null||this.mWidth!==e||this.mHeight!==t)&&(this.mColor=new Int32Array(e*t),this.mZbuf=new Float32Array(e*t),this.mWidth=e,this.mHeight=t,fa(this.mZbuf))}setSupersample(e){this.mSuper=Math.max(1,Math.trunc(e))}getWidth(){return this.mWidth}getHeight(){return this.mHeight}getColorBuffer(){return this.mColor}setBaseColorArgb(e){this.mBaseColorArgb=e|0}getBaseColorArgb(){return this.mBaseColorArgb}defineMesh3D(e,t,i,r,n=null){this.mMeshes.set(e,{indices:t,verts:i,normals:r,uv:n})}setCamera3D(e,t,i){if(e===0){if(t.length!==4)return;Mm(this.mProj,t[0],t[1],t[2],t[3])}else{if(t.length!==6)return;Fm(this.mProj,t[0],t[1],t[2],t[3],t[4],t[5])}i.length===9&&(Sm(this.mView,i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7],i[8]),mr(this.mModel))}matrix3Op(e,t){switch(e){case 0:mr(this.mModel);break;case 1:t.length===3&&xm(this.mModel,t[0],t[1],t[2]);break;case 2:t.length===3&&Am(this.mModel,t[0],t[1],t[2]);break;case 3:t.length===4&&Em(this.mModel,t[0],t[1],t[2],t[3]);break;case 4:if(t.length===16){let i=t instanceof Float32Array?t:new Float32Array(t);qe(this.mModel,this.mModel,i)}break;default:break}}clearDepth3D(){this.mZbuf===null||this.mColor===null||(fa(this.mZbuf),this.mColor.fill(0))}setLights3D(e,t,i){this.mLights=[];let r=e.length;for(let n=0;n<r&&this.mLights.length<Gh;n++){let s=n*4;if(s+3>=i.length)break;let a=t[n]|0;this.mLights.push({type:e[n],r:J((a>>>16&255)*ba),g:J((a>>>8&255)*ba),b:J((a&255)*ba),wx:i[s],wy:i[s+1],wz:i[s+2],intensity:i[s+3]})}this.mLightsTouched=!0}setTexture3D(e){}setMaterial3D(e,t){this.mSpecStrength=e,this.mShininess=t>0?t:1}setDepthBias3D(e,t){this.mDepthBiasC=e,this.mDepthBiasS=t}setTextureData(e,t,i){this.mTexPixels=e,this.mTexW=t,this.mTexH=i}ensureEyeLightCapacity(e){this.mEType.length<e&&(this.mEType=new Int32Array(e),this.mElx=new Float32Array(e),this.mEly=new Float32Array(e),this.mElz=new Float32Array(e),this.mElr=new Float32Array(e),this.mElg=new Float32Array(e),this.mElb=new Float32Array(e))}prepareLightsEyeSpace(){if(!this.mLightsTouched){this.ensureEyeLightCapacity(1),this.mEType[0]=0,this.mElx[0]=0,this.mEly[0]=0,this.mElz[0]=1,this.mElr[0]=1-Le,this.mElg[0]=1-Le,this.mElb[0]=1-Le,this.mNumEyeLights=1;return}let e=this.mLights.length;this.ensureEyeLightCapacity(e);for(let t=0;t<e;t++){let i=this.mLights[t];if(this.mEType[t]=i.type,i.type===1)Ze(this.mView,i.wx,i.wy,i.wz,this.mScratch4),this.mElx[t]=this.mScratch4[0],this.mEly[t]=this.mScratch4[1],this.mElz[t]=this.mScratch4[2];else{Vr(this.mView,i.wx,i.wy,i.wz,this.mLightScratch3);let r=-this.mLightScratch3[0],n=-this.mLightScratch3[1],s=-this.mLightScratch3[2],a=J(Math.sqrt(at(at(q(r,r),q(n,n)),q(s,s))));a>0&&(r=J(r/a),n=J(n/a),s=J(s/a)),this.mElx[t]=r,this.mEly[t]=n,this.mElz[t]=s}this.mElr[t]=i.r*i.intensity,this.mElg[t]=i.g*i.intensity,this.mElb[t]=i.b*i.intensity}this.mNumEyeLights=e}litColor(e,t,i,r,n,s,a){let m=J(Math.sqrt(at(at(q(t,t),q(i,i)),q(r,r)))),u=m===0?0:J(1/m);if(this.mSpecStrength>0)return this.litColorSpecular(e,t*u,i*u,r*u,n,s,a);let l=Le,h=Le,c=Le;for(let g=0;g<this.mNumEyeLights;g++){let C,y,I;if(this.mEType[g]===1){C=this.mElx[g]-n,y=this.mEly[g]-s,I=this.mElz[g]-a;let v=J(Math.sqrt(at(at(q(C,C),q(y,y)),q(I,I))));v>0&&(C=J(C/v),y=J(y/v),I=J(I/v))}else C=this.mElx[g],y=this.mEly[g],I=this.mElz[g];let T=q(at(at(q(t,C),q(i,y)),q(r,I)),u);T<0&&(T=-T),l=J(l+J(this.mElr[g]*T)),h=J(h+J(this.mElg[g]*T)),c=J(c+J(this.mElb[g]*T))}let f=e>>>24&255,d=Math.trunc(q(e>>>16&255,l)),p=Math.trunc(q(e>>>8&255,h)),b=Math.trunc(q(e&255,c));return d>255&&(d=255),p>255&&(p=255),b>255&&(b=255),f<<24|d<<16|p<<8|b|0}litColorSpecular(e,t,i,r,n,s,a){let m=J(Math.sqrt(at(at(q(n,n),q(s,s)),q(a,a)))),u=0,l=0,h=1;m>0&&(u=J(-n/m),l=J(-s/m),h=J(-a/m)),at(at(q(t,u),q(i,l)),q(r,h))<0&&(t=-t,i=-i,r=-r);let c=Le,f=Le,d=Le,p=0,b=0,g=0;for(let v=0;v<this.mNumEyeLights;v++){let _,P,E;if(this.mEType[v]===1){_=this.mElx[v]-n,P=this.mEly[v]-s,E=this.mElz[v]-a;let Y=J(Math.sqrt(_*_+P*P+E*E));Y>0&&(_/=Y,P/=Y,E/=Y)}else _=this.mElx[v],P=this.mEly[v],E=this.mElz[v];let L=at(at(q(t,_),q(i,P)),q(r,E));if(L<=0)continue;c=at(c,q(this.mElr[v],L)),f=at(f,q(this.mElg[v],L)),d=at(d,q(this.mElb[v],L));let V=_+u,B=P+l,U=E+h,H=J(Math.sqrt(at(at(q(V,V),q(B,B)),q(U,U))));if(H<=0)continue;let N=J(at(at(q(t,V),q(i,B)),q(r,U))/H);if(N<=0)continue;let k=q(J(Math.pow(N,this.mShininess)),this.mSpecStrength);p=at(p,q(this.mElr[v],k)),b=at(b,q(this.mElg[v],k)),g=at(g,q(this.mElb[v],k))}let C=e>>>24&255,y=Math.trunc((e>>>16&255)*c+p*255),I=Math.trunc((e>>>8&255)*f+b*255),T=Math.trunc((e&255)*d+g*255);return y>255&&(y=255),I>255&&(I=255),T>255&&(T=255),C<<24|y<<16|I<<8|T|0}drawMesh3D(e,t){let i=this.mMeshes.get(e);if(i===void 0||this.mColor===null||this.mZbuf===null)return;let r=this.mWidth,n=this.mHeight,s=this.mColor;qe(this.mPV,this.mProj,this.mView),qe(this.mMV,this.mView,this.mModel),qe(this.mMVP,this.mPV,this.mModel),this.prepareLightsEyeSpace();let a=this.mBaseColorArgb,m=i.indices,u=i.verts,l=i.normals,h=i.uv;if((t&256)!==0){this.drawMeshWireframe(m,u,l,a,r,n,s,t);return}let c=(t&1)!==0&&l!==null,f=this.mTexPixels!==null&&h!==null,d=c||this.mSpecStrength>0,p=this.mTriScreen,b=this.mTriColor;for(let g=0;g<m.length;g+=3)if(this.projectTriangle(m,u,l,c,f,g,a,r,n))if(f){let C=m[g]*2,y=m[g+1]*2,I=m[g+2]*2;Dm(this.mZbuf,s,this.mTexPixels,this.mTexW,this.mTexH,b[2],b[1],b[0],r,n,p[6],p[7],p[8],h[I],h[I+1],this.mTriInvW[2],p[3],p[4],p[5],h[y],h[y+1],this.mTriInvW[1],p[0],p[1],p[2],h[C],h[C+1],this.mTriInvW[0])}else d?Bm(this.mZbuf,s,b[2],b[1],b[0],r,n,p[6],p[7],p[8],p[3],p[4],p[5],p[0],p[1],p[2]):Rm(this.mZbuf,s,b[0],r,n,p[6],p[7],p[8],p[3],p[4],p[5],p[0],p[1],p[2])}drawMeshWireframe(e,t,i,r,n,s,a,m){let u=m&3584;u===0&&(u=3584);let l=(u&512)!==0,h=(u&1024)!==0,c=(u&2048)!==0,f=this.mTriScreen;for(let d=0;d<e.length;d+=3)this.projectTriangle(e,t,i,!1,!1,d,r,n,s)&&wm(this.mZbuf,n,s,f[6],f[7],f[8],f[3],f[4],f[5],f[0],f[1],f[2]);for(let d=0;d<e.length;d+=3){if(!this.projectTriangle(e,t,i,!1,!1,d,r,n,s))continue;let p=f[0],b=f[1],g=f[2],C=f[3],y=f[4],I=f[5],T=f[6],v=f[7],_=f[8];for(let P=0;P<this.mSuper;P++)for(let E=0;E<this.mSuper;E++)l&&ho(this.mZbuf,a,r,n,s,p+E,b+P,g,C+E,y+P,I,Ia),h&&ho(this.mZbuf,a,r,n,s,C+E,y+P,I,T+E,v+P,_,Ia),c&&ho(this.mZbuf,a,r,n,s,T+E,v+P,_,p+E,b+P,g,Ia)}}getTextureData(){return{pixels:this.mTexPixels,width:this.mTexW,height:this.mTexH}}buildCanvasVertices(e,t,i){t.vertexCount=0;let r=this.mMeshes.get(e);if(r===void 0)return 0;let n=this.mWidth,s=this.mHeight;qe(this.mPV,this.mProj,this.mView),qe(this.mMV,this.mView,this.mModel),qe(this.mMVP,this.mPV,this.mModel),this.prepareLightsEyeSpace();let a=r.indices,m=r.verts,u=r.normals,l=r.uv,h=i&&u!==null;t.hasUv=l!==null;let c=a.length/3|0;if(c<=0)return 0;this.cvTriXY.length<c*6&&(this.cvTriXY=new Float32Array(c*6),this.cvTriUv=new Float32Array(c*6),this.cvTriColor=new Int32Array(c*3),this.cvTriZ=new Float32Array(c*3),this.cvTriDepth=new Float32Array(c),this.cvOrder=new Int32Array(c));let f=this.mTriScreen,d=this.mTriColor,p=0;for(let y=0;y<a.length;y+=3){if(!this.projectTriangle(a,m,u,h,!1,y,this.mBaseColorArgb,n,s))continue;let I=p*6;this.cvTriXY[I]=f[0],this.cvTriXY[I+1]=f[1],this.cvTriXY[I+2]=f[3],this.cvTriXY[I+3]=f[4],this.cvTriXY[I+4]=f[6],this.cvTriXY[I+5]=f[7];let T=p*3;if(this.cvTriColor[T]=d[0],this.cvTriColor[T+1]=d[1],this.cvTriColor[T+2]=d[2],l!==null){let _=a[y]*2,P=a[y+1]*2,E=a[y+2]*2;this.cvTriUv[I]=l[_],this.cvTriUv[I+1]=l[_+1],this.cvTriUv[I+2]=l[P],this.cvTriUv[I+3]=l[P+1],this.cvTriUv[I+4]=l[E],this.cvTriUv[I+5]=l[E+1]}this.cvTriDepth[p]=(f[2]+f[5]+f[8])*(1/3);let v=p*3;this.cvTriZ[v]=f[2],this.cvTriZ[v+1]=f[5],this.cvTriZ[v+2]=f[8],p++}let b=this.cvOrder,g=this.cvTriDepth;for(let y=0;y<p;y++)b[y]=y;for(let y=1;y<p;y++){let I=b[y],T=g[I],v=y-1;for(;v>=0&&g[b[v]]<T;)b[v+1]=b[v],v--;b[v+1]=I}let C=p*3;t.positions.length<C*2&&(t.positions=new Float32Array(C*2),t.uvs=new Float32Array(C*2),t.colors=new Int32Array(C),t.depths=new Float32Array(C));for(let y=0;y<p;y++){let I=b[y],T=I*6,v=y*6;for(let E=0;E<6;E++)t.positions[v+E]=this.cvTriXY[T+E];if(l!==null)for(let E=0;E<6;E++)t.uvs[v+E]=this.cvTriUv[T+E];let _=I*3,P=y*3;for(let E=0;E<3;E++)t.colors[P+E]=this.cvTriColor[_+E],t.depths[P+E]=this.cvTriZ[_+E]}return t.vertexCount=C,C}projectTriangle(e,t,i,r,n,s,a,m,u){let l=e[s]*3,h=e[s+1]*3,c=e[s+2]*3;if(l<0||h<0||c<0||l+2>=t.length||h+2>=t.length||c+2>=t.length)return!1;let f=this.mScratch4;Ze(this.mMVP,t[l],t[l+1],t[l+2],f);let d=f[0],p=f[1],b=f[2],g=f[3];Ze(this.mMVP,t[h],t[h+1],t[h+2],f);let C=f[0],y=f[1],I=f[2],T=f[3];Ze(this.mMVP,t[c],t[c+1],t[c+2],f);let v=f[0],_=f[1],P=f[2],E=f[3];if(g<ya||T<ya||E<ya)return!1;n&&(this.mTriInvW[0]=1/g,this.mTriInvW[1]=1/T,this.mTriInvW[2]=1/E);let L=J(d/g),V=J(p/g),B=J(b/g),U=J(C/T),H=J(y/T),N=J(I/T),k=J(v/E),Y=J(_/E),$=J(P/E),w=q(at(q(L,.5),.5),m),X=q(J(1-at(q(V,.5),.5)),u),z=at(q(B,.5),.5),j=q(at(q(U,.5),.5),m),rt=q(J(1-at(q(H,.5),.5)),u),nt=at(q(N,.5),.5),ut=q(at(q(k,.5),.5),m),It=q(J(1-at(q(Y,.5),.5)),u),Ft=at(q($,.5),.5),Tt=J(q(J(j-w),J(It-X))-q(J(ut-w),J(rt-X)));if(Tt>0)return!1;if((this.mDepthBiasC!==0||this.mDepthBiasS!==0)&&Tt!==0){let ae=J(1/Tt),pe=q(J(q(J(nt-z),J(It-X))-q(J(Ft-z),J(rt-X))),ae),je=q(J(q(J(Ft-z),J(j-w))-q(J(nt-z),J(ut-w))),ae),Ke=Math.max(Math.abs(pe),Math.abs(je)),Ee=at(this.mDepthBiasC,q(this.mDepthBiasS,Ke));z=at(z,Ee),nt=at(nt,Ee),Ft=at(Ft,Ee)}let St=this.mTriScreen;St[0]=w,St[1]=X,St[2]=z,St[3]=j,St[4]=rt,St[5]=nt,St[6]=ut,St[7]=It,St[8]=Ft,Ze(this.mMV,t[l],t[l+1],t[l+2],f);let Pt=f[0],Zt=f[1],Dt=f[2];Ze(this.mMV,t[h],t[h+1],t[h+2],f);let wt=f[0],Lt=f[1],Nt=f[2];Ze(this.mMV,t[c],t[c+1],t[c+2],f);let te=f[0],de=f[1],Ae=f[2],Qt=this.mTriColor,xt=this.mNormal3;if(r&&i!==null&&l+2<i.length&&h+2<i.length&&c+2<i.length)Vr(this.mMV,i[l],i[l+1],i[l+2],xt),Qt[0]=this.litColor(a,xt[0],xt[1],xt[2],Pt,Zt,Dt),Vr(this.mMV,i[h],i[h+1],i[h+2],xt),Qt[1]=this.litColor(a,xt[0],xt[1],xt[2],wt,Lt,Nt),Vr(this.mMV,i[c],i[c+1],i[c+2],xt),Qt[2]=this.litColor(a,xt[0],xt[1],xt[2],te,de,Ae);else{let ae=J(wt-Pt),pe=J(Lt-Zt),je=J(Nt-Dt),Ke=J(te-Pt),Ee=J(de-Zt),sr=J(Ae-Dt),or=J(q(pe,sr)-q(je,Ee)),ar=J(q(je,Ke)-q(ae,sr)),pi=J(q(ae,Ee)-q(pe,Ke));if(this.mSpecStrength>0)Qt[0]=this.litColor(a,or,ar,pi,Pt,Zt,Dt),Qt[1]=this.litColor(a,or,ar,pi,wt,Lt,Nt),Qt[2]=this.litColor(a,or,ar,pi,te,de,Ae);else{let Xt=J(.3333333333333333),Rr=q(at(at(Pt,wt),te),Xt),Br=q(at(at(Zt,Lt),de),Xt),Dr=q(at(at(Dt,Nt),Ae),Xt),wr=this.litColor(a,or,ar,pi,Rr,Br,Dr);Qt[0]=wr,Qt[1]=wr,Qt[2]=wr}}return!0}};var Yh=`#version 300 es
|
|
2
|
+
precision highp float;
|
|
3
|
+
layout(location = 0) in vec2 aPos; // window pixels, y down
|
|
4
|
+
layout(location = 1) in vec4 aColor; // straight (non-premultiplied) RGBA
|
|
5
|
+
layout(location = 2) in vec2 aUv;
|
|
6
|
+
layout(location = 3) in float aDepth; // window z in [0,1], smaller = closer
|
|
7
|
+
uniform vec2 uViewport;
|
|
8
|
+
out vec4 vColor;
|
|
9
|
+
out vec2 vUv;
|
|
10
|
+
void main() {
|
|
11
|
+
// Window pixels to clip space. The y flip is the whole conversion: our window origin is
|
|
12
|
+
// top-left with y increasing downward, clip space is centre-origin with y up.
|
|
13
|
+
vec2 clip = vec2(aPos.x / uViewport.x * 2.0 - 1.0,
|
|
14
|
+
1.0 - aPos.y / uViewport.y * 2.0);
|
|
15
|
+
// Depth [0,1] to clip [-1,1], matching the default depth range so gl.LESS means the
|
|
16
|
+
// same thing here as the software rasterizer's "smaller z wins".
|
|
17
|
+
gl_Position = vec4(clip, aDepth * 2.0 - 1.0, 1.0);
|
|
18
|
+
vColor = aColor;
|
|
19
|
+
vUv = aUv;
|
|
20
|
+
}`,Xh=`#version 300 es
|
|
21
|
+
precision highp float;
|
|
22
|
+
in vec4 vColor;
|
|
23
|
+
in vec2 vUv;
|
|
24
|
+
uniform sampler2D uTex;
|
|
25
|
+
uniform bool uUseTex;
|
|
26
|
+
out vec4 fragColor;
|
|
27
|
+
void main() {
|
|
28
|
+
vec4 c = vColor;
|
|
29
|
+
if (uUseTex) {
|
|
30
|
+
// Lighting modulates the sampled texel, as the reference does with a BitmapShader.
|
|
31
|
+
c *= texture(uTex, vUv);
|
|
32
|
+
}
|
|
33
|
+
if (c.a <= 0.0) discard;
|
|
34
|
+
// Premultiplied out, because the canvas is created with premultipliedAlpha and
|
|
35
|
+
// compositing it with drawImage otherwise darkens every antialiased edge.
|
|
36
|
+
fragColor = vec4(c.rgb * c.a, c.a);
|
|
37
|
+
}`,po=class{constructor(){this.gl=null;this.program=null;this.vao=null;this.buffer=null;this.texture=null;this.texW=0;this.texH=0;this.texSource=null;this.interleaved=new Float32Array(0);this.uViewport=null;this.uUseTex=null;this.drawCount=0;this.canvas=document.createElement("canvas")}getCanvas(){return this.canvas}isAvailable(){return this.ensureGl()!==null}ensureGl(){if(this.gl)return this.gl;let e=this.canvas.getContext("webgl2",{alpha:!0,depth:!0,antialias:!0,premultipliedAlpha:!0,preserveDrawingBuffer:!0});if(!e)return null;this.gl=e;let t=(a,m)=>{let u=e.createShader(a);return u?(e.shaderSource(u,m),e.compileShader(u),e.getShaderParameter(u,e.COMPILE_STATUS)?u:(console.error("rc 3d shader:",e.getShaderInfoLog(u)),e.deleteShader(u),null)):null},i=t(e.VERTEX_SHADER,Yh),r=t(e.FRAGMENT_SHADER,Xh);if(!i||!r)return null;let n=e.createProgram();if(!n)return null;if(e.attachShader(n,i),e.attachShader(n,r),e.linkProgram(n),!e.getProgramParameter(n,e.LINK_STATUS))return console.error("rc 3d link:",e.getProgramInfoLog(n)),null;this.program=n,this.uViewport=e.getUniformLocation(n,"uViewport"),this.uUseTex=e.getUniformLocation(n,"uUseTex"),e.useProgram(n),e.uniform1i(e.getUniformLocation(n,"uTex"),0),this.buffer=e.createBuffer(),this.vao=e.createVertexArray(),e.bindVertexArray(this.vao),e.bindBuffer(e.ARRAY_BUFFER,this.buffer);let s=36;return e.enableVertexAttribArray(0),e.vertexAttribPointer(0,2,e.FLOAT,!1,s,0),e.enableVertexAttribArray(1),e.vertexAttribPointer(1,4,e.FLOAT,!1,s,8),e.enableVertexAttribArray(2),e.vertexAttribPointer(2,2,e.FLOAT,!1,s,24),e.enableVertexAttribArray(3),e.vertexAttribPointer(3,1,e.FLOAT,!1,s,32),e.bindVertexArray(null),e}setTexture(e,t,i){let r=this.ensureGl();if(!r)return;if(!e||t<=0||i<=0){this.texW=0,this.texH=0,this.texSource=null;return}if(e===this.texSource&&this.texW===t&&this.texH===i)return;this.texture||(this.texture=r.createTexture());let n=new Uint8Array(t*i*4);for(let s=0;s<t*i;s++){let a=e[s];n[s*4]=a>>>16&255,n[s*4+1]=a>>>8&255,n[s*4+2]=a&255,n[s*4+3]=a>>>24&255}r.bindTexture(r.TEXTURE_2D,this.texture),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,t,i,0,r.RGBA,r.UNSIGNED_BYTE,n),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),this.texW=t,this.texH=i,this.texSource=e}beginFrame(e,t){let i=this.ensureGl();i&&((this.canvas.width!==e||this.canvas.height!==t)&&(this.canvas.width=e,this.canvas.height=t),i.viewport(0,0,e,t),i.clearColor(0,0,0,0),i.clearDepth(1),i.clear(i.COLOR_BUFFER_BIT|i.DEPTH_BUFFER_BIT))}draw(e,t){let i=this.ensureGl();if(!i||!this.program||e.vertexCount<3)return;let r=e.vertexCount;this.interleaved.length<r*9&&(this.interleaved=new Float32Array(r*9));let n=this.interleaved,s=e.hasUv&&this.texW>0;for(let a=0;a<r;a++){let m=a*9;n[m]=e.positions[a*2],n[m+1]=e.positions[a*2+1];let u=e.colors[a];n[m+2]=(u>>>16&255)/255,n[m+3]=(u>>>8&255)/255,n[m+4]=(u&255)/255,n[m+5]=(u>>>24&255)/255,n[m+6]=s?e.uvs[a*2]:0,n[m+7]=s?1-e.uvs[a*2+1]:0,n[m+8]=e.depths[a]}i.useProgram(this.program),i.bindVertexArray(this.vao),i.bindBuffer(i.ARRAY_BUFFER,this.buffer),i.bufferData(i.ARRAY_BUFFER,n.subarray(0,r*9),i.DYNAMIC_DRAW),i.uniform2f(this.uViewport,this.canvas.width,this.canvas.height),i.uniform1i(this.uUseTex,s?1:0),s&&(i.activeTexture(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,this.texture)),t?(i.enable(i.DEPTH_TEST),i.depthFunc(i.LESS)):i.disable(i.DEPTH_TEST),i.disable(i.CULL_FACE),i.enable(i.BLEND),i.blendFunc(i.ONE,i.ONE_MINUS_SRC_ALPHA),i.drawArrays(i.TRIANGLES,0,r),this.drawCount++,i.bindVertexArray(null)}};var Me=new DataView(new ArrayBuffer(4));function ht(o){return Me.setInt32(0,o),Me.getFloat32(0)}function $h(o){return Me.setFloat32(0,o),Me.getInt32(0)}function Wm(o){return(o&2139095040)===2139095040&&(o&8388607)!==0}function km(o){return o&4194303}function ie(o,e){return Wm(o)?$h(e.getFloat(km(o))):o}function Vm(o,e){return e.getColor(o)}function Ii(o,e,t){Wm(o)&&e.listensTo(km(o),t)}var ot=class o{constructor(){this.mArray=[];this.mOutArray=null;this.mPos=0}static{this.TEXT_SIZE=1}static{this.COLOR=4}static{this.STROKE_WIDTH=5}static{this.STROKE_MITER=6}static{this.STROKE_CAP=7}static{this.STYLE=8}static{this.SHADER=9}static{this.IMAGE_FILTER_QUALITY=10}static{this.GRADIENT=11}static{this.ALPHA=12}static{this.COLOR_FILTER=13}static{this.ANTI_ALIAS=14}static{this.STROKE_JOIN=15}static{this.TYPEFACE=16}static{this.FILTER_BITMAP=17}static{this.BLEND_MODE=18}static{this.COLOR_ID=19}static{this.COLOR_FILTER_ID=20}static{this.CLEAR_COLOR_FILTER=21}static{this.SHADER_MATRIX=22}static{this.FONT_AXIS=23}static{this.TEXTURE=24}static{this.PATH_EFFECT=25}static{this.FALLBACK_TYPEFACE=26}static{this.LINEAR_GRADIENT=0}static{this.RADIAL_GRADIENT=1}static{this.SWEEP_GRADIENT=2}static{this.FILL=0}static{this.STROKE=1}static{this.FILL_AND_STROKE=2}read(e){let t=e.readInt();if(t<=0||t>1024)throw new Error(`PaintBundle: invalid length ${t}`);this.mArray=new Array(t);for(let r=0;r<t;r++)this.mArray[r]=e.readInt();this.mPos=t;let i=e.getRemapContext?.();i&&this.resolveIds(i)}resolveIds(e){let t=this.mArray,i=this.mPos,r=a=>{a<i&&(t[a]=e.resolveNanIdBits(t[a]))},n=a=>{a<i&&(t[a]=e.resolveId(t[a]))},s=0;for(;s<i;){let a=t[s++],m=a&65535,u=a>>16&65535;switch(m){case o.STROKE_MITER:case o.STROKE_WIDTH:case o.ALPHA:case o.TEXT_SIZE:case o.SHADER_MATRIX:r(s++);break;case o.COLOR_FILTER_ID:case o.COLOR_ID:case o.SHADER:case o.TYPEFACE:case o.FALLBACK_TYPEFACE:n(s++);break;case o.TEXTURE:n(s),s+=3;break;case o.COLOR:case o.COLOR_FILTER:s++;break;case o.FONT_AXIS:for(let l=0;l<u&&s<i;l++)n(s++),r(s++);break;case o.GRADIENT:{if(s>=i)break;let l=t[s++],h=l&255,c=l>>16&65535;for(let d=0;d<h&&s<i;d++,s++)(c&1<<d)!==0&&n(s);if(s>=i)break;let f=t[s++];for(let d=0;d<f&&s<i;d++)r(s++);r(s++),r(s++),u===o.LINEAR_GRADIENT?(r(s++),r(s++),s++):u===o.RADIAL_GRADIENT?(r(s++),s++):u===3&&(r(s++),r(s++),r(s++),r(s++),s++);break}case o.PATH_EFFECT:for(let l=0;l<u&&s<i;l++)r(s++);break;default:break}}}getArray(){return this.mOutArray??this.mArray}getLength(){return this.mPos}reset(){this.mArray=[],this.mOutArray=null,this.mPos=0}setStyle(e){this.mArray[this.mPos++]=o.STYLE|e<<16}setColor(e,t,i,r){if(t!==void 0&&i!==void 0&&r!==void 0){let n=Math.round(e*255)&255,s=Math.round(t*255)&255,a=Math.round(i*255)&255,m=Math.round(r*255)&255;e=(n<<24|s<<16|a<<8|m)>>>0}this.mArray[this.mPos++]=o.COLOR,this.mArray[this.mPos++]=e}setTextSize(e){this.mArray[this.mPos++]=o.TEXT_SIZE,Me.setFloat32(0,e),this.mArray[this.mPos++]=Me.getInt32(0)}setTextStyle(e,t,i){let r=t&1023|(i?2048:0);this.mArray[this.mPos++]=o.TYPEFACE|r<<16,this.mArray[this.mPos++]=e}setTextAxis(e,t){let i=e.length;this.mArray[this.mPos++]=o.FONT_AXIS|i<<16;for(let r=0;r<i;r++)this.mArray[this.mPos++]=e[r],Me.setFloat32(0,t[r]),this.mArray[this.mPos++]=Me.getInt32(0)}setStrokeWidth(e){this.mArray[this.mPos++]=o.STROKE_WIDTH,Me.setFloat32(0,e),this.mArray[this.mPos++]=Me.getInt32(0)}registerListening(e,t){let i=0,r=this.mArray;for(;i<this.mPos;){let n=r[i++];switch(n&65535){case o.STROKE_MITER:case o.STROKE_WIDTH:case o.ALPHA:case o.TEXT_SIZE:Ii(r[i],e,t),i++;break;case o.COLOR_FILTER_ID:case o.COLOR_ID:e.listensTo(r[i],t),i++;break;case o.COLOR:case o.TYPEFACE:case o.SHADER:case o.COLOR_FILTER:case o.FALLBACK_TYPEFACE:i++;break;case o.STROKE_JOIN:case o.FILTER_BITMAP:case o.STROKE_CAP:case o.STYLE:case o.IMAGE_FILTER_QUALITY:case o.BLEND_MODE:case o.ANTI_ALIAS:case o.CLEAR_COLOR_FILTER:break;case o.FONT_AXIS:{let a=n>>16&65535;for(let m=0;m<a;m++)i++,Ii(r[i],e,t),i++;break}case o.TEXTURE:i+=3;break;case o.SHADER_MATRIX:i++;break;case o.GRADIENT:i=this.registerGradientListening(n,r,i,e,t);break;case o.PATH_EFFECT:{let a=n>>16&65535;for(let m=0;m<a;m++)Ii(r[i],e,t),i++;break}default:break}}}registerGradientListening(e,t,i,r,n){let s=i,a=t[s++],m=a&255,u=a>>16&65535;for(let c=0;c<m;c++)(u&1<<c)!==0&&r.listensTo(t[s],n),s++;let l=t[s++];for(let c=0;c<l;c++)Ii(t[s],r,n),s++;switch(e>>16&65535){case o.LINEAR_GRADIENT:for(let c=0;c<4;c++)Ii(t[s],r,n),s++;s++;break;case o.RADIAL_GRADIENT:for(let c=0;c<3;c++)Ii(t[s],r,n),s++;s++;break;case o.SWEEP_GRADIENT:for(let c=0;c<2;c++)Ii(t[s],r,n),s++;break}return s}updateVariables(e){if(this.mOutArray===null)this.mOutArray=this.mArray.slice();else for(let n=0;n<this.mArray.length;n++)this.mOutArray[n]=this.mArray[n];let t=0,i=this.mArray,r=this.mOutArray;for(;t<this.mPos;){let n=i[t++];switch(n&65535){case o.STROKE_MITER:case o.STROKE_WIDTH:case o.ALPHA:case o.TEXT_SIZE:r[t]=ie(i[t],e),t++;break;case o.COLOR_FILTER_ID:case o.COLOR_ID:r[t]=Vm(i[t],e),t++;break;case o.COLOR:case o.TYPEFACE:case o.SHADER:case o.COLOR_FILTER:case o.FALLBACK_TYPEFACE:t++;break;case o.STROKE_JOIN:case o.FILTER_BITMAP:case o.STROKE_CAP:case o.STYLE:case o.IMAGE_FILTER_QUALITY:case o.BLEND_MODE:case o.ANTI_ALIAS:case o.CLEAR_COLOR_FILTER:break;case o.FONT_AXIS:{let a=n>>16&65535;for(let m=0;m<a;m++)t++,r[t]=ie(i[t],e),t++;break}case o.TEXTURE:t+=3;break;case o.SHADER_MATRIX:t++;break;case o.GRADIENT:t=this.updateGradientVars(n,i,r,t,e);break;case o.PATH_EFFECT:{let a=n>>16&65535;for(let m=0;m<a;m++)r[t]=ie(i[t],e),t++;break}default:break}}}updateGradientVars(e,t,i,r,n){let s=r,a=e>>16&65535,m=t[s++],u=m&255,l=m>>16&65535;for(let c=0;c<u;c++)(l&1<<c)!==0&&(i[s]=Vm(t[s],n)),s++;let h=t[s++];for(let c=0;c<h;c++)i[s]=ie(t[s],n),s++;switch(a){case o.LINEAR_GRADIENT:i[s]=ie(t[s],n),s++,i[s]=ie(t[s],n),s++,i[s]=ie(t[s],n),s++,i[s]=ie(t[s],n),s++,s++;break;case o.RADIAL_GRADIENT:i[s]=ie(t[s],n),s++,i[s]=ie(t[s],n),s++,i[s]=ie(t[s],n),s++,s++;break;case o.SWEEP_GRADIENT:i[s]=ie(t[s],n),s++,i[s]=ie(t[s],n),s++;break}return s}};var go=new DataView(new ArrayBuffer(4));function F(o){return go.setInt32(0,o,!1),go.getFloat32(0,!1)}function et(o){return go.setFloat32(0,o,!1),go.getInt32(0,!1)}function bt(o){return F(o|0|-8388608)}function Hm(o){return o|0|-8388608}function Ci(o){return et(o)&4194303}function Wr(o,e=!1){if(!O(o))return!1;let t=o&4194303;if(t>>20===2)return!1;let[i,r]=e?[3276800,3276854]:[3211264,3211343];return!(t>i&&t<=r)}function O(o){return(o&2139095040)===2139095040&&(o&8388607)!==0}function x(o){return o&4194303}function Um(o){return o-4294967296}function Gm(o){return o>=0&&o<=41}function Ym(o){return o>=16384&&o<=20479}function Et(o){if(O(o)){let e=x(o);return e===0?!1:e>40||e<10}return!1}function fo(o){let e=255;return o&=~(o>>31),o-=e,o&=o>>31,o+=e,o}function bo(o,e,t){if(Number.isNaN(t)||t===0)return o;if(t===1)return e;let i=o>>24&255,r=o>>16&255,n=o>>8&255,s=o&255,a=Math.pow(r/255,2.2),m=Math.pow(n/255,2.2),u=Math.pow(s/255,2.2),l=i/255;i=e>>24&255,r=e>>16&255,n=e>>8&255,s=e&255;let h=Math.pow(r/255,2.2),c=Math.pow(n/255,2.2),f=Math.pow(s/255,2.2),d=i/255,p=a+t*(h-a),b=m+t*(c-m),g=u+t*(f-u),C=l+t*(d-l),y=fo(Math.trunc(Math.pow(p,1/2.2)*255)),I=fo(Math.trunc(Math.pow(b,1/2.2)*255)),T=fo(Math.trunc(Math.pow(g,1/2.2)*255));return fo(Math.trunc(C*255))<<24|y<<16|I<<8|T|0}function Xm(o,e,t){let i=Math.trunc(o*6),r=o*6-i,n=Math.trunc(.5+255*t*(1-e)),s=Math.trunc(.5+255*t*(1-r*e)),a=Math.trunc(.5+255*t*(1-(1-r)*e)),m=Math.trunc(.5+255*t);switch(i){case 0:return 4278190080|m<<16|a<<8|n|0;case 1:return 4278190080|s<<16|m<<8|n|0;case 2:return 4278190080|n<<16|m<<8|a|0;case 3:return 4278190080|n<<16|s<<8|m|0;case 4:return 4278190080|a<<16|n<<8|m|0;case 5:return 4278190080|m<<16|n<<8|s|0}return 0}function $m(o,e,t,i){let r=Math.trunc(o*255+.5),n=Math.trunc(e*255+.5),s=Math.trunc(t*255+.5),a=Math.trunc(i*255+.5);return r<<24|n<<16|s<<8|a|0}var zh=/[a-zA-Z_]/,jh=/[a-zA-Z0-9_]/,kr=/[0-9]/,zm=/[ \t\r\n]/,jm=new Set("+-*/%=<>!&|^~?:"),Kh=new Set("(){}[];,");function Km(o){let e=[],t=0,i=o.length;for(;t<i;){let r=o[t];if(zm.test(r)){let n=t;for(;t<i&&zm.test(o[t]);)t++;e.push({type:5,value:o.slice(n,t)});continue}if(r==="/"&&t+1<i&&o[t+1]==="/"){let n=t;for(;t<i&&o[t]!==`
|
|
38
|
+
`;)t++;e.push({type:6,value:o.slice(n,t)});continue}if(r==="/"&&t+1<i&&o[t+1]==="*"){let n=t;for(t+=2;t<i&&!(o[t-1]==="*"&&o[t]==="/");)t++;t<i&&t++,e.push({type:7,value:o.slice(n,t)});continue}if(r==="#"){let n=t;for(;t<i&&o[t]!==`
|
|
39
|
+
`;)t++;e.push({type:8,value:o.slice(n,t)});continue}if(kr.test(r)||r==="."&&t+1<i&&kr.test(o[t+1])){let n=t;for(;t<i&&kr.test(o[t]);)t++;if(t<i&&o[t]===".")for(t++;t<i&&kr.test(o[t]);)t++;if(t<i&&(o[t]==="e"||o[t]==="E"))for(t++,t<i&&(o[t]==="+"||o[t]==="-")&&t++;t<i&&kr.test(o[t]);)t++;e.push({type:1,value:o.slice(n,t)});continue}if(zh.test(r)){let n=t;for(;t<i&&jh.test(o[t]);)t++;e.push({type:0,value:o.slice(n,t)});continue}if(r==="."){e.push({type:4,value:"."}),t++;continue}if(Kh.has(r)){e.push({type:3,value:r}),t++;continue}if(jm.has(r)){let n=t;if(t++,t<i&&jm.has(o[t])){let s=o.slice(n,t+1);["<=",">=","==","!=","&&","||","<<",">>","+=","-=","*=","/=","%=","&=","|=","^="].includes(s)&&t++}e.push({type:2,value:o.slice(n,t)});continue}e.push({type:0,value:r}),t++}return e.push({type:9,value:""}),e}var yo={half4:"vec4",half3:"vec3",half2:"vec2",half:"float",float2:"vec2",float3:"vec3",float4:"vec4",int2:"ivec2",int3:"ivec3",int4:"ivec4"},qh={...yo,float:"float",int:"int",vec2:"vec2",vec3:"vec3",vec4:"vec4",ivec2:"ivec2",ivec3:"ivec3",ivec4:"ivec4",sampler2D:"sampler2D"};function Ne(o){return o.type===5||o.type===6||o.type===7}function me(o,e){for(;e<o.length&&Ne(o[e]);)e++;return e}function qm(o){let e=Km(o),t=[],i=[],r=[],n=0,s=e.length,a=!1,m=0,u="p",l=!1,h=!1;for(let f=0;f<s;f++)if(e[f].type===0&&e[f].value==="iResolution"){let d=f-1;for(;d>=0&&Ne(e[d]);)d--;if(d>=0){let p=d-1;for(;p>=0&&Ne(e[p]);)p--;p>=0&&e[p].value==="uniform"&&(l=!0)}}for(;n<s;){let f=e[n];if(f.type===0&&f.value==="uniform"){let d=me(e,n+1);if(d<s&&e[d].type===0&&e[d].value==="shader"){let p=me(e,d+1);if(p<s&&e[p].type===0){let b=e[p].value;i.push(b),h=!0,r.push("uniform sampler2D");for(let g=d+1;g<=p;g++)e[g].type===5&&r.push(e[g].value);r.push(b),n=p+1;continue}}}if(f.type===0&&f.value==="uniform"){let d=me(e,n+1);if(d<s&&e[d].type===0){let p=e[d].value;if(p!=="shader"){let b=me(e,d+1);if(b<s&&e[b].type===0){let g=qh[p]||yo[p]||p;t.push({name:e[b].value,glslType:g})}}}}if(f.type===0&&f.value==="main"&&!a){let d=n-1;for(;d>=0&&Ne(e[d]);)d--;let p=me(e,n+1);if(p<s&&e[p].type===3&&e[p].value==="("){let b=me(e,p+1),g=me(e,b+1),C=me(e,g+1);g<s&&e[g].type===0&&(u=e[g].value);let y=C;y<s&&e[y].value===")"&&(y=me(e,y+1));let I=r.length-1;for(;I>=0&&r[I].trim()==="";)I--;I>=0&&r.splice(I,1),r.push("void main()"),n=y,n<s&&e[n].type===3&&e[n].value==="{"&&(r.push(` {
|
|
40
|
+
`),r.push(` vec2 ${u} = vec2(gl_FragCoord.x, u_resolution.y - gl_FragCoord.y) * u_doc_size / u_resolution;
|
|
41
|
+
`),a=!0,m=1,n++);continue}}if(a&&f.type===3&&(f.value==="{"&&m++,f.value==="}"&&(m--,m===0&&(a=!1))),a&&f.type===0&&f.value==="return"){let d=[];n++;let p=0;for(;n<s;){let g=e[n];if(g.type===3&&g.value===";"&&p===0)break;g.type===3&&(g.value==="("||g.value==="[")&&p++,g.type===3&&(g.value===")"||g.value==="]")&&p--,d.push(Oa(e,n,i)),n++}let b=d.join("");r.push(`fragColor = ${b}; return`);continue}if(f.type===0&&i.includes(f.value)){let d=me(e,n+1);if(d<s&&e[d].type===4){let p=me(e,d+1);if(p<s&&e[p].type===0&&e[p].value==="eval"){let b=me(e,p+1);if(b<s&&e[b].value==="("){let g=1,C=b+1,y=C;for(;y<s&&g>0;)e[y].value==="("&&g++,e[y].value===")"&&g--,g>0&&y++;let I=[];for(let v=C;v<y;v++)I.push(Oa(e,v,i));let T=I.join("");r.push(`texture(${f.value}, (${T}) / u_resolution)`),n=y+1;continue}}}}r.push(Oa(e,n,i)),n++}let c=`#version 300 es
|
|
42
|
+
precision highp float;
|
|
43
|
+
`;return c+=`uniform vec2 u_resolution;
|
|
44
|
+
`,c+=`uniform vec2 u_doc_size;
|
|
45
|
+
`,c+=`out vec4 fragColor;
|
|
46
|
+
`,c+=r.join(""),{glsl:c,uniforms:t,childShaders:i}}var Ta=new Set(["int","ivec2","ivec3","ivec4"]);function Zh(o,e){let t=e-1;for(;t>=0&&Ne(o[t]);)t--;if(t>=0){if(o[t].value==="["||o[t].type===0&&Ta.has(o[t].value))return!0;if(o[t].value==="="){let i=t-1;for(;i>=0&&Ne(o[i]);)i--;if(i>=0){let r=i-1;for(;r>=0&&Ne(o[r]);)r--;if(r>=0&&Ta.has(o[r].value))return!0}}if(o[t].value==="<"||o[t].value===">"||o[t].value==="<="||o[t].value===">="||o[t].value==="=="||o[t].value==="!="){let i=t-1;for(;i>=0&&Ne(o[i]);)i--;if(i>=0&&o[i].type===0&&o[i].value.length<=2)return!0}if(o[t].value==="++"||o[t].value==="--")return!0;if(o[t].value==="("||o[t].value===","){let i=t-1;for(;i>=0&&Ne(o[i]);)i--;if(i>=0&&o[i].type===0&&Ta.has(o[i].value))return!0}}return!1}function Oa(o,e,t){let i=o[e];if(i.type===0){if(yo[i.value])return yo[i.value];if(i.value==="sk_FragCoord")return"gl_FragCoord.xy"}if(i.type===1){let r=i.value;if(/^\d+$/.test(r)&&!Zh(o,e))return r+".0"}return i.value}var Qh=`#version 300 es
|
|
47
|
+
in vec2 a_position;
|
|
48
|
+
void main() {
|
|
49
|
+
gl_Position = vec4(a_position, 0.0, 1.0);
|
|
50
|
+
}
|
|
51
|
+
`,Jh=new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]),Io=class{constructor(){this.gl=null;this.vao=null;this.programCache=new Map;this.canvas=document.createElement("canvas")}getCanvas(){return this.canvas}isAvailable(){return this.initGL()!==null}render(e,t,i,r,n,s,a,m,u){let l=this.initGL();if(!l)return!1;(this.canvas.width!==t||this.canvas.height!==i)&&(this.canvas.width=t,this.canvas.height=i);let h=a??e,c=this.programCache.get(h);if(!c){let b=this.compileProgram(l,e);if(!b)return!1;c={program:b,uniformLocations:new Map},this.programCache.set(h,c)}l.useProgram(c.program),l.viewport(0,0,t,i);let f=this.getUniformLoc(l,c,"u_resolution");f&&l.uniform2f(f,t,i);let d=this.getUniformLoc(l,c,"u_doc_size");if(d&&l.uniform2f(d,m??t,u??i),r)for(let[b,g]of r){let C=this.getUniformLoc(l,c,b);if(C)switch(g.length){case 1:l.uniform1f(C,g[0]);break;case 2:l.uniform2f(C,g[0],g[1]);break;case 3:l.uniform3f(C,g[0],g[1],g[2]);break;case 4:l.uniform4f(C,g[0],g[1],g[2],g[3]);break;default:l.uniform1fv(C,g);break}}if(n)for(let[b,g]of n){let C=this.getUniformLoc(l,c,b);if(C)switch(g.length){case 1:l.uniform1i(C,g[0]);break;case 2:l.uniform2i(C,g[0],g[1]);break;case 3:l.uniform3i(C,g[0],g[1],g[2]);break;case 4:l.uniform4i(C,g[0],g[1],g[2],g[3]);break;default:l.uniform1iv(C,g);break}}let p=0;if(s)for(let[b,g]of s){let C=this.getUniformLoc(l,c,b);if(!C){p++;continue}let y=p++;l.activeTexture(l.TEXTURE0+y);let I=l.createTexture();l.bindTexture(l.TEXTURE_2D,I),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MIN_FILTER,l.LINEAR),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MAG_FILTER,l.LINEAR),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),l.texImage2D(l.TEXTURE_2D,0,l.RGBA,l.RGBA,l.UNSIGNED_BYTE,g),l.uniform1i(C,y)}l.bindVertexArray(this.vao),l.drawArrays(l.TRIANGLES,0,6);for(let b=0;b<p;b++)l.activeTexture(l.TEXTURE0+b),l.bindTexture(l.TEXTURE_2D,null);return!0}destroy(){let e=this.gl;if(!e)return;for(let i of this.programCache.values())e.deleteProgram(i.program);this.programCache.clear(),this.vao&&e.deleteVertexArray(this.vao),this.vao=null;let t=e.getExtension("WEBGL_lose_context");t&&t.loseContext(),this.gl=null}initGL(){if(this.gl)return this.gl;let e=this.canvas.getContext("webgl2",{alpha:!0,premultipliedAlpha:!1,preserveDrawingBuffer:!0});if(!e)return null;this.gl=e,this.vao=e.createVertexArray(),e.bindVertexArray(this.vao);let t=e.createBuffer();return e.bindBuffer(e.ARRAY_BUFFER,t),e.bufferData(e.ARRAY_BUFFER,Jh,e.STATIC_DRAW),e.enableVertexAttribArray(0),e.vertexAttribPointer(0,2,e.FLOAT,!1,0,0),e}compileProgram(e,t){let i=this.compileShader(e,e.VERTEX_SHADER,Qh),r=this.compileShader(e,e.FRAGMENT_SHADER,t);if(!i||!r)return null;let n=e.createProgram();return e.attachShader(n,i),e.attachShader(n,r),e.bindAttribLocation(n,0,"a_position"),e.linkProgram(n),e.getProgramParameter(n,e.LINK_STATUS)?(e.deleteShader(i),e.deleteShader(r),n):(console.error("Shader link error:",e.getProgramInfoLog(n)),e.deleteProgram(n),null)}compileShader(e,t,i){let r=e.createShader(t);return e.shaderSource(r,i),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS)?r:(console.error(`Shader compile error (${t===e.VERTEX_SHADER?"vert":"frag"}):`,e.getShaderInfoLog(r)),console.error(`Source:
|
|
52
|
+
`+i.split(`
|
|
53
|
+
`).map((n,s)=>`${s+1}: ${n}`).join(`
|
|
54
|
+
`)),e.deleteShader(r),null)}getUniformLoc(e,t,i){let r=t.uniformLocations.get(i);return r===void 0&&(r=e.getUniformLocation(t.program,i),t.uniformLocations.set(i,r)),r}};var re=class{constructor(e=16){this.mSize=0;this.mKeys=new Int32Array(e).fill(-2147483648),this.mValues=new Array(e).fill(null)}put(e,t){return this.mSize>this.mKeys.length*.75&&this.resize(),this.insert(e,t)}get(e){let t=this.findKey(e);return t<0?null:this.mValues[t]}remove(e){let t=this.findKey(e);if(t<0)return null;let i=this.mValues[t];return this.mKeys[t]=-2147483648,this.mValues[t]=null,this.mSize--,this.rehashFrom(t),i}clear(){this.mKeys.fill(-2147483648),this.mValues.fill(null),this.mSize=0}size(){return this.mSize}keySet(){let e=new Set;for(let t=0;t<this.mKeys.length;t++)this.mKeys[t]!==-2147483648&&e.add(this.mKeys[t]);return e}putAll(e){for(let t=0;t<e.mKeys.length;t++)e.mKeys[t]!==-2147483648&&this.put(e.mKeys[t],e.mValues[t])}insert(e,t){let i=(e%this.mKeys.length+this.mKeys.length)%this.mKeys.length;for(;;){if(this.mKeys[i]===-2147483648)return this.mKeys[i]=e,this.mValues[i]=t,this.mSize++,null;if(this.mKeys[i]===e){let r=this.mValues[i];return this.mValues[i]=t,r}i=(i+1)%this.mKeys.length}}findKey(e){let t=(e%this.mKeys.length+this.mKeys.length)%this.mKeys.length;for(;;){if(this.mKeys[t]===-2147483648)return-1;if(this.mKeys[t]===e)return t;t=(t+1)%this.mKeys.length}}resize(){let e=this.mKeys,t=this.mValues,i=e.length*2;this.mKeys=new Int32Array(i).fill(-2147483648),this.mValues=new Array(i).fill(null),this.mSize=0;for(let r=0;r<e.length;r++)e[r]!==-2147483648&&this.insert(e[r],t[r])}rehashFrom(e){let t=(e+1)%this.mKeys.length;for(;this.mKeys[t]!==-2147483648;){let i=this.mKeys[t],r=this.mValues[t];this.mKeys[t]=-2147483648,this.mValues[t]=null,this.mSize--,this.insert(i,r),t=(t+1)%this.mKeys.length}}};var Co=class{constructor(e=16){this.mSize=0;this.mKeys=new Int32Array(e).fill(-2147483648),this.mValues=new Float32Array(e)}put(e,t){return this.mSize>this.mKeys.length*.75&&this.resize(),this.insert(e,t)}get(e){let t=this.findKey(e);return t<0?0:this.mValues[t]}contains(e){return this.findKey(e)>=0}forEach(e){for(let t=0;t<this.mKeys.length;t++)this.mKeys[t]!==-2147483648&&e(this.mKeys[t],this.mValues[t])}clear(){this.mKeys.fill(-2147483648),this.mValues.fill(0),this.mSize=0}size(){return this.mSize}insert(e,t){let i=(e%this.mKeys.length+this.mKeys.length)%this.mKeys.length;for(;;){if(this.mKeys[i]===-2147483648)return this.mKeys[i]=e,this.mValues[i]=t,this.mSize++,0;if(this.mKeys[i]===e){let r=this.mValues[i];return this.mValues[i]=t,r}i=(i+1)%this.mKeys.length}}findKey(e){let t=(e%this.mKeys.length+this.mKeys.length)%this.mKeys.length;for(;;){if(this.mKeys[t]===-2147483648)return-1;if(this.mKeys[t]===e)return t;t=(t+1)%this.mKeys.length}}resize(){let e=this.mKeys,t=this.mValues,i=e.length*2;this.mKeys=new Int32Array(i).fill(-2147483648),this.mValues=new Float32Array(i),this.mSize=0;for(let r=0;r<e.length;r++)e[r]!==-2147483648&&this.insert(e[r],t[r])}};var vi=class{constructor(e=16){this.mSize=0;this.mKeys=new Int32Array(e).fill(-2147483648),this.mValues=new Int32Array(e)}put(e,t){return this.mSize>this.mKeys.length*.75&&this.resize(),this.insert(e,t)}get(e){let t=this.findKey(e);return t<0?0:this.mValues[t]}contains(e){return this.findKey(e)>=0}clear(){this.mKeys.fill(-2147483648),this.mValues.fill(0),this.mSize=0}size(){return this.mSize}insert(e,t){let i=(e%this.mKeys.length+this.mKeys.length)%this.mKeys.length;for(;;){if(this.mKeys[i]===-2147483648)return this.mKeys[i]=e,this.mValues[i]=t,this.mSize++,0;if(this.mKeys[i]===e){let r=this.mValues[i];return this.mValues[i]=t,r}i=(i+1)%this.mKeys.length}}findKey(e){let t=(e%this.mKeys.length+this.mKeys.length)%this.mKeys.length;for(;;){if(this.mKeys[t]===-2147483648)return-1;if(this.mKeys[t]===e)return t;t=(t+1)%this.mKeys.length}}resize(){let e=this.mKeys,t=this.mValues,i=e.length*2;this.mKeys=new Int32Array(i).fill(-2147483648),this.mValues=new Int32Array(i),this.mSize=0;for(let r=0;r<e.length;r++)e[r]!==-2147483648&&this.insert(e[r],t[r])}};var Ve=class o{constructor(){this.mIntDataMap=new re;this.mIntWrittenMap=new re;this.mDataIntMap=new Map;this.mFloatMap=new Co;this.mIntegerMap=new vi;this.mColorMap=new vi;this.mDataMapMap=new re;this.mObjectMap=new re;this.mPathMap=new re;this.mPathData=new re;this.mPathWinding=new vi;this.mColorOverride=new vi;this.mCollectionMap=new re;this.mDataOverride=new Array(o.MAX_DATA).fill(!1);this.mIntegerOverride=new Array(o.MAX_DATA).fill(!1);this.mFloatOverride=new Array(o.MAX_DATA).fill(!1);this.mNextId=o.START_ID;this.mRemoteContext=null;this.mVarListeners=new re;this.mAllVarListeners=[];this.mLastRepaint=NaN;this.mRepaintSeconds=NaN;this.mCollectionOverride=new Set}static{this.START_ID=42}static{this.BITMAP_TEXTURE_ID_OFFSET=2e3}static{this.MAX_DATA=1e4}getFromId(e){return this.mIntDataMap.get(e)}containsId(e){return this.mIntDataMap.get(e)!=null}dataGetId(e){return this.mDataIntMap.get(e)??-1}cacheData(e,t){if(t!==void 0&&typeof e!="number"){let r=this.createNextAvailableId();return this.mDataIntMap.set(e,r),this.mIntDataMap.put(r,e),r}let i=this.createNextAvailableId();return this.mDataIntMap.set(e,i),this.mIntDataMap.put(i,e),i}cacheDataWithId(e,t){this.mDataIntMap.set(t,e),this.mIntDataMap.put(e,t)}updateData(e,t){if(e<o.MAX_DATA&&this.mDataOverride[e])return;let i=this.mIntDataMap.get(e);i!==t&&(this.mDataIntMap.delete(i),this.mDataIntMap.set(t,e),this.mIntDataMap.put(e,t),this.updateListeners(e))}getPath(e){return this.mPathMap.get(e)}putPath(e,t){this.mPathMap.put(e,t)}putPathData(e,t){this.mPathData.put(e,t),this.mPathMap.remove(e)}getPathData(e){return this.mPathData.get(e)}getPathWinding(e){return this.mPathWinding.get(e)}putPathWinding(e,t){this.mPathWinding.put(e,t)}cacheFloat(e,t){return e===void 0&&(e=this.createNextAvailableId()),this.mFloatMap.put(e,t),e}updateFloat(e,t){if(e<o.MAX_DATA&&this.mFloatOverride[e])return;this.mFloatMap.get(e)!==t&&(this.mFloatMap.put(e,t),this.mIntegerMap.put(e,Math.trunc(t)),this.updateListeners(e))}overrideFloat(e,t){this.mFloatMap.get(e)!==t&&(this.mFloatMap.put(e,t),this.mIntegerMap.put(e,Math.trunc(t)),e<o.MAX_DATA&&(this.mFloatOverride[e]=!0),this.updateListeners(e))}updateInteger(e,t){if(e<o.MAX_DATA&&this.mIntegerOverride[e])return;this.mIntegerMap.get(e)!==t&&(this.mFloatMap.put(e,t),this.mIntegerMap.put(e,t),this.updateListeners(e))}overrideInteger(e,t){this.mIntegerMap.get(e)!==t&&(this.mIntegerMap.put(e,t),this.mFloatMap.put(e,t),e<o.MAX_DATA&&(this.mIntegerOverride[e]=!0),this.updateListeners(e))}getFloatEntries(){let e=[];return this.mFloatMap.forEach((t,i)=>e.push([t,i])),e}getFloat(e){return this.mFloatMap.get(e)}getInteger(e){return this.mIntegerMap.get(e)}getColor(e){return this.mColorMap.get(e)}updateColor(e,t){this.mColorOverride.contains(e)||(this.mColorMap.put(e,t),this.updateListeners(e))}overrideColor(e,t){this.mColorOverride.put(e,1),this.mColorMap.put(e,t),this.updateListeners(e)}clearColorOverride(){this.mColorOverride.clear()}updateListeners(e){let t=this.mVarListeners.get(e);if(t&&this.mRemoteContext)for(let i of t)i.markDirty()}listenToVar(e,t){let i=this.mVarListeners.get(e);i||(i=[],this.mVarListeners.put(e,i)),i.includes(t)||(i.push(t),this.mAllVarListeners.push(t))}getListeners(e){return this.mVarListeners.get(e)}hasListener(e){return this.mVarListeners.get(e)!=null}getOpsToUpdate(e,t){if(this.mVarListeners.get(1)!=null)return 1;let i=Number.MAX_SAFE_INTEGER;if(Number.isNaN(this.mRepaintSeconds)||(i=Math.trunc(this.mRepaintSeconds*1e3),this.mLastRepaint=this.mRepaintSeconds),this.mVarListeners.get(2)!=null){let r=Math.trunc(t%1e3);return Math.min(i,1002-r)}if(this.mVarListeners.get(3)!=null){let r=Math.trunc(t%6e4);return Math.min(i,60002-r)}return Number.isNaN(this.mRepaintSeconds)?-1:Math.trunc(this.mRepaintSeconds*1e3)}wakeIn(e){(Number.isNaN(e)||Number.isNaN(this.mLastRepaint)||this.mRepaintSeconds>e)&&(this.mRepaintSeconds=e)}setWindowWidth(e){this.updateFloat(5,e)}setWindowHeight(e){this.updateFloat(6,e)}addCollection(e,t){this.mCollectionOverride.has(e&1048575)||this.mCollectionMap.put(e&1048575,t)}overrideFloatArray(e,t){let i=Float32Array.from(t);this.mCollectionOverride.add(e&1048575),this.mCollectionMap.put(e&1048575,{values:i,getLength:()=>i.length,getFloatValue:r=>i[r],getFloats:()=>i}),this.updateListeners(e)}clearFloatArrayOverride(e){this.mCollectionOverride.delete(e&1048575),this.updateListeners(e)}getFloatValue(e,t){let i=this.mCollectionMap.get(e&1048575);return i&&typeof i.getFloatValue=="function"?i.getFloatValue(t):0}getFloats(e){let t=this.mCollectionMap.get(e&1048575);return t&&typeof t.getFloats=="function"?t.getFloats():null}getDynamicFloats(e){let t=this.mCollectionMap.get(e&1048575);return t&&typeof t.isDynamic=="boolean"&&t.isDynamic?t.getFloats?.()??null:null}getArray(e){return this.mCollectionMap.get(e&1048575)??null}getId(e,t){let i=this.mCollectionMap.get(e&1048575);return i&&typeof i.getId=="function"?i.getId(t):-1}getListLength(e){let t=this.mCollectionMap.get(e&1048575);return t&&typeof t.getLength=="function"?t.getLength():0}putDataMap(e,t){this.mDataMapMap.put(e,t)}getDataMap(e){return this.mDataMapMap.get(e)}updateObject(e,t){this.mObjectMap.put(e,t)}getObject(e){return this.mObjectMap.get(e)}reset(){this.mIntWrittenMap.clear(),this.mDataIntMap.clear()}wasNotWritten(e){return!this.mIntWrittenMap.get(e)}markWritten(e){this.mIntWrittenMap.put(e,!0)}createNextAvailableId(){return this.mNextId++}setNextId(e){this.mNextId=e}setContext(e){this.mRemoteContext=e,e.clearLastOpCount()}markVariableDirty(e){this.updateListeners(e)}isDataOverridden(e){return e<o.MAX_DATA&&this.mDataOverride[e]}clearDataOverride(e){e<o.MAX_DATA&&(this.mDataOverride[e]=!1),this.updateListeners(e)}clearIntegerOverride(e){e<o.MAX_DATA&&(this.mIntegerOverride[e]=!1),this.updateListeners(e)}clearFloatOverride(e){e<o.MAX_DATA&&(this.mFloatOverride[e]=!1),this.updateListeners(e)}overrideData(e,t){let i=this.mIntDataMap.get(e);i!==t&&(this.mDataIntMap.delete(i),this.mDataIntMap.set(t,e),this.mIntDataMap.put(e,t),e<o.MAX_DATA&&(this.mDataOverride[e]=!0),this.updateListeners(e))}};var tu="https://fonts.googleapis.com/css2",lr={enabled:!0,baseUrl:tu};function tc(o){lr={...lr,...o}}var Zm=[100,200,300,400,500,600,700,800,900];function eu(o,e=lr.baseUrl){let t=Zm.map(r=>`0,${r}`).concat(Zm.map(r=>`1,${r}`)).join(";"),i=encodeURIComponent(o.trim()).replace(/%20/g,"+");return`${e}?family=${i}:ital,wght@${t}&display=block`}function iu(o,e,t=lr.baseUrl){let i=e.filter(a=>a.max>a.min).sort((a,m)=>a.tag<m.tag?-1:1);if(i.length===0)return null;let r=i.map(a=>a.tag).join(","),n=i.map(a=>`${ur(a.min)}..${ur(a.max)}`).join(","),s=encodeURIComponent(o.trim()).replace(/%20/g,"+");return`${t}?family=${s}:${r}@${n}&display=block`}function ur(o){return Number.isInteger(o)?`${o}`:`${o}`.replace(/0+$/,"")}var Aa="google:";function Pa(o){let e=o.trim();return e.toLowerCase().startsWith(Aa)?{source:"google",name:e.slice(Aa.length).trim()}:{source:"local",name:e}}var Ea=new Map,Ti=new Map,Qe=new Map,Hr=new Set,Fe=new Map;function ec(o,e,t,i=[]){let r=i.map(({tag:n,value:s})=>`${n}=${s}`).join(",");return`${o.toLowerCase()}|${e}|${t?"i":"n"}|${r}`}function ru(o){Hr.add(o);let e=Fe.get(o);Fe.delete(o),e?.forEach(t=>t())}var Ma=new Set;function nu(o){return o.replace(/^["']|["']$/g,"")}function Oo(o){return o.replace(/[\\"]/g,"\\$&")}function ic(o){let e=o.toLowerCase(),t=!1;return document.fonts.forEach(i=>{nu(i.family).toLowerCase()===e&&(t=!0)}),t}var Fa=new Set;function rc(o){let e=o.toLowerCase(),t=!1;return document.fonts.forEach(i=>{nu(i.family).toLowerCase()===e&&(i.weight.includes(" ")||i.stretch.includes(" "))&&(t=!0)}),t}function nc(o){return new Promise((e,t)=>{let i=document.createElement("link");i.rel="stylesheet",i.href=o,i.addEventListener("load",()=>e()),i.addEventListener("error",()=>t(new Error(`stylesheet did not load: ${o}`))),document.head.appendChild(i)})}var Sa=new Map;function sc(o,e){let t=o.toLowerCase(),i=Sa.get(t)??new Map;for(let{tag:r,value:n}of e){let s=i.get(r);s?(s.min=Math.min(s.min,n),s.max=Math.max(s.max,n)):i.set(r,{min:n,max:n})}return Sa.set(t,i),[...i].map(([r,{min:n,max:s}])=>({tag:r,min:n,max:s}))}function Qm(o,e=eu(o),t=!1){let i=`${o.toLowerCase()}|${e}`,r=Ea.get(i);if(r)return r;let n;return lr.enabled?typeof document>"u"||!document.fonts||(t?!Fa.has(o.toLowerCase())&&rc(o):ic(o))?n=Promise.resolve():(t&&Fa.add(o.toLowerCase()),n=nc(e)):n=Promise.resolve(),Ea.set(i,n),n}async function oc(o,e,t,i){if(await Qm(o),i.length>0){let r=iu(o,sc(o,i));r&&await Qm(o,r,!0).catch(()=>{})}typeof document>"u"||!document.fonts||await document.fonts.load(`${t?"italic ":""}${e} 16px "${Oo(o)}"`)}function xo(o,e=400,t=!1,i,r=[]){let n=ec(o,e,t,r);if(i&&!Hr.has(n)){let m=Fe.get(n)??new Set;m.add(i),Fe.set(n,m)}let s=Ti.get(n);if(s)return s;let a=oc(o,e,t,r).catch(m=>{let u=o.toLowerCase();Ma.has(u)||(Ma.add(u),console.warn(`WebFonts: no web font for "${o}", using the fallback stack`,m))}).then(()=>ru(n));return Ti.set(n,a),a}function su(o,e){let t=2166136261;for(let i of e)t^=i,t=Math.imul(t,16777619);return`__rc_font_${o}_${e.length}_${(t>>>0).toString(16)}`}function vo(o,e){return o[e]<<8|o[e+1]}function To(o,e){return(o[e]<<24|o[e+1]<<16|o[e+2]<<8|o[e+3])>>>0}function Jm(o,e){return(To(o,e)|0)/65536}function xa(o,e){return String.fromCharCode(o[e],o[e+1],o[e+2],o[e+3])}function ou(o){try{let e=0;if(o.length>=16&&xa(o,0)==="ttcf"){if(To(o,8)<1)return{};e=To(o,12)}if(e+12>o.length)return{};let t=vo(o,e+4),i=-1;for(let m=0;m<t;m++){let u=e+12+m*16;if(u+16>o.length)return{};if(xa(o,u)==="fvar"){i=To(o,u+8);break}}if(i<0||i+16>o.length)return{};let r=vo(o,i+4),n=vo(o,i+8),s=vo(o,i+10);if(s<20)return{};let a={};for(let m=0;m<n;m++){let u=i+r+m*s;if(u+20>o.length)return{};let l=xa(o,u),h=Jm(o,u+4),c=Jm(o,u+12);!Number.isFinite(h)||!Number.isFinite(c)||c<h||(l==="wght"&&(a.weight=`${ur(h)} ${ur(c)}`),l==="wdth"&&(a.stretch=`${ur(h)}% ${ur(c)}%`))}return a}catch{return{}}}function _a(o,e,t){let i=su(o,e),r=`embedded|${i}`;if(t&&!Hr.has(r)){let m=Fe.get(r)??new Set;m.add(t),Fe.set(r,m)}let n=Qe.get(r);if(n)return n.references+=1,i;let s;if(typeof document>"u"||!document.fonts||typeof FontFace>"u")Qe.set(r,{references:1}),s=Promise.resolve();else{let m=e.slice().buffer,u=new FontFace(i,m,ou(e));Qe.set(r,{face:u,references:1}),document.fonts.add(u),s=u.load().then(()=>{}).catch(l=>{console.warn(`WebFonts: embedded font ${o} could not be loaded`,l)})}let a=s.then(()=>{Qe.has(r)&&ru(r)});return Ti.set(r,a),i}function Ao(o,e,t){let i=`embedded|${su(o,e)}`,r=Fe.get(i);t&&r?.delete(t),r?.size===0&&Fe.delete(i);let n=Qe.get(i);n&&(n.references-=1,!(n.references>0)&&(n.face&&typeof document<"u"&&document.fonts&&document.fonts.delete(n.face),Qe.delete(i),Ti.delete(i),Hr.delete(i),Fe.delete(i)))}async function Ra(){let o=[...Ti.values()];for(;o.length>0;){await Promise.all(o);let e=[...Ti.values()];if(e.length===o.length)break;o=e}}function ac(){typeof document<"u"&&document.fonts&&Qe.forEach(({face:o})=>{o&&document.fonts.delete(o)}),Qe.clear(),Ea.clear(),Sa.clear(),Fa.clear(),Ti.clear(),Hr.clear(),Fe.clear(),Ma.clear(),lr={enabled:!0,baseUrl:tu}}var au=6.2831855,mc=1.5707964,Eo=1e-6,uu=16384;function Ur(o){return o===1||o===2||o===4}function lu(o,e,t){return o===4?e+1:e*t}function uc(o,e,t){return o===4?e*3:t<2||e<2?0:(Ur(o)?e:e-1)*(t-1)*6}function Ba(o,e,t){return t<=1?0:Ur(o)?e/t:e/(t-1)}function hu(o,e){return e<=1?0:o/(e-1)}function cu(o,e,t){let i=new Int32Array(Math.max(0,uc(o,e,t))),r=0;if(o===4){for(let a=0;a<e;a++)i[r++]=0,i[r++]=1+a,i[r++]=1+(a+1)%e;return i}if(t<2||e<2)return i;let n=Ur(o),s=n?e:e-1;for(let a=0;a<t-1;a++)for(let m=0;m<s;m++){let u=n?(m+1)%e:m+1,l=a*e+m,h=a*e+u,c=(a+1)*e+m,f=(a+1)*e+u;i[r++]=l,i[r++]=c,i[r++]=h,i[r++]=h,i[r++]=c,i[r++]=f}return i}function du(o,e,t,i){switch(o){case 1:case 4:{let r=e*au;i[0]=t*Math.cos(r),i[1]=t*Math.sin(r);break}case 2:{let r=e*au,n=.5+(1-.5)*t;i[0]=n*Math.cos(r),i[1]=n*Math.sin(r);break}default:i[0]=e,i[1]=t;break}}var Da=new Float32Array(1),pu=new Int32Array(Da.buffer);function wa(o){let e=(o&32768)<<16,t=o>>10&31,i=o&1023,r;if(t===0)if(i===0)r=e;else{let n=0;for(;(i&1024)===0;)i<<=1,n++;i&=1023,r=e|112-n<<23|i<<13}else t===31?r=e|2139095040|i<<13:r=e|t-15+127<<23|i<<13;return pu[0]=r,Da[0]}var So=10,lc=11,hc=12,cc=13,dc=14,pc=15,Po=16,hr=16;function _o(o){return Da[0]=o,pu[0]&4194303}function fc(o){if(!Number.isNaN(o))return!1;let e=_o(o);return e>=So&&e<=Po}function fu(o,e){let t=[],i=0,r=0,n=0,s=0,a=!1,m=(h,c)=>{let f=t.length;f>=2&&t[f-2]===h&&t[f-1]===c||t.push(h,c)},u=0,l=o.length;for(;u<l;){if(!fc(o[u])){u++;continue}switch(_o(o[u])){case So:u++,u+1<l&&(n=i=e(o[u]),s=r=e(o[u+1]),m(n,s),a=!0,u+=2);break;case lc:u+=3,u+1<l&&(n=e(o[u]),s=e(o[u+1]),m(n,s),u+=2);break;case hc:if(u+=3,u+3<l){let h=e(o[u]),c=e(o[u+1]),f=e(o[u+2]),d=e(o[u+3]);for(let p=1;p<=hr;p++){let b=p/hr,g=1-b;m(g*g*n+2*g*b*h+b*b*f,g*g*s+2*g*b*c+b*b*d)}n=f,s=d,u+=4}break;case cc:if(u+=3,u+4<l){let h=e(o[u]),c=e(o[u+1]),f=e(o[u+2]),d=e(o[u+3]),p=e(o[u+4]);for(let b=1;b<=hr;b++){let g=b/hr,C=1-g,y=C*C,I=2*C*g*p,T=g*g,v=y+I+T;v!==0&&m((y*n+I*h+T*f)/v,(y*s+I*c+T*d)/v)}n=f,s=d,u+=5}break;case dc:if(u+=3,u+5<l){let h=e(o[u]),c=e(o[u+1]),f=e(o[u+2]),d=e(o[u+3]),p=e(o[u+4]),b=e(o[u+5]);for(let g=1;g<=hr;g++){let C=g/hr,y=1-C,I=y*y*y,T=3*y*y*C,v=3*y*C*C,_=C*C*C;m(I*n+T*h+v*f+_*p,I*s+T*c+v*d+_*b)}n=p,s=b,u+=6}break;case pc:u++,a&&m(i,r),n=i,s=r;break;case Po:default:return new Float32Array(t)}}return new Float32Array(t)}function Ro(o,e,t,i){if(i[0]=0,i[1]=0,i[2]=1,i[3]=0,e<2){e===1&&(i[0]=o[0],i[1]=o[1]);return}let r=0;for(let a=0;a+1<e;a++){let m=o[(a+1)*2]-o[a*2],u=o[(a+1)*2+1]-o[a*2+1];r+=Math.sqrt(m*m+u*u)}if(r<=0){i[0]=o[0],i[1]=o[1];return}let n=Math.min(Math.max(t,0),1)*r,s=0;for(let a=0;a+1<e;a++){let m=o[a*2],u=o[a*2+1],l=o[(a+1)*2],h=o[(a+1)*2+1],c=l-m,f=h-u,d=Math.sqrt(c*c+f*f);if(!(d<=0)){if(s+d>=n||a+2===e){let p=Math.min(Math.max((n-s)/d,0),1);i[0]=m+c*p,i[1]=u+f*p,i[2]=c/d,i[3]=f/d;return}s+=d}}}function La(o,e,t,i,r,n){let s=o[2]*r,a=o[3]*r,m=-o[3],u=o[2],l=(1-t)*mc,h=Math.sin(l)*e,c=Math.cos(l)*e,f=(i-.5)*2;n[0]=o[0]+s*h+m*c*f,n[1]=o[1]+a*h+u*c*f}var Fo=class{constructor(){this.x=[];this.y=[];this.m=[]}fit(e,t){this.x=e,this.y=t;let i=e.length;if(this.m=new Array(i).fill(0),i<2)return;let r=new Array(i-1).fill(0);for(let n=0;n+1<i;n++){let s=e[n+1]-e[n];r[n]=s!==0?(t[n+1]-t[n])/s:0}this.m[0]=r[0],this.m[i-1]=r[i-2];for(let n=1;n+1<i;n++)this.m[n]=r[n-1]*r[n]<=0?0:(r[n-1]+r[n])*.5;for(let n=0;n+1<i;n++){if(r[n]===0){this.m[n]=0,this.m[n+1]=0;continue}let s=this.m[n]/r[n],a=this.m[n+1]/r[n],m=s*s+a*a;if(m>9){let u=3/Math.sqrt(m);this.m[n]=u*s*r[n],this.m[n+1]=u*a*r[n]}}}get isEmpty(){return this.x.length===0}at(e){let t=this.x.length;if(t===0)return 0;if(t===1||e<=this.x[0])return this.y[0];if(e>=this.x[t-1])return this.y[t-1];let i=0;for(;i+2<t&&e>this.x[i+1];)i++;let r=this.x[i+1]-this.x[i];if(r<=0)return this.y[i];let n=(e-this.x[i])/r,s=n*n,a=s*n;return(2*a-3*s+1)*this.y[i]+(a-2*s+n)*r*this.m[i]+(-2*a+3*s)*this.y[i+1]+(a-s)*r*this.m[i+1]}};function mu(o,e,t,i,r,n,s,a,m){let u=o[(i*e+t)*2+m],l=o[(i*e+r)*2+m],h=o[(n*e+t)*2+m],c=o[(n*e+r)*2+m],f=u+(l-u)*s,d=h+(c-h)*s;return f+(d-f)*a}function Oi(o,e,t,i,r,n,s){let a=i.length/2;if(a===0){s[0]=0,s[1]=0;return}if(o===4&&e>=1&&a===e+1){let l=(r%1+1)%1*e,h=Math.floor(l)%e,c=(h+1)%e,f=l-Math.floor(l),d=(1-f)*i[(1+h)*2]+f*i[(1+c)*2],p=(1-f)*i[(1+h)*2+1]+f*i[(1+c)*2+1],b=Math.min(Math.max(n,0),1);s[0]=(1-b)*i[0]+b*d,s[1]=(1-b)*i[1]+b*p;return}if(e>=2&&t>=2&&e*t===a){let u,l,h;if(Ur(o)){let g=(r%1+1)%1*e;u=Math.floor(g)%e,l=(u+1)%e,h=g-Math.floor(g)}else{let b=Math.min(Math.max(r,0),1)*(e-1);u=Math.floor(b),l=Math.min(e-1,u+1),h=b-u}let c=Math.min(Math.max(n,0),1)*(t-1),f=Math.floor(c),d=Math.min(t-1,f+1),p=c-f;s[0]=mu(i,e,u,f,l,d,h,p,0),s[1]=mu(i,e,u,f,l,d,h,p,1);return}let m=Math.max(0,Math.min(a-1,Math.round(Math.min(Math.max(r,0),1)*(a-1))));s[0]=i[m*2],s[1]=i[m*2+1]}function gu(o,e,t,i,r,n,s){if(i.length<2)return!1;let a=Math.max(2,e),m=Math.max(2,t),u=Ur(o),l=1/(u?a:a-1),h=1/(m-1),c=new Float32Array(2),f=new Float32Array(2),d=new Float32Array(2),p=new Float32Array(2),b=new Float32Array(2);Oi(o,e,t,i,r,n,c);let g;if(u)Oi(o,e,t,i,r+l*.5,n,f),Oi(o,e,t,i,r-l*.5,n,d),g=l;else{let T=Math.min(1,r+l*.5),v=Math.max(0,r-l*.5);Oi(o,e,t,i,T,n,f),Oi(o,e,t,i,v,n,d),g=T-v,g<=0&&(g=l)}let C=Math.min(1,n+h*.5),y=Math.max(0,n-h*.5);Oi(o,e,t,i,r,C,p),Oi(o,e,t,i,r,y,b);let I=C-y;return I<=0&&(I=h),s[0]=(f[0]-d[0])/g,s[1]=(f[1]-d[1])/g,s[2]=(p[0]-b[0])/I,s[3]=(p[1]-b[1])/I,s[4]=c[0],s[5]=c[1],!0}function bu(o,e,t){let i=o[0],r=o[1],n=o[2],s=o[3],a=o[4],m=o[5],u=Math.hypot(i,r),l=Math.hypot(n,s),h=i*s-r*n,c=e;switch(c>=3&&Math.abs(h)<Eo&&(c=2),c>=2&&(u<Eo||l<Eo)&&(c=1),c>=1&&u<Eo&&(c=0),c){case 3:t[0]=i,t[1]=r,t[2]=n,t[3]=s;break;case 2:{let f=i/u,d=r/u,p=h<0?-1:1;t[0]=f*u,t[1]=d*u,t[2]=-d*l*p,t[3]=f*l*p;break}case 1:{let f=i/u,d=r/u,p=h<0?-1:1;t[0]=f,t[1]=d,t[2]=-d*p,t[3]=f*p;break}default:t[0]=1,t[1]=0,t[2]=0,t[3]=1;break}t[4]=a,t[5]=m}function Mo(o){let e=Math.trunc(o*255+.5);return e<0?0:e>255?255:e}function yu(o,e,t,i){return Mo(o)<<24|Mo(e)<<16|Mo(t)<<8|Mo(i)|0}var Cu=[[50,"ultra-condensed"],[62.5,"extra-condensed"],[75,"condensed"],[87.5,"semi-condensed"],[100,"normal"],[112.5,"semi-expanded"],[125,"expanded"],[150,"extra-expanded"],[200,"ultra-expanded"]];function Ic(o){let e=Cu[0];for(let t of Cu)Math.abs(t[0]-o)<Math.abs(e[0]-o)&&(e=t);return e[1]}function Gr(o){let e=(o>>>24&255)/255,t=o>>>16&255,i=o>>>8&255,r=o&255;return`rgba(${t},${i},${r},${e.toFixed(3)})`}function xi(o){switch(o){case 2:return'"Noto Serif", serif';case 3:return'"Droid Sans Mono", monospace';default:return"Roboto, sans-serif"}}function Na(o){return`"${Oo(o)}", ${xi(0)}`}var cr=32;function Cc(o,e){let t=[],i=[];for(let r=0;r<o.length;r+=2)t.push(o[r]),i.push(o[r+1]);for(let r=t.length-1;r>0;r--)for(let n=0;n<r;n++)t[n]+=(t[n+1]-t[n])*e,i[n]+=(i[n+1]-i[n])*e;return[t[0],i[0]]}function vc(o,e,t){let i=(n,s,a)=>{let m=n.length/2,u=[],l=[];for(let b=0;b<m;b++)u.push(n[2*b]),l.push(n[2*b+1]);let h=[u[0]],c=[l[0]],f=[u[m-1]],d=[l[m-1]];for(let b=m-1;b>0;b--){for(let g=0;g<b;g++)u[g]+=(u[g+1]-u[g])*s,l[g]+=(l[g+1]-l[g])*s;h.push(u[0]),c.push(l[0]),f.push(u[b-1]),d.push(l[b-1])}let p=[];if(a)for(let b=0;b<m;b++)p.push(h[b],c[b]);else for(let b=m-1;b>=0;b--)p.push(f[b],d[b]);return p},r=t<1?i(o,t,!0):o;return e>0&&(r=i(r,t>0?e/t:0,!1)),r}function Tc(o){if(o.length===4)return{pts:o,len:Math.hypot(o[2]-o[0],o[3]-o[1]),cum:null};let e=new Float64Array(cr+1),[t,i]=[o[0],o[1]];for(let r=1;r<=cr;r++){let[n,s]=Cc(o,r/cr);e[r]=e[r-1]+Math.hypot(n-t,s-i),t=n,i=s}return{pts:o,len:e[cr],cum:e}}function vu(o,e){if(o.len<=0)return 0;if(!o.cum)return Math.min(1,Math.max(0,e/o.len));let t=o.cum,i=1;for(;i<cr&&t[i]<e;)i++;let r=t[i]-t[i-1],n=r>0?(e-t[i-1])/r:0;return Math.min(1,Math.max(0,(i-1+n)/cr))}function Oc(o){let e=[],t=0,i=0,r=0,n=0,s=0,a=()=>t>0,m=u=>{let l=Tc(u);e.push(l),t+=l.len};for(let u of o)switch(u[0]){case"M":if(a())return e;e=[],t=0,i=n=u[1],r=s=u[2];break;case"L":m([n,s,u[3],u[4]]),n=u[3],s=u[4];break;case"Q":m([n,s,u[3],u[4],u[5],u[6]]),n=u[5],s=u[6];break;case"C":m([n,s,u[3],u[4],u[5],u[6],u[7],u[8]]),n=u[7],s=u[8];break;case"Z":if(m([n,s,i,r]),n=i,s=r,a())return e;e=[],t=0;break}return a()?e:[]}function xc(o,e,t){let i=new Path2D,r=Oc(o),n=0;for(let l of r)n+=l.len;if(n<=0)return i;let s=e*n,a=t*n,m=0,u=!1;for(let l of r){let h=m,c=m+l.len;if(m=c,l.len<=0||c<s||h>a)continue;let f=vu(l,Math.max(0,s-h)),d=vu(l,Math.min(l.len,a-h));if(d<f)continue;let p=vc(l.pts,f,d);if(u||(i.moveTo(p[0],p[1]),u=!0),p.length===4?i.lineTo(p[2],p[3]):p.length===6?i.quadraticCurveTo(p[2],p[3],p[4],p[5]):i.bezierCurveTo(p[2],p[3],p[4],p[5],p[6],p[7]),c>=a)break}return i}var Tu=14,Ac=.92,Ec=.24,Mc=.528,We=class o extends ee{constructor(t,i){super(t);this.color="rgba(0,0,0,1)";this.colorArgb=-16777216;this.style=0;this.strokeWidth=1;this.textSize=14;this.alpha=1;this.lineCap="butt";this.lineJoin="miter";this.miterLimit=10;this.blendMode="source-over";this.antiAlias=!0;this.filterBitmap=!0;this.letterSpacing=0;this.gradientStyle=null;this.gradientSpec=null;this.fontFamily=xi(0);this.fontWeight=400;this.fontItalic=!1;this.fontAxes=[];this.googleFamily=null;this.colorFilterColor=null;this.colorFilterArgb=0;this.colorFilterMode=3;this.activeShaderData=null;this.shaderRenderer=null;this.glslCache=new Map;this.paintStack=[];this.pathDataCache=new Map;this.pathWindingCache=new Map;this.bitmapCache=new Map;this.animatedBitmaps=new Map;this.disposed=!1;this.bitmapVideos=new Map;this.meshCache=new Map;this.bitmapPromises=new Map;this.texturePixels=new Map;this.textCache=new Map;this.layerStack=[];this.createLayerCanvas=(t,i)=>{if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(t,i).getContext("2d");if(typeof document<"u"){let r=document.createElement("canvas");return r.width=t,r.height=i,r.getContext("2d")}throw new Error("No canvas factory available for graphics layers")};this.inputClip={rectangles:[],rounded:[],unsupported:!1};this.inputClipStack=[];this.mainInputClip=null;this.embeddedFontFamilies=new Map;this.onFontLoaded=null;this.mTextMeasureCache=new Map;this.mLayerAlpha=1;this.mLayerAlphaStack=[];this.mainCanvas=null;this.bitmapCanvasCache=new Map;this.emptyBitmapSizes=new Map;this.d3=null;this.d3gl=null;this.d3glMesh=Nm();this.d3glDirty=!1;this.d3glTexGen=-1;this.d3Blit=null;this.d3Super=1;this.supersample3D=o.supersample3D;if(!i)throw new Error("CanvasPaintContext: canvas rendering context is null or undefined");this.ctx=i}destroy(){this.shaderRenderer&&(this.shaderRenderer.destroy(),this.shaderRenderer=null),this.embeddedFontFamilies.forEach(({data:t},i)=>{Ao(i,t,this.onFontLoaded??void 0)}),this.embeddedFontFamilies.clear()}getInputClip(){return this.inputClip}inheritInputClip(t){this.inputClip=t.inputClip}recordInputRect(t,i,r,n){let s=this.ctx.getTransform(),a=[{x:t,y:i},{x:r,y:i},{x:r,y:n},{x:t,y:n}].map(m=>uo(s,m));this.inputClip={...this.inputClip,rectangles:[...this.inputClip.rectangles,a]}}getCanvas(){return this.ctx}setCanvas(t){this.ctx=t}loadText(t,i){this.textCache.set(t,i)}getText(t){return this.textCache.get(t)??null}loadFont(t,i){let r=this.embeddedFontFamilies.get(t);r?.data!==i&&(r&&Ao(t,r.data,this.onFontLoaded??void 0),this.embeddedFontFamilies.set(t,{data:i,family:_a(t,i,this.onFontLoaded??void 0)}))}fontStackForTypeface(t){if(t<Ve.START_ID)return xi(t);let i=this.embeddedFontFamilies.get(t);if(i)return this.googleFamily=null,Na(i.family);let r=this.getText(t);if(!r)return xi(0);let{source:n,name:s}=Pa(r);return s?(this.googleFamily=n==="google"?s:null,n==="google"&&xo(s,this.fontWeight,this.fontItalic,this.onFontLoaded??void 0,this.fontAxes),Na(s)):xi(0)}loadBitmap(t,i,r,n,s,a){if(this.bitmapPromises.has(t))return;if(i===3||i===4||a.length===0){i===3&&this.emptyBitmapSizes.set(t,{width:n,height:s});return}a.length>6&&a[0]===71&&a[1]===73&&a[2]===70&&a[3]===56&&!this.bitmapVideos.has(t)&&typeof globalThis.ImageDecoder<"u"&&this.loadAnimatedBitmap(t,a);let u=new Blob([a.buffer],{type:"image/png"}),l=URL.createObjectURL(u),h=new Image,c=new Promise(f=>{h.onload=()=>{URL.revokeObjectURL(l),this.bitmapCache.set(t,h),f()},h.onerror=d=>{URL.revokeObjectURL(l),console.warn(`CanvasPaintContext: failed to load bitmap ${t}`,d),f()},h.src=l});this.bitmapPromises.set(t,c)}async bitmapsReady(){await Promise.all(this.bitmapPromises.values())}setBitmapVideos(t){for(let r of this.bitmapVideos.values())r.pause(),r.removeAttribute("src"),r.load(),r.remove();if(this.bitmapVideos.clear(),!t||typeof document>"u")return;let i=t instanceof Map?[...t.entries()]:Object.entries(t).map(([r,n])=>[Number(r),n]);for(let[r,n]of i){let s=document.createElement("video");s.muted=!0,s.loop=!0,s.playsInline=!0,s.preload="auto",s.src=n,s.style.cssText="position:fixed;left:-4px;top:-4px;width:2px;height:2px;opacity:0;pointer-events:none",document.body.appendChild(s),s.play().catch(()=>{}),this.bitmapVideos.set(r,s)}}async loadAnimatedBitmap(t,i){try{let r=globalThis.ImageDecoder,n=new r({data:i,type:"image/gif"});await n.tracks.ready;let s=n.tracks.selectedTrack,a=s?s.frameCount:0;if(a<2||this.disposed){n.close();return}let m={decoder:n,count:a,index:-1,frame:null,frameEnds:0,decoding:!1,failed:!1};this.animatedBitmaps.set(t,m),this.needsRepaint()}catch(r){console.warn(`CanvasPaintContext: cannot animate bitmap ${t}`,r)}}advanceAnimated(t,i){if(t.decoding||t.failed||t.count<1)return;t.decoding=!0;let r=(t.index+1)%t.count;t.decoder.decode({frameIndex:r}).then(n=>{let s=n.image,a=(s.duration??0)/1e6;if(a>=.02||(a=.1),this.disposed){s.close();return}t.frame&&t.frame.close(),t.frame=s,t.index=r,t.frameEnds=Math.max(i,t.frameEnds)+a,t.decoding=!1,this.needsRepaint()}).catch(n=>{t.failed=!0,t.decoding=!1,console.warn("CanvasPaintContext: animated bitmap frame failed",n)})}bitmapToDraw(t){let i=this.bitmapCanvasCache.get(t);if(i)return i.canvas;let r=this.bitmapVideos.get(t);if(r)return this.needsRepaint(),r.readyState>=2&&r.videoWidth>0?(r.paused&&r.play().catch(()=>{}),r):this.bitmapCache.get(t);let n=this.animatedBitmaps.get(t);if(!n)return this.bitmapCache.get(t);let s=this.getContext(),a=s?s.getAnimationTime():0;return(n.index<0||a>=n.frameEnds)&&this.advanceAnimated(n,a),this.needsRepaint(),n.frame??this.bitmapCache.get(t)}dispose(){this.disposed=!0;for(let t of this.bitmapVideos.values())t.pause(),t.removeAttribute("src"),t.load(),t.remove();this.bitmapVideos.clear();for(let t of this.animatedBitmaps.values()){try{t.decoder.close()}catch{}t.frame&&t.frame.close()}this.animatedBitmaps.clear();for(let t of this.bitmapCache.values())typeof t.close=="function"&&t.close();this.bitmapCache.clear()}loadPathData(t,i,r){this.pathDataCache.set(t,r),this.pathWindingCache.set(t,i)}static{this.PATH_MOVE=10}static{this.PATH_LINE=11}static{this.PATH_QUADRATIC=12}static{this.PATH_CONIC=13}static{this.PATH_CUBIC=14}static{this.PATH_CLOSE=15}static{this.PATH_DONE=16}static{this.NANMAP_PATH_BASE=3145728}pathCoord(t){return O(t)?this.mContext.getFloat(x(t)):ht(t)}decodePath(t){let i=[],r=s=>this.pathCoord(t[s]),n=0;for(;n<t.length;){let s=t[n],a=O(s)?x(s):ht(s);switch(a>=o.NANMAP_PATH_BASE&&a<=o.NANMAP_PATH_BASE+6&&(a=o.PATH_MOVE+(a-o.NANMAP_PATH_BASE)),a){case o.PATH_MOVE:i.push(["M",r(n+1),r(n+2)]),n+=3;break;case o.PATH_LINE:i.push(["L",r(n+1),r(n+2),r(n+3),r(n+4)]),n+=5;break;case o.PATH_QUADRATIC:i.push(["Q",r(n+1),r(n+2),r(n+3),r(n+4),r(n+5),r(n+6)]),n+=7;break;case o.PATH_CONIC:i.push(["Q",r(n+1),r(n+2),r(n+3),r(n+4),r(n+5),r(n+6)]),n+=8;break;case o.PATH_CUBIC:i.push(["C",r(n+1),r(n+2),r(n+3),r(n+4),r(n+5),r(n+6),r(n+7),r(n+8)]),n+=9;break;case o.PATH_CLOSE:i.push(["Z"]),n++;break;case o.PATH_DONE:return i;default:n++;break}}return i}buildPath2D(t,i=0,r=1){let n=this.decodePath(t);if(i>0||r<1)return i<r?xc(n,Math.max(i,0),Math.min(r,1)):new Path2D;let s=new Path2D;for(let a of n)switch(a[0]){case"M":s.moveTo(a[1],a[2]);break;case"L":s.lineTo(a[3],a[4]);break;case"Q":s.quadraticCurveTo(a[3],a[4],a[5],a[6]);break;case"C":s.bezierCurveTo(a[3],a[4],a[5],a[6],a[7],a[8]);break;case"Z":s.closePath();break}return s}getEffectiveColor(){if(this.colorFilterColor===null)return this.gradientStyle??this.color;switch(this.colorFilterMode){case 0:return"rgba(0,0,0,0)";case 1:return this.colorFilterColor;case 2:return this.gradientStyle??this.color;case 3:return this.colorFilterColor;case 4:return this.gradientStyle??this.color;case 5:return this.colorFilterColor;case 6:return this.gradientStyle??this.color;case 7:return"rgba(0,0,0,0)";case 8:return"rgba(0,0,0,0)";case 9:return this.colorFilterColor;case 10:return this.gradientStyle??this.color;case 11:return"rgba(0,0,0,0)";default:return this.computeColorFilterBlend()}}computeColorFilterBlend(){let t=(this.colorFilterArgb>>>24&255)/255,i=this.colorFilterArgb>>>16&255,r=this.colorFilterArgb>>>8&255,n=this.colorFilterArgb&255,s=this.color.match(/rgba?\((\d+),(\d+),(\d+),?([^)]*)\)/),a=s?parseInt(s[1]):0,m=s?parseInt(s[2]):0,u=s?parseInt(s[3]):0,l=s&&s[4]?parseFloat(s[4]):1,h,c,f,d,p=(b,g)=>{switch(this.colorFilterMode){case 12:return Math.min(255,b+g);case 13:return b*g/255;case 14:return b+g-b*g/255;case 15:return g<=127?2*b*g/255:255-2*(255-b)*(255-g)/255;case 16:return Math.min(b,g);case 17:return Math.max(b,g);case 18:return g===0?0:Math.min(255,b*255/(255-g));case 19:return g===255?255:Math.max(0,255-(255-b)*255/g);case 20:return b<=127?2*b*g/255:255-2*(255-b)*(255-g)/255;case 21:{let C=b/255;return g<=127?g-(1-2*C)*g*(1-g/255)*255:g+(2*C-1)*(Math.sqrt(g/255)*255-g)}case 22:return Math.abs(b-g);case 23:return b+g-2*b*g/255;case 24:return b*g/255;default:return b}};return h=p(i,a),c=p(r,m),f=p(n,u),d=Math.min(1,t+l-t*l),`rgba(${Math.round(h)},${Math.round(c)},${Math.round(f)},${d.toFixed(3)})`}createSweepGradientPattern(t,i,r,n){let s=this.mContext,a=s&&s.mWidth||256,m=s&&s.mHeight||256;try{let u=this.createLayerCanvas(a,m),l=u.createImageData(a,m),h=l.data,c=r.map(f=>[f>>>16&255,f>>>8&255,f&255,(f>>>24&255)/255]);for(let f=0;f<m;f++)for(let d=0;d<a;d++){let p=Math.atan2(f-i,d-t);p<0&&(p+=Math.PI*2);let b=p/(Math.PI*2),g=0;for(let E=0;E<n.length-1;E++)b>=n[E]&&(g=E);let C=n[g],I=n[Math.min(g+1,n.length-1)]-C,T=I>0?(b-C)/I:0,v=c[g],_=c[Math.min(g+1,c.length-1)],P=(f*a+d)*4;h[P]=v[0]+(_[0]-v[0])*T,h[P+1]=v[1]+(_[1]-v[1])*T,h[P+2]=v[2]+(_[2]-v[2])*T,h[P+3]=(v[3]+(_[3]-v[3])*T)*255}return u.putImageData(l,0,0),this.ctx.createPattern(u.canvas,"no-repeat")}catch{return null}}fillStyleUnderGlyph(t,i,r){let n=this.gradientStyle;if(!n)return null;let s=Math.cos(r),a=Math.sin(r),m=s,u=-a,l=a,h=s,c=-(t*s+i*a),f=t*a-i*s;if(typeof n.setTransform=="function"){let g=this.ctx.getTransform();return g.a=m,g.b=u,g.c=l,g.d=h,g.e=c,g.f=f,n.setTransform(g),n}let d=this.gradientSpec;if(!d)return n;let p=(g,C)=>[m*g+l*C+c,u*g+h*C+f],b=null;if(d.kind==="sweep"){if(typeof this.ctx.createConicGradient!="function")return n;let[g,C]=p(d.cx,d.cy);b=this.ctx.createConicGradient(-r,g,C)}else if(d.kind==="radial"){let[g,C]=p(d.cx,d.cy);b=this.ctx.createRadialGradient(g,C,0,g,C,d.radius)}else{let[g,C]=p(d.x1,d.y1),[y,I]=p(d.x2,d.y2);b=this.ctx.createLinearGradient(g,C,y,I)}if(!b)return n;for(let g=0;g<d.stops.length&&g<d.colors.length;g++)b.addColorStop(Math.max(0,Math.min(1,d.stops[g])),Gr(d.colors[g]));return b}applyFillStyle(t){this.ctx.fillStyle=t??this.getEffectiveColor(),this.ctx.globalAlpha=this.alpha*this.mLayerAlpha,this.ctx.globalCompositeOperation=this.blendMode}applyStrokeStyle(t){this.ctx.strokeStyle=t??this.getEffectiveColor(),this.ctx.lineWidth=this.strokeWidth,this.ctx.lineCap=this.lineCap,this.ctx.lineJoin=this.lineJoin,this.ctx.miterLimit=this.miterLimit,this.ctx.globalAlpha=this.alpha*this.mLayerAlpha,this.ctx.globalCompositeOperation=this.blendMode}fillOrStroke(t,i){(this.style===0||this.style===2)&&(this.applyFillStyle(),this.eraseBeneathForSrc(t,"#000"),t()),(this.style===1||this.style===2)&&(this.applyStrokeStyle(),this.eraseBeneathForSrc(i,"#000"),i())}eraseBeneathForSrc(t,i){if(this.blendMode!=="copy")return;let r=this.ctx,n=r.fillStyle,s=r.strokeStyle,a=r.globalAlpha;r.globalCompositeOperation="destination-out",r.fillStyle=i,r.strokeStyle=i,r.globalAlpha=1,t(),r.fillStyle=n,r.strokeStyle=s,r.globalAlpha=a,r.globalCompositeOperation="source-over"}axisName(t){if(t>=Ve.START_ID){let r=this.getText(t);if(r)return r}let i="";for(let r=24;r>=0;r-=8){let n=t>>r&255;if(n<33||n>126)return null;i+=String.fromCharCode(n)}return i}axisValue(t){let i=this.fontAxes.find(r=>r.tag===t);return i?i.value:null}setFont(){let t=this.axisValue("wght"),i=this.axisValue("ital"),r=this.fontItalic||i!==null&&i>=.5,n=t!==null?Math.round(t):this.fontWeight,s=r?"italic ":"",a=n!==400?`${n} `:"";this.ctx.font=`${s}${a}${this.textSize}px ${this.fontFamily}`;let m=this.ctx;if("fontStretch"in m){let u=this.axisValue("wdth");m.fontStretch=u!==null?Ic(u):"normal"}}applyPaint(t){let i=t.getArray(),r=t.getLength(),n=this.getContext(),s=m=>O(m)&&n?n.getFloat(x(m)):ht(m),a=0;for(;a<r;){let m=i[a++],u=m&65535,l=m>>16&65535;switch(u){case ot.TEXT_SIZE:this.textSize=s(i[a++]),this.setFont();break;case ot.COLOR:{let h=i[a++]|0;this.colorArgb=h,this.alpha=(h>>>24&255)/255,this.color=`rgb(${h>>>16&255},${h>>>8&255},${h&255})`;break}case ot.STROKE_WIDTH:this.strokeWidth=s(i[a++]);break;case ot.STROKE_MITER:this.miterLimit=s(i[a++]);break;case ot.STROKE_CAP:this.lineCap=l===0?"butt":l===1?"round":"square";break;case ot.STYLE:this.style=l;break;case ot.SHADER:{let h=i[a++];if(h===0)this.activeShaderData=null,this.gradientStyle=null,this.gradientSpec=null;else{let c=this.getContext()?.getShader(h);this.activeShaderData=c??null}break}case ot.IMAGE_FILTER_QUALITY:break;case ot.GRADIENT:{let c=i[a++]&255,f=[];for(let g=0;g<c;g++)f.push(i[a++]);let d=i[a++],p=[];if(d>0)for(let g=0;g<d;g++)p.push(ht(i[a++]));else for(let g=0;g<c;g++)p.push(c>1?g/(c-1):0);let b=null;if(l===ot.SWEEP_GRADIENT){let g=ht(i[a++]),C=ht(i[a++]);if(this.gradientSpec={kind:"sweep",colors:f,stops:p,cx:g,cy:C,radius:0,x1:0,y1:0,x2:0,y2:0},typeof this.ctx.createConicGradient=="function")b=this.ctx.createConicGradient(0,g,C);else{let y=this.createSweepGradientPattern(g,C,f,p);y&&(this.gradientStyle=y)}}else if(l===ot.RADIAL_GRADIENT){let g=ht(i[a++]),C=ht(i[a++]),y=ht(i[a++]);a++,this.gradientSpec={kind:"radial",colors:f,stops:p,cx:g,cy:C,radius:y,x1:0,y1:0,x2:0,y2:0},b=this.ctx.createRadialGradient(g,C,0,g,C,y)}else{let g=ht(i[a++]),C=ht(i[a++]),y=ht(i[a++]),I=ht(i[a++]);a++,this.gradientSpec={kind:"linear",colors:f,stops:p,cx:0,cy:0,radius:0,x1:g,y1:C,x2:y,y2:I},b=this.ctx.createLinearGradient(g,C,y,I)}if(b){for(let g=0;g<p.length&&g<f.length;g++)b.addColorStop(Math.max(0,Math.min(1,p[g])),Gr(f[g]));this.gradientStyle=b}break}case ot.ALPHA:this.alpha=s(i[a++]);break;case ot.COLOR_FILTER:{let h=i[a++];this.colorFilterArgb=h,this.colorFilterColor=Gr(h),this.colorFilterMode=l;break}case ot.ANTI_ALIAS:this.antiAlias=l!==0;break;case ot.STROKE_JOIN:this.lineJoin=l===0?"miter":l===1?"round":"bevel";break;case ot.TYPEFACE:{let h=l&1023,c=(l&2048)!==0;this.fontWeight=h>0?h:400,this.fontItalic=c;let f=i[a++];this.fontFamily=this.fontStackForTypeface(f),this.setFont();break}case ot.FILTER_BITMAP:this.filterBitmap=l!==0,this.ctx.imageSmoothingEnabled=this.filterBitmap;break;case ot.BLEND_MODE:this.blendMode=this.mapBlendMode(l);break;case ot.COLOR_ID:{let h=i[a++]|0;this.colorArgb=h,this.alpha=(h>>>24&255)/255,this.color=`rgb(${h>>>16&255},${h>>>8&255},${h&255})`;break}case ot.COLOR_FILTER_ID:{let h=i[a++];this.colorFilterColor=Gr(h),this.colorFilterArgb=h;break}case ot.CLEAR_COLOR_FILTER:this.colorFilterColor=null;break;case ot.SHADER_MATRIX:a++;break;case ot.FONT_AXIS:{let h=l,c=[];for(let f=0;f<h;f++){let d=i[a++],p=ht(i[a++]),b=this.axisName(d);b&&c.push({tag:b,value:p})}this.fontAxes=c,this.googleFamily&&c.length>0&&xo(this.googleFamily,this.fontWeight,this.fontItalic,this.onFontLoaded??void 0,c),this.setFont();break}case ot.TEXTURE:{let h=i[a++],c=i[a++];a++;let f=c&15,d=c>>16&15,p=this.bitmapCache.get(h);if(p){let b=f===1||f===2,g=d===1||d===2,C;b&&g?C="repeat":b?C="repeat-x":g?C="repeat-y":C="no-repeat";let y=this.ctx.createPattern(p,C);y&&(this.gradientStyle=y)}break}case ot.PATH_EFFECT:{let h=l;if(h===0)this.ctx.setLineDash([]),this.ctx.lineDashOffset=0;else if(h>=3){let c=i[a],f=s(i[a+1]),d=i[a+2];a+=3;let p=[];for(let b=0;b<d&&b<h-3;b++)p.push(s(i[a++]));for(let b=3+d;b<h;b++)a++;c===1&&p.length>=2&&p.length%2===0?(this.ctx.setLineDash(p),this.ctx.lineDashOffset=f):(this.ctx.setLineDash([]),this.ctx.lineDashOffset=0)}else a+=h;break}case ot.FALLBACK_TYPEFACE:a++;break;default:if(u===0)break;console.warn(`PaintBundle: unknown tag ${u} at index ${a-1}`);return}}}replacePaint(t){this.resetPaintState(),this.applyPaint(t)}resetPaintState(){this.color="rgba(0,0,0,1)",this.style=0,this.strokeWidth=1,this.textSize=14,this.alpha=1,this.lineCap="butt",this.lineJoin="miter",this.miterLimit=10,this.blendMode="source-over",this.antiAlias=!0,this.filterBitmap=!0,this.letterSpacing=0,this.gradientStyle=null,this.fontFamily=xi(0),this.fontWeight=400,this.fontItalic=!1,this.fontAxes=[],this.googleFamily=null,this.colorFilterColor=null,this.colorFilterArgb=0,this.colorFilterMode=3,this.activeShaderData=null,this.ctx.setLineDash([]),this.ctx.lineDashOffset=0,this.setFont()}mapBlendMode(t){switch(t){case 0:return"clear";case 1:return"copy";case 2:return"destination";case 3:return"source-over";case 4:return"destination-over";case 5:return"source-in";case 6:return"destination-in";case 7:return"source-out";case 8:return"destination-out";case 9:return"source-atop";case 10:return"destination-atop";case 11:return"xor";case 12:return"lighter";case 13:return"multiply";case 14:return"screen";case 15:return"overlay";case 16:return"darken";case 17:return"lighten";case 18:return"color-dodge";case 19:return"color-burn";case 20:return"hard-light";case 21:return"soft-light";case 22:return"difference";case 23:return"exclusion";case 24:return"multiply";case 25:return"hue";case 26:return"saturation";case 27:return"color";case 28:return"luminosity";case 30:return"lighter";default:return"source-over"}}savePaint(){this.paintStack.push({color:this.color,style:this.style,strokeWidth:this.strokeWidth,textSize:this.textSize,alpha:this.alpha,lineCap:this.lineCap,lineJoin:this.lineJoin,miterLimit:this.miterLimit,blendMode:this.blendMode,antiAlias:this.antiAlias,letterSpacing:this.letterSpacing,gradientStyle:this.gradientStyle,gradientSpec:this.gradientSpec,activeShaderData:this.activeShaderData,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontItalic:this.fontItalic,fontAxes:this.fontAxes,googleFamily:this.googleFamily,filterBitmap:this.filterBitmap,colorFilterColor:this.colorFilterColor,colorFilterArgb:this.colorFilterArgb,colorFilterMode:this.colorFilterMode})}restorePaint(){let t=this.paintStack.pop();t&&(Object.assign(this,t),this.setFont(),this.ctx.globalAlpha=this.alpha*this.mLayerAlpha)}tryRenderShader(t,i,r,n){let s=this.getContext();if(!this.activeShaderData||!s)return!1;let a=this.activeShaderData,m=a.getShaderTextId(),u=this.textCache.get(m);if(!u)return!1;let l=String(m),h=this.glslCache.get(m);if(!h)try{h=qm(u).glsl,this.glslCache.set(m,h)}catch(E){return console.error(`[shader] transpile failed (textId=${m}):`,E,`
|
|
55
|
+
AGSL:`,u),!1}if(!this.shaderRenderer&&(this.shaderRenderer=new Io,!this.shaderRenderer.isAvailable()))return this.shaderRenderer=null,!1;let c=Math.round(r-t),f=Math.round(i>n?i-n:n-i);if(c<=0||f<=0)return!1;let d=this.ctx.canvas.width||4096,p=this.ctx.canvas.height||4096;c>d&&(c=d),f>p&&(f=p),a.updateVariables(s);let b=new Map;for(let E of a.getUniformFloatNames()){let L=a.getUniformFloats(E);b.set(E,L)}let g=new Map;for(let E of a.getUniformIntegerNames())g.set(E,a.getUniformInts(E));let C,y=a.getUniformBitmapNames();if(y.length>0){C=new Map;for(let E of y){let L=a.getUniformBitmapId(E);if(L<0)continue;let V=this.bitmapCanvasCache.get(L);if(V)C.set(E,V.canvas);else{let B=this.bitmapCache.get(L);B&&C.set(E,B)}}}let I=Math.round(r-t),T=Math.round(Math.abs(n-i));if(!this.shaderRenderer.render(h,c,f,b,g,C,l,I,T))return console.error(`[shader] WebGL render FAILED textId=${m}`),!1;this.ctx.globalAlpha=this.alpha*this.mLayerAlpha,this.ctx.globalCompositeOperation=this.blendMode;let _=r-t,P=Math.abs(n-i);return this.ctx.drawImage(this.shaderRenderer.getCanvas(),t,Math.min(i,n),_,P),!0}drawRect(t,i,r,n){this.activeShaderData&&this.tryRenderShader(t,i,r,n)||this.fillOrStroke(()=>{this.ctx.fillRect(t,i,r-t,n-i)},()=>{this.ctx.strokeRect(t,i,r-t,n-i)})}drawCircle(t,i,r){r<=0||(this.ctx.beginPath(),this.ctx.arc(t,i,r,0,Math.PI*2),this.fillOrStroke(()=>{this.ctx.fill()},()=>{this.ctx.stroke()}))}drawLine(t,i,r,n){this.applyStrokeStyle(),this.ctx.beginPath(),this.ctx.moveTo(t,i),this.ctx.lineTo(r,n),this.ctx.stroke()}drawOval(t,i,r,n){let s=(t+r)/2,a=(i+n)/2,m=Math.abs(r-t)/2,u=Math.abs(n-i)/2;this.ctx.beginPath(),this.ctx.ellipse(s,a,m,u,0,0,Math.PI*2),this.fillOrStroke(()=>{this.ctx.fill()},()=>{this.ctx.stroke()})}drawRoundRect(t,i,r,n,s,a){let m=r-t,u=n-i;this.ctx.beginPath(),this.ctx.roundRect(t,i,m,u,[Math.max(0,Math.min(s,a))]),this.fillOrStroke(()=>{this.ctx.fill()},()=>{this.ctx.stroke()})}drawArc(t,i,r,n,s,a){let m=(t+r)/2,u=(i+n)/2,l=Math.abs(r-t)/2,h=Math.abs(n-i)/2,c=s*Math.PI/180,f=(s+a)*Math.PI/180;this.ctx.beginPath(),this.ctx.ellipse(m,u,l,h,0,c,f,a<0),this.fillOrStroke(()=>{this.ctx.fill()},()=>{this.ctx.stroke()})}drawSector(t,i,r,n,s,a){let m=(t+r)/2,u=(i+n)/2,l=Math.abs(r-t)/2,h=Math.abs(n-i)/2,c=s*Math.PI/180,f=(s+a)*Math.PI/180;this.ctx.beginPath(),this.ctx.moveTo(m,u),this.ctx.ellipse(m,u,l,h,0,c,f,a<0),this.ctx.closePath(),this.fillOrStroke(()=>{this.ctx.fill()},()=>{this.ctx.stroke()})}setMesh(t,i,r,n,s,a,m,u){this.meshCache.set(t,{layout:i,uCount:r,vCount:n,verts:s,uv:a,colors:m,indices:u})}drawMesh(t,i,r){let n=this.meshCache.get(t);if(!n)return;let s=n.verts.length/2;if(s<3||n.indices.length<3)return;let a;i===1&&r!==0&&n.uv.length===n.verts.length&&(a=this.bitmapCache.get(r)),this.ctx.save();let m=a?a.width:0,u=a?a.height:0;if(!a&&n.colors.length!==s){let l=new Path2D;for(let h=0;h+2<n.indices.length;h+=3){let c=n.indices[h],f=n.indices[h+1],d=n.indices[h+2];c<0||f<0||d<0||c>=s||f>=s||d>=s||(l.moveTo(n.verts[c*2],n.verts[c*2+1]),l.lineTo(n.verts[f*2],n.verts[f*2+1]),l.lineTo(n.verts[d*2],n.verts[d*2+1]),l.closePath())}this.applyFillStyle(),this.ctx.fill(l),this.ctx.restore();return}for(let l=0;l+2<n.indices.length;l+=3){let h=n.indices[l],c=n.indices[l+1],f=n.indices[l+2];if(h<0||c<0||f<0||h>=s||c>=s||f>=s)continue;let d=n.verts[h*2],p=n.verts[h*2+1],b=n.verts[c*2],g=n.verts[c*2+1],C=n.verts[f*2],y=n.verts[f*2+1],I=new Path2D;if(I.moveTo(d,p),I.lineTo(b,g),I.lineTo(C,y),I.closePath(),a){let T=n.uv[h*2]*m,v=n.uv[h*2+1]*u,_=n.uv[c*2]*m,P=n.uv[c*2+1]*u,E=n.uv[f*2]*m,L=n.uv[f*2+1]*u,V=(_-T)*(L-v)-(E-T)*(P-v);if(Math.abs(V)<1e-9)continue;let B=((b-d)*(L-v)-(C-d)*(P-v))/V,U=((g-p)*(L-v)-(y-p)*(P-v))/V,H=((C-d)*(_-T)-(b-d)*(E-T))/V,N=((y-p)*(_-T)-(g-p)*(E-T))/V,k=d-B*T-H*v,Y=p-U*T-N*v;this.ctx.save(),this.ctx.clip(I),this.ctx.transform(B,U,H,N,k,Y),this.ctx.drawImage(a,0,0),this.ctx.restore();continue}if(n.colors.length===s){let T=n.colors[h],v=n.colors[c],_=n.colors[f],P=L=>Math.round(((T>>>L&255)+(v>>>L&255)+(_>>>L&255))/3),E=P(24)/255;this.ctx.fillStyle="rgba("+P(16)+","+P(8)+","+P(0)+","+E+")",this.ctx.fill(I)}else this.applyFillStyle(),this.ctx.fill(I)}this.ctx.restore()}matrixFromMesh(t,i,r,n){let s=this.meshCache.get(t);if(!s)return;let a=new Float32Array(6);if(!gu(s.layout,s.uCount,s.vCount,s.verts,i,r,a))return;let m=new Float32Array(6);bu(a,n,m),this.ctx.transform(m[0],m[1],m[2],m[3],m[4],m[5])}drawPath(t,i,r){let n=this.pathDataCache.get(t);if(!n)return;let s=this.buildPath2D(n,i,r);this.fillOrStroke(()=>{this.ctx.fill(s)},()=>{this.ctx.stroke(s)})}drawTextRun(t,i,r,n,s,a,m,u){let l=this.textCache.get(t);if(!l)return;let h=i>=0?i:0,c=r>=0?Math.min(r,l.length):l.length,f=l.substring(h,c);this.setFont(),this.fillOrStroke(()=>{this.applyFillStyle(),this.ctx.fillText(f,a,m)},()=>{this.applyStrokeStyle(),this.ctx.strokeText(f,a,m)})}drawTextOnPath(t,i,r,n){let s=this.textCache.get(t);if(!s)return;let a=this.pathDataCache.get(i);if(!a)return;let{segments:m,totalLen:u}=this.collectPathSegments(a);if(u===0||m.length===0)return;this.setFont(),this.ctx.textBaseline="alphabetic";let l=r;for(let h=0;h<s.length;h++){let c=s[h],f=this.ctx.measureText(c).width,d=l+f/2;if(d>=0&&d<=u){this.ctx.save();let p=this.positionOnPath(m,d,n),b=p?this.fillStyleUnderGlyph(p.x,p.y,p.angle):null;if(this.fillOrStroke(()=>{this.applyFillStyle(b),this.ctx.fillText(c,-f/2,0)},()=>{this.applyStrokeStyle(b),this.ctx.strokeText(c,-f/2,0)}),this.ctx.restore(),b&&b===this.gradientStyle&&typeof b.setTransform=="function"){let g=this.ctx.getTransform();g.a=1,g.b=0,g.c=0,g.d=1,g.e=0,g.f=0,b.setTransform(g)}}l+=f}}measureTextCached(t){let i=`${this.ctx.font}:::${t}`,r=this.mTextMeasureCache.get(i);return r||(r=this.ctx.measureText(t),this.mTextMeasureCache.set(i,r),this.mTextMeasureCache.size>2e3&&(this.mTextMeasureCache.clear(),this.mTextMeasureCache.set(i,r))),r}static{this.mockTextMetrics=!!globalThis.process?.env?.RC_MOCK_TEXT}getTextBounds(t,i,r,n,s){if(o.mockTextMetrics){s[0]=0,s[1]=0,s[2]=100,s[3]=10;return}let a=this.textCache.get(t);if(!a){s.fill(0);return}let m=i>=0?i:0,u=r>=0?Math.min(r,a.length):a.length,l=a.substring(m,u);this.setFont();let h=this.measureTextCached(l),c=this.textSize>0?this.textSize:Tu,f=(n&2)!==0,d=(...v)=>{for(let _ of v)if(typeof _=="number"&&isFinite(_)&&_>0)return _;return 0},p=f?d(h.fontBoundingBoxAscent):d(h.actualBoundingBoxAscent,h.fontBoundingBoxAscent),b=f?d(h.fontBoundingBoxDescent):d(h.actualBoundingBoxDescent,h.fontBoundingBoxDescent);p<=0&&b<=0&&(p=Ac*c,b=Ec*c);let g=d(h.width,l.length*Mc*c),C=h.actualBoundingBoxLeft,y=h.actualBoundingBoxRight,I=typeof C=="number"&&isFinite(C)?-C:0,T=typeof y=="number"&&isFinite(y)?y:g;(n&4)!==0?(I=0,T=g):(n&1)!==0&&(T=g-I),s[0]=I,s[1]=-p,s[2]=T,s[3]=b}layoutComplexText(t,i,r,n,s,a,m,u,l,h,c,f,d,p,b,g,C){let y=this.textCache.get(t);if(!y)return null;if(o.mockTextMetrics)return{lines:[y],alignment:n,lineHeight:40,width:y.length*30,height:40,maxWidth:m,maxHeight:u,visibleLines:1};let I=i>=0?i:0,T=r===-1||r>y.length?y.length:r,v=y.substring(I,T);this.setFont();let P=(this.textSize>0?this.textSize:Tu)*(c||1.2);if(a===1&&(s===1||s===2)){let X=v.split(`
|
|
56
|
+
`,1)[0];return{lines:[X],alignment:n,lineHeight:P,width:Math.min(this.ctx.measureText(X).width,m),height:Math.min(P,u),naturalHeight:P,visibleLines:1}}let E=[],L=v.split(`
|
|
57
|
+
`);for(let X=0;X<L.length;X++){let z=L[X],j=z.split(/(\s+)/),rt="";for(let nt of j){let ut=rt+nt;this.measureTextCached(ut).width>m&&rt.length>0?(E.push(rt),rt=nt.trimStart()):rt=ut}rt.length>0?E.push(rt):z.length===0&&E.push("")}let V=X=>{let z=Intl.Segmenter;return z?Array.from(new z(void 0,{granularity:"grapheme"}).segment(X),j=>j.segment):Array.from(X)},B=X=>{let z=V(X);for(;this.ctx.measureText(z.join("")+"\u2026").width>m&&z.length>0;)z.pop();return z.join("")+"\u2026"},U=X=>{let z=V(X);for(;this.ctx.measureText("\u2026"+z.join("")).width>m&&z.length>0;)z.shift();return"\u2026"+z.join("")},H=X=>{let z=V(X),j=Math.ceil(z.length/2),rt=j;for(;this.ctx.measureText(z.slice(0,j).join("")+"\u2026"+z.slice(rt).join("")).width>m&&(j>0||rt<z.length);)z.length-rt<j?j--:rt++;return z.slice(0,j).join("")+"\u2026"+z.slice(rt).join("")},N=a>0?E[Math.min(E.length,a)-1]:void 0,k=N!==void 0&&this.ctx.measureText(N).width>m;if(s>=3&&s<=5&&a>0&&(E.length>a||k)){let X=Math.min(a,E.length)-1,z=E[X]||"";E[X]=s===4?U(z):s===5?H(z):B(z),E.length>a&&(E.length=a)}let Y=0;for(let X of E){let z=this.measureTextCached(X).width;z>Y&&(Y=z)}let $=E.length*P,w=E.length;if($>u&&o.isEllipsis(s)&&E.length>=a){w=0;for(let X=0;X<E.length&&(X+1)*P<u;X++)w++}return{lines:E,alignment:n,lineHeight:P,width:Math.min(Y,m),height:Math.min($,u),naturalHeight:$,visibleLines:w,maxWidth:m,maxHeight:u}}static isEllipsis(t){return t===3||t===4||t===5}drawComplexText(t,i){if(!t)return;let{lines:r,alignment:n,lineHeight:s,width:a}=t,m=typeof i=="number"&&i>0?i:a;this.setFont(),this.ctx.textBaseline="top";let u=typeof n=="number"?n&65535:1;for(let l=0;l<r.length;l++){let h=0,c=this.measureTextCached(r[l]).width;u===2||u===6?h=m-c:u===3&&(h=(m-c)/2),this.fillOrStroke(()=>{this.applyFillStyle(),this.ctx.fillText(r[l],h,l*s)},()=>{this.applyStrokeStyle(),this.ctx.strokeText(r[l],h,l*s)})}}drawBitmap(t,i,r,n,s,a,m,u,l,h){let c=this.bitmapToDraw(t);if(!c)return;this.ctx.globalAlpha=this.alpha*this.mLayerAlpha,this.ctx.globalCompositeOperation=this.blendMode,this.ctx.imageSmoothingEnabled=this.filterBitmap;let f=n-i,d=s-r,p=u-a,b=l-m;f>0&&d>0?this.ctx.drawImage(c,i,r,f,d,a,m,p,b):this.ctx.drawImage(c,a,m,p,b)}drawBitmapSimple(t,i,r,n,s){let a=this.bitmapToDraw(t);a&&(this.ctx.globalAlpha=this.alpha*this.mLayerAlpha,this.ctx.globalCompositeOperation=this.blendMode,this.ctx.imageSmoothingEnabled=this.filterBitmap,this.ctx.drawImage(a,i,r,n-i,s-r))}drawTweenPath(t,i,r,n,s){let a=this.pathDataCache.get(t),m=this.pathDataCache.get(i);if(!a||!m){a&&this.drawPath(t,n,s);return}let u=Math.min(a.length,m.length),l=new Int32Array(u);for(let c=0;c<u;c++){let f=a[c];if(O(f))l[c]=f;else{let d=ht(f),p=ht(m[c]);l[c]=et(d+(p-d)*r)}}let h=this.buildPath2D(l,n,s);this.fillOrStroke(()=>{this.ctx.fill(h)},()=>{this.ctx.stroke(h)})}tweenPath(t,i,r,n){if(n===0){let l=this.pathDataCache.get(i);l&&this.pathDataCache.set(t,Int32Array.from(l));return}if(n===1){let l=this.pathDataCache.get(r);l&&this.pathDataCache.set(t,Int32Array.from(l));return}let s=this.pathDataCache.get(i),a=this.pathDataCache.get(r);if(!s||!a)return;let m=Math.min(s.length,a.length),u=new Int32Array(m);for(let l=0;l<m;l++)if(O(s[l])||O(a[l]))u[l]=s[l];else{let h=ht(s[l]),c=ht(a[l]);u[l]=et((c-h)*n+h)}this.pathDataCache.set(t,u)}combinePath(t,i,r,n){}scale(t,i){t===0&&(t=1e-10),i===0&&(i=1e-10),this.ctx.scale(t,i)}translate(t,i){this.ctx.translate(t,i)}matrixSave(){this.inputClipStack.push(this.inputClip),this.mLayerAlphaStack.push(this.mLayerAlpha),this.ctx.save()}matrixRestore(){let t=this.inputClipStack.pop();t&&(this.inputClip=t),this.mLayerAlphaStack.length&&(this.mLayerAlpha=this.mLayerAlphaStack.pop()),this.ctx.restore()}saveLayer(t,i,r,n){this.matrixSave(),this.clipRect(t,i,t+r,i+n),this.alpha<1&&(this.mLayerAlpha*=this.alpha,this.ctx.globalAlpha=this.mLayerAlpha)}matrixTranslate(t,i){this.ctx.translate(t,i)}matrixScale(t,i,r,n){t===0&&(t=1e-10),i===0&&(i=1e-10),this.ctx.translate(r,n),this.ctx.scale(t,i),this.ctx.translate(-r,-n)}matrixRotate(t,i,r){this.ctx.translate(i,r),this.ctx.rotate(t*Math.PI/180),this.ctx.translate(-i,-r)}matrixSkew(t,i){this.ctx.transform(1,i,t,1,0,0)}matrixFromPath(t,i,r,n){let s=this.pathDataCache.get(t);if(!s)return;let{segments:a,totalLen:m}=this.collectPathSegments(s);if(m===0)return;let u=m*i%m;u<0&&(u+=m),this.positionOnPath(a,u,r)}collectPathSegments(t){let i=[],r=0,n=0,s=0,a=0,m=0,u=(h,c,f,d)=>{let p=f-h,b=d-c,g=Math.sqrt(p*p+b*b);g>0&&i.push({x1:h,y1:c,x2:f,y2:d,len:g})};for(;m<t.length;){let h=t[m],c=O(h)?x(h):ht(h);switch(c>=o.NANMAP_PATH_BASE&&c<=o.NANMAP_PATH_BASE+6&&(c=o.PATH_MOVE+(c-o.NANMAP_PATH_BASE)),c){case o.PATH_MOVE:m++,r=s=ht(t[m]),n=a=ht(t[m+1]),m+=2;break;case o.PATH_LINE:{m+=3;let f=ht(t[m]),d=ht(t[m+1]);m+=2,u(r,n,f,d),r=f,n=d;break}case o.PATH_QUADRATIC:{m+=3;let f=ht(t[m]),d=ht(t[m+1]),p=ht(t[m+2]),b=ht(t[m+3]);m+=4,this.flattenQuadratic(r,n,f,d,p,b,u),r=p,n=b;break}case o.PATH_CONIC:{m+=3;let f=ht(t[m]),d=ht(t[m+1]),p=ht(t[m+2]),b=ht(t[m+3]);m+=5,this.flattenQuadratic(r,n,f,d,p,b,u),r=p,n=b;break}case o.PATH_CUBIC:{m+=3;let f=ht(t[m]),d=ht(t[m+1]),p=ht(t[m+2]),b=ht(t[m+3]),g=ht(t[m+4]),C=ht(t[m+5]);m+=6,this.flattenCubic(r,n,f,d,p,b,g,C,u),r=g,n=C;break}case o.PATH_CLOSE:{m++,u(r,n,s,a),r=s,n=a;break}case o.PATH_DONE:m=t.length;break;default:m++;break}}let l=0;for(let h of i)l+=h.len;return{segments:i,totalLen:l}}flattenQuadratic(t,i,r,n,s,a,m){let l=t,h=i;for(let c=1;c<=16;c++){let f=c/16,d=1-f,p=d*d*t+2*d*f*r+f*f*s,b=d*d*i+2*d*f*n+f*f*a;m(l,h,p,b),l=p,h=b}}flattenCubic(t,i,r,n,s,a,m,u,l){let c=t,f=i;for(let d=1;d<=16;d++){let p=d/16,b=1-p,g=b*b*b*t+3*b*b*p*r+3*b*p*p*s+p*p*p*m,C=b*b*b*i+3*b*b*p*n+3*b*p*p*a+p*p*p*u;l(c,f,g,C),c=g,f=C}}positionOnPath(t,i,r){let n=0;for(let s of t){if(n+s.len>=i||s===t[t.length-1]){let a=s.len>0?(i-n)/s.len:0,m=s.x1+(s.x2-s.x1)*a,u=s.y1+(s.y2-s.y1)*a,l=Math.atan2(s.y2-s.y1,s.x2-s.x1),h=-Math.sin(l)*r,c=Math.cos(l)*r;return this.ctx.translate(m+h,u+c),this.ctx.rotate(l),{x:m+h,y:u+c,angle:l}}n+=s.len}return null}clipRect(t,i,r,n){this.recordInputRect(t,i,r,n),this.ctx.beginPath(),this.ctx.rect(t,i,r-t,n-i),this.ctx.clip()}clipPath(t,i){let r=this.pathDataCache.get(t);if(!r)return;let n=this.buildPath2D(r);this.inputClip={...this.inputClip,unsupported:!0},this.ctx.clip(n)}roundedClipRect(t,i,r,n,s,a){let m=u=>Number.isFinite(u)&&u>0?u:0;if(this.ctx.beginPath(),this.ctx.roundRect(0,0,t,i,[m(r),m(n),m(a),m(s)]),this.ctx.clip(),this.recordInputRect(0,0,t,i),[r,n,a,s].some(u=>m(u)>0))if(typeof Path2D<"u"){let u=new Path2D;u.roundRect(0,0,t,i,[m(r),m(n),m(a),m(s)]);let l=new Path2D;l.addPath(u,this.ctx.getTransform()),this.inputClip={...this.inputClip,rounded:[...this.inputClip.rounded,l]}}else this.inputClip={...this.inputClip,unsupported:!0}}static{this.GL_SCALE_X=0}static{this.GL_SCALE_Y=1}static{this.GL_ROTATION_Z=4}static{this.GL_TRANSFORM_ORIGIN_X=5}static{this.GL_TRANSFORM_ORIGIN_Y=6}static{this.GL_TRANSLATION_X=7}static{this.GL_TRANSLATION_Y=8}static{this.GL_ALPHA=11}static{this.GL_SHAPE=20}static{this.GL_SHAPE_RADIUS=21}startGraphicsLayer(t,i){this.matrixSave();try{let r=this.createLayerCanvas(t,i);this.layerStack.push({previousCtx:this.ctx,offscreenCanvas:r.canvas,width:t,height:i,attributes:new Map}),this.ctx=r}catch{}}setGraphicsLayer(t){let i=this.layerStack[this.layerStack.length-1];i&&(i.attributes=t)}endGraphicsLayer(){let t=this.layerStack.pop();if(!t){this.matrixRestore();return}let i=t.offscreenCanvas;this.ctx=t.previousCtx;let r=t.attributes,n=r.get(o.GL_SCALE_X)??1,s=r.get(o.GL_SCALE_Y)??1,a=r.get(o.GL_ROTATION_Z)??0,m=r.get(o.GL_TRANSLATION_X)??0,u=r.get(o.GL_TRANSLATION_Y)??0,l=r.get(o.GL_TRANSFORM_ORIGIN_X)??.5,h=r.get(o.GL_TRANSFORM_ORIGIN_Y)??.5,c=r.get(o.GL_ALPHA)??1,f=r.get(o.GL_SHAPE),d=r.get(o.GL_SHAPE_RADIUS)??0,p=l*t.width,b=h*t.height;if((n!==1||s!==1||a!==0||m!==0||u!==0)&&(this.ctx.translate(p+m,b+u),a!==0&&this.ctx.rotate(a*Math.PI/180),(n!==1||s!==1)&&this.ctx.scale(n,s),this.ctx.translate(-p,-b)),f!==void 0){if(this.ctx.beginPath(),f===2){let C=Math.min(t.width,t.height)/2;this.ctx.arc(t.width/2,t.height/2,C,0,Math.PI*2)}else f===1&&d>0?this.ctx.roundRect(0,0,t.width,t.height,[Math.max(0,d)]):this.ctx.rect(0,0,t.width,t.height);this.ctx.clip()}c!==1&&(this.ctx.globalAlpha=c),this.ctx.drawImage(i,0,0),this.matrixRestore()}drawToBitmap(t,i,r){if(this.mainCanvas===null&&(this.mainCanvas=this.ctx),t===0){this.ctx=this.mainCanvas,this.mainInputClip&&(this.inputClip=this.mainInputClip);return}this.ctx===this.mainCanvas&&(this.mainInputClip=this.inputClip);let n=this.bitmapCanvasCache.get(t);if(!n){let s=this.emptyBitmapSizes.get(t),a=this.bitmapCache.get(t),m=s?.width||(a?a.width:0)||256,u=s?.height||(a?a.height:0)||256;n=this.createLayerCanvas(m,u),this.bitmapCanvasCache.set(t,n)}if((i&1)===0){let s=n.canvas;n.clearRect(0,0,s.width,s.height),r!==0&&(n.fillStyle=Gr(r),n.fillRect(0,0,s.width,s.height))}this.ctx=n}reset(){this.inputClip={rectangles:[],rounded:[],unsupported:!1},this.inputClipStack=[],this.resetPaintState(),this.clearNeedsRepaint()}static{this.supersample3D=1}superFactor(){let t=this.supersample3D;return t==="auto"?this.ctx.canvas.width*this.ctx.canvas.height<=105e4?2:1:Math.max(1,Math.trunc(Number(t))||1)}ensure3D(){let t=this.superFactor(),i=this.ctx.canvas.width*t,r=this.ctx.canvas.height*t;return this.d3===null&&(this.d3=new co),this.d3.setSupersample(t),this.d3Super=t,this.d3.setSize(i,r),(this.d3Blit===null||this.d3Blit.canvas.width!==i||this.d3Blit.canvas.height!==r)&&(this.d3Blit=this.createLayerCanvas(i,r)),this.d3}defineMesh3D(t,i,r,n,s=null){this.ensure3D().defineMesh3D(t,i,r,n,s)}setCamera3D(t,i,r){this.ensure3D().setCamera3D(t,i,r)}matrix3Op(t,i){this.ensure3D().matrix3Op(t,i)}clearDepth3D(){this.ensure3D().clearDepth3D()}setLights3D(t,i,r){this.ensure3D().setLights3D(t,i,r)}setTexture3D(t){let i=this.ensure3D();if(t===0){i.setTextureData(null,0,0);return}let r=this.bitmapCache.get(t);if(!r){i.setTextureData(null,0,0);return}let n=this.texturePixels.get(t);if(n){i.setTextureData(n.argb,n.width,n.height);return}let s=r.naturalWidth||r.width,a=r.naturalHeight||r.height;if(!s||!a){i.setTextureData(null,0,0);return}let m=document.createElement("canvas");m.width=s,m.height=a;let u=m.getContext("2d",{willReadFrequently:!0});if(!u){i.setTextureData(null,0,0);return}u.drawImage(r,0,0);let l=u.getImageData(0,0,s,a).data,h=new Int32Array(s*a);for(let c=0;c<s*a;c++)h[c]=l[c*4+3]<<24|l[c*4]<<16|l[c*4+1]<<8|l[c*4+2]|0;this.texturePixels.set(t,{argb:h,width:s,height:a}),i.setTextureData(h,s,a)}setMaterial3D(t,i){this.ensure3D().setMaterial3D(t,i)}setDepthBias3D(t,i){this.ensure3D().setDepthBias3D(t,i)}drawMesh3D(t,i){let r=this.ensure3D();r.setBaseColorArgb(this.colorArgb);let n=i>>1;!((i&256)!==0)&&(n===1||n===5)&&this.drawMesh3DGl(r,t,(i&1)!==0,n===5)||(r.drawMesh3D(t,i),this.blit3D())}drawMesh3DGl(t,i,r,n){this.d3gl===null&&(this.d3gl=new po);let s=this.d3gl;if(!s.isAvailable())return!1;if(t.buildCanvasVertices(i,this.d3glMesh,r)<3)return!0;let m=this.d3Super,u=t.getWidth()/m,l=t.getHeight()/m;s.beginFrame(u,l);let h=t.getTextureData();return s.setTexture(h.pixels,h.width,h.height),s.draw(this.d3glMesh,n),this.ctx.drawImage(s.getCanvas(),0,0,u,l),this.d3glDirty=!0,globalThis.__rcGl3dDraws=s.drawCount,!0}blit3D(){let t=this.d3,i=this.d3Blit;if(t===null||i===null)return;let r=t.getColorBuffer();if(r===null)return;let n=t.getWidth(),s=t.getHeight(),a=i.createImageData(n,s),m=a.data;for(let l=0;l<n*s;l++){let h=r[l];m[l*4]=h>>>16&255,m[l*4+1]=h>>>8&255,m[l*4+2]=h&255,m[l*4+3]=h>>>24&255}i.putImageData(a,0,0);let u=this.d3Super;if(u===1)this.ctx.drawImage(i.canvas,0,0);else{let l=this.ctx.imageSmoothingEnabled,h=this.ctx.imageSmoothingQuality;this.ctx.imageSmoothingEnabled=!0,this.ctx.imageSmoothingQuality="high",this.ctx.drawImage(i.canvas,0,0,n/u,s/u),this.ctx.imageSmoothingEnabled=l,this.ctx.imageSmoothingQuality=h}}};var G=Object.freeze({TEXT:"rc:input/text:v1",CHOICE:"rc:input/choice:v1",TOGGLE:"rc:input/toggle:v1",NUMBER:"rc:input/number:v1",RANGE:"rc:input/range:v1",VALUE:1,VALUE_RETURN:2,KEY:3,LABEL:4,MULTILINE:5,OPTIONS:6,SUBMIT:7,MIN:8,MAX:9,STEP:10,ENABLED:11,SUBMIT_LABEL:12,CHROME:13}),Bo=Object.freeze({DEFAULT:0,NONE:1}),Ou=[G.TEXT,G.CHOICE,G.TOGGLE,G.NUMBER,G.RANGE];function dr(o,e,t=[],i,r,n){if(o===G.TEXT)return!0;if(o===G.CHOICE)return t.length>0&&t.every(m=>!!m&&!m.includes(`
|
|
58
|
+
`))&&new Set(t).size===t.length&&t.includes(e);if(o===G.TOGGLE)return e==="true"||e==="false";if(o!==G.NUMBER&&o!==G.RANGE||[i,r,n].some(m=>m!==void 0&&!Number.isFinite(m))||i!==void 0&&r!==void 0&&i>r||n!==void 0&&n<=0||o===G.RANGE&&(i===void 0||r===void 0||n===void 0||i>=r||(r-i)/n>1e4))return!1;if(o===G.RANGE){let m=(r-i)/n;if(Math.abs(m-Math.round(m))>1e-7*Math.max(1,Math.abs(m)))return!1}if(e.trim()!==e||!/^-?(0|[1-9][0-9]*)(\.[0-9]+)?([eE][+-]?[0-9]+)?$/.test(e))return!1;let s=Number(e);if(!Number.isFinite(s)||i!==void 0&&s<i||r!==void 0&&s>r)return!1;let a=(s-(i??0))/(n??1);return n===void 0||Number.isFinite(a)&&Math.abs(a-Math.round(a))<=1e-7*Math.max(1,Math.abs(a))}var pr=class{constructor(e,t){this.canvas=e;this.options=t;this.entries=new Map;this.seen=new Set;this.scopes=[];this.defaults=new Map;this.fields=new Map;this.hitContext=null;this.canvasExport=!1;this.drafts=t.drafts??new Map}withCanvasExport(e){this.canvasExport=!0;try{return e()}finally{this.canvasExport=!1}}beginFrame(){this.seen.clear(),this.defaults.clear(),this.fields.clear(),this.scopes=[]}withDocument(e,t){this.scopes.push(e);try{return t()}finally{this.scopes.pop()}}storeKey(e,t){return e?`@${e}:${t}`:t}values(e){return Object.fromEntries(Array.from(this.defaults.get(e)??[]).filter(([t])=>this.fields.get(this.storeKey(e,t))?.component.integer(G.ENABLED,1)===1).map(([t,i])=>[t,this.drafts.get(this.storeKey(e,t))??i]))}valid(e,t,i){if(!e)return!1;let r=[G.MIN,G.MAX,G.STEP].map(n=>e.text(n));return r.some(n=>n&&!Number.isFinite(Number(n)))?!1:dr(i,t,e.text(G.OPTIONS).split(`
|
|
59
|
+
`),...r.map(n=>n?Number(n):void 0))}paintControl(e,t,i,r,n,s,a){if(e.save(),e.beginPath(),e.rect(0,0,s,a),e.clip(),t.integer(G.CHROME)===Bo.NONE){if(e.font="14px system-ui",e.textBaseline="top",e.fillStyle="#202124",!n)e.fillText(`${r} \xB7 ${t.integer(G.ENABLED,1)===1?"Open in app to edit":"Unavailable"}`,0,0,s);else if(i===G.TOGGLE)e.strokeStyle="#555",e.strokeRect(0,4,18,18),r==="true"&&e.fillText("\u2713",2,3);else if(i===G.RANGE){let l=Math.max(0,Math.min(1,(Number(r)-Number(t.text(G.MIN)))/(Number(t.text(G.MAX))-Number(t.text(G.MIN)))));e.fillStyle="#bbb",e.fillRect(7,13,Math.max(0,s-14),4),e.fillStyle="#1565c0",e.beginPath(),e.arc(7+(l||0)*Math.max(0,s-14),15,7,0,Math.PI*2),e.fill()}else r.split(`
|
|
60
|
+
`).forEach((l,h)=>e.fillText(l,0,h*18,s-16)),i===G.CHOICE&&e.fillText("\u25BE",Math.max(0,s-16),0);n&&t.text(G.SUBMIT)&&e.fillText(t.text(G.SUBMIT_LABEL)||"Send",0,a-23,s),e.restore();return}e.fillStyle="#fff",e.fillRect(0,0,s,a),e.font="14px system-ui",e.textBaseline="top",e.fillStyle="#202124";let u=t.text(G.LABEL);if(e.fillText(i===G.RANGE?`${u}: ${r}`:u,6,6,Math.max(1,s-12)),!n)e.fillText(r,6,28,Math.max(1,s-12)),e.fillText(t.integer(G.ENABLED,1)===1?"Open in app to edit":"Unavailable",6,48,Math.max(1,s-12));else if(i===G.TOGGLE)e.strokeStyle="#555",e.strokeRect(8,32,18,18),r==="true"&&e.fillText("\u2713",10,31);else if(i===G.RANGE){let l=Number(t.text(G.MIN)),h=Number(t.text(G.MAX)),c=Math.max(0,Math.min(1,(Number(r)-l)/(h-l)))||0;e.fillStyle="#bbb",e.fillRect(12,47,Math.max(0,s-24),4),e.fillStyle="#1565c0",e.beginPath(),e.arc(12+c*Math.max(0,s-24),49,7,0,Math.PI*2),e.fill()}else{let l=i===G.TEXT&&t.integer(G.MULTILINE)===1?Math.max(30,a-62):30;e.strokeStyle="#888",e.strokeRect(6,26,Math.max(0,s-12),l);let h=r.split(`
|
|
61
|
+
`);for(let c=0;c<h.length&&c*18<l-5;c++)e.fillText(h[c],10,31+c*18,Math.max(1,s-25));i===G.CHOICE&&e.fillText("\u25BE",Math.max(6,s-22),31)}if(n&&t.text(G.SUBMIT)){let l=t.text(G.SUBMIT_LABEL)||"Send";e.fillStyle="#eee",e.fillRect(6,a-26,Math.min(s-12,Math.max(56,e.measureText(l).width+16)),22),e.fillStyle="#202124",e.fillText(l,12,a-23,Math.max(1,s-24))}e.restore()}endFrame(){for(let[e,t]of this.entries)this.seen.has(e)||(t.root.remove(),this.entries.delete(e))}dispose(){for(let e of this.entries.values())e.root.remove();this.entries.clear()}draw(e,t,i,r,n,s){if(!Ou.includes(t)||!s||!(i instanceof We))return!1;let a=JSON.stringify(this.scopes),m=this.scopes.length?a:"",u=`${a}:${e}`;this.seen.add(u);let l=s.text(G.KEY),h=this.storeKey(m,l);this.fields.set(h,{component:s,config:t});let c=this.defaults.get(m);c||(c=new Map,this.defaults.set(m,c)),c.set(l,s.text(G.VALUE));let f=i.getCanvas(),d=f.getTransform(),p=[{x:0,y:0},{x:r,y:0},{x:r,y:n},{x:0,y:n}].map(U=>uo(d,U)),b=i.getInputClip();for(let U of b.rectangles)p=Om(p,U);b.rounded.length&&!this.hitContext&&(this.hitContext=document.createElement("canvas").getContext("2d"));let g=b.rounded.every(U=>p.every(H=>this.hitContext?.isPointInPath(U,H.x,H.y)));if(f.canvas!==this.canvas||b.unsupported||!g)return this.entries.get(u)?.root.remove(),this.entries.delete(u),f.save(),f.font="14px system-ui",f.fillStyle="#555",f.fillText(`${s.text(G.LABEL)} \xB7 Open in app to edit`,4,20,Math.max(1,r-8)),f.restore(),!0;let I=[G.MIN,G.MAX,G.STEP].map(U=>s.text(U)).every(U=>!U||Number.isFinite(Number(U)))&&s.integer(G.ENABLED,1)===1&&this.options.editable&&!!l.trim()&&s.canReturnText(G.VALUE_RETURN),T=`${t===G.TEXT&&s.integer(G.MULTILINE)===1}:${!!s.text(G.SUBMIT)}`,v=this.entries.get(u),_=!1;if(v&&(v.shape!==T||v.config!==t||v.writable!==I||v.component.text(G.KEY)!==l)&&(_=v.control===document.activeElement,v.root.remove(),this.entries.delete(u),v=void 0),!v){let U=document.createElement("div");U.style.cssText="position:absolute;transform-origin:0 0;box-sizing:border-box;overflow:auto;font:14px system-ui;background:var(--card-background-color,white);color:var(--primary-text-color,#202124);padding:6px;";for(let H of["pointerdown","click","keydown"])U.addEventListener(H,N=>N.stopPropagation());if(v={root:U,component:s,config:t,writable:I,scope:m,shape:T},this.entries.set(u,v),this.canvas.parentNode?.appendChild(U),I){let H=document.createElement("label"),N=document.createElement("span");v.caption=N,N.textContent=s.text(G.LABEL),N.style.display="block",H.appendChild(N);let k=t===G.CHOICE?document.createElement("select"):t===G.TEXT&&s.integer(G.MULTILINE)===1?document.createElement("textarea"):document.createElement("input");k instanceof HTMLTextAreaElement&&(k.rows=4),k instanceof HTMLInputElement&&(t===G.TOGGLE&&(k.type="checkbox"),t===G.RANGE&&(k.type="range"),t===G.NUMBER&&(k.inputMode="decimal")),k.style.cssText="font:inherit;width:100%;box-sizing:border-box;min-height:30px;",v.control=k,H.appendChild(k),U.appendChild(H);let Y=v;k.addEventListener(t===G.CHOICE||t===G.TOGGLE?"change":"input",()=>{let w=t===G.TOGGLE?String(k.checked):k.value;Y.component.returnText(G.VALUE_RETURN,w)&&(this.drafts.set(h,w),this.options.onChange?.(l,w),t===G.RANGE&&Y.caption&&(Y.caption.textContent=`${Y.component.text(G.LABEL)}: ${w}`),k.setCustomValidity(this.valid(Y.component,w,t)?"":"Enter a valid value"))});let $=()=>{let w=Y.component.text(G.SUBMIT);if(!w)return;let X=this.values(Y.scope);if(!Object.entries(X).every(([z,j])=>(rt=>!!rt&&this.valid(rt.component,j,rt.config))(this.fields.get(this.storeKey(Y.scope,z))))){for(let z of this.entries.values())z.scope===Y.scope&&z.control?.reportValidity();return}this.options.onSubmit?.(w,X),k.blur()};if(k.addEventListener("keydown",w=>{let X=w;X.key==="Enter"&&!X.isComposing&&k instanceof HTMLInputElement&&t!==G.TOGGLE&&t!==G.RANGE&&(X.preventDefault(),$())}),s.text(G.SUBMIT)){let w=document.createElement("button");v.submitButton=w,w.textContent=s.text(G.SUBMIT_LABEL)||"Send",w.addEventListener("click",$),U.appendChild(w)}}}v.component=s;let P=s.integer(G.CHROME)===Bo.NONE;v.root.style.padding=P?"0":"6px",v.root.style.background=P?"transparent":"var(--card-background-color,white)",v.caption&&(v.caption.hidden=P,v.caption.style.display=P?"none":"block"),v.control&&(v.control.setAttribute("aria-label",s.text(G.LABEL)),v.control.style.border=P?"0":"",v.control.style.background=P?"transparent":"",v.control.style.padding=P?"0":"",v.control.style.boxShadow=P?"none":""),v.submitButton&&(v.submitButton.style.border=P?"0":"",v.submitButton.style.background=P?"transparent":"",v.submitButton.style.padding=P?"0":""),v.submitButton&&(v.submitButton.textContent=s.text(G.SUBMIT_LABEL)||"Send"),v.caption&&(v.caption.textContent=t===G.RANGE?`${s.text(G.LABEL)}: ${this.drafts.get(h)??s.text(G.VALUE)}`:s.text(G.LABEL));let E=this.drafts.get(h)??s.text(G.VALUE);if(v.control){if(v.control instanceof HTMLSelectElement){let U=[...new Set(s.text(G.OPTIONS).split(`
|
|
62
|
+
`).filter(Boolean))];Array.from(v.control.options).map(H=>H.value).join(`
|
|
63
|
+
`)!==U.join(`
|
|
64
|
+
`)&&v.control.replaceChildren(...U.map(H=>{let N=document.createElement("option");return N.value=H,N.textContent=H,N}))}v.control instanceof HTMLInputElement&&t===G.RANGE&&(v.control.min=s.text(G.MIN),v.control.max=s.text(G.MAX),v.control.step=s.text(G.STEP)),v.control instanceof HTMLInputElement&&t===G.TOGGLE&&(v.control.checked=E==="true"),v.control.setCustomValidity(this.valid(s,E,t)?"":"Enter a valid value"),v.control.value!==E&&(v.control.value=E),s.text(G.VALUE)!==E&&s.returnText(G.VALUE_RETURN,E)}else v.root.textContent=`${s.text(G.LABEL)}: ${E} \xB7 ${s.integer(G.ENABLED,1)!==1?"Unavailable":"Open in app to edit"}`;(!P||this.canvasExport)&&this.paintControl(f,s,t,E,I,r,n),_&&v.control?.focus();let L=d;v.root.hidden=!p.length||f.globalAlpha<=0,v.root.style.opacity=String(f.globalAlpha),v.root.hidden&&v.control?.blur(),v.root.style.clipPath=p.length?`polygon(${p.map(U=>{let H=Tm(L,U);return`${H.x}px ${H.y}px`}).join(",")})`:"inset(100%)";let V=this.canvas.clientWidth/this.canvas.width,B=this.canvas.clientHeight/this.canvas.height;return v.root.style.left=`${this.canvas.offsetLeft}px`,v.root.style.top=`${this.canvas.offsetTop}px`,v.root.style.width=`${r}px`,v.root.style.height=`${n}px`,v.root.style.transform=`matrix(${L.a*V},${L.b*B},${L.c*V},${L.d*B},${L.e*V},${L.f*B})`,!0}};function fr(o){let e=new Date(o),t=e.getFullYear(),i=e.getMonth()+1,r=e.getDate(),n=e.getHours(),s=e.getMinutes(),a=e.getSeconds(),m=e.getMilliseconds(),u=e.getDay(),l=u===0?7:u,h=new Date(t,0,1),c=Math.floor((o-h.getTime())/864e5)+1,f=-e.getTimezoneOffset()*60;return{getMillis:()=>o,getYear:()=>t,getMonth:()=>i,getDayOfMonth:()=>r,getDayOfYear:()=>c,getHour:()=>n,getMinute:()=>s,getSecond:()=>a,getMillisOfSecond:()=>m,getDayOfWeek:()=>l,getOffsetSeconds:()=>f,getContinuousSeconds:()=>s*60+a+m*.001,getEpochSeconds:()=>Math.floor(o/1e3),getTimeInSec:()=>s*60+a,getTimeInMin:()=>n*60+s}}var Fc={millis(){return Date.now()},snapshot(){return fr(Date.now())}},gr=Fc;var xu=Symbol("rcMeasureId"),Do=class{constructor(e){this.mFrame=0;this.mTotal=0;this.mFrameStart=0;this.mUnattributed=0;this.mNextId=1;this.mByType=new Map;this.mByInstance=new Map;this.mTypeInfo=new WeakMap;this.mSink=e}setSink(e){this.mSink=e}record(e){if(this.mTotal++,e==null){this.mUnattributed++;return}let t=this.typeInfo(e),i=this.mByType.get(t.key);i===void 0&&(i={key:t.key,name:t.name,opCode:t.opCode,count:0},this.mByType.set(t.key,i)),i.count++;let r=e,n=r[xu];n===void 0&&(n=this.mNextId++,Object.defineProperty(r,xu,{value:n,enumerable:!1,writable:!1,configurable:!0}));let s=this.mByInstance.get(n);s===void 0&&(s={id:n,key:t.key,name:t.name,count:0},this.mByInstance.set(n,s)),s.count++}typeInfo(e){let t=e.constructor,i=this.mTypeInfo.get(t);if(i===void 0){let r=t&&t.name||"Unknown",n=r.startsWith("_")?r.slice(1):r,s=t?.OP_CODE,a=typeof s=="number"?s:-1;i={key:a>=0?`op:${a}`:`cls:${n}`,name:n,opCode:a},this.mTypeInfo.set(t,i)}return i}markFrameStart(){this.mFrameStart=this.mTotal}emit(){if(this.mSink===null)return;let e=[...this.mByType.values()].sort((r,n)=>n.count-r.count),t=[...this.mByInstance.values()].sort((r,n)=>n.count-r.count),i={frame:this.mFrame++,total:this.mTotal,unattributed:this.mUnattributed,inPaint:this.mTotal-this.mFrameStart,betweenFrames:this.mFrameStart,byType:e,byInstance:t};try{this.mSink(i),this.reset()}catch(r){this.reset(),console.error("measurement sink threw:",r)}}reset(){this.mTotal=0,this.mFrameStart=0,this.mUnattributed=0,this.mByType.clear(),this.mByInstance.clear()}};var st=class o{constructor(e=gr){this.mRemoteComposeState=new Ve;this.mPaintContext=null;this.mDensity=NaN;this.mPaintTheme=-3;this.mMode="UNSET";this.mDebug=0;this.mOpCount=0;this.mMeasurement=null;this.mTheme=-1;this.mWidth=0;this.mHeight=0;this.mViewportWidth=0;this.mViewportHeight=0;this.mAnimationTime=0;this.mAnimate=!0;this.mLastComponent=null;this.currentTime=0;this.mTouchVersion=1;this.mCustomHost=null;this.mDensityBehavior=o.DENSITY_BEHAVIOR_LEGACY;this.mClock=e,this.mDocLoadTime=e.millis()}static{this.MAX_OP_COUNT=2e4}setCustomHost(e){this.mCustomHost=e}getCustomHost(){return this.mCustomHost}supportsVersion(e,t,i){return this.mDocument?.mVersion?.supportsVersion(e,t,i)??!1}getDensity(){return this.mDensity}static{this.DENSITY_BEHAVIOR_LEGACY=0}static{this.DENSITY_BEHAVIOR_PIXELS=1}static{this.DENSITY_BEHAVIOR_DP=2}getDensityBehavior(){return this.mDensityBehavior||(this.mDocument?.getDensityBehavior()??o.DENSITY_BEHAVIOR_LEGACY)}setDensityBehavior(e){this.mDensityBehavior=e}setDensity(e){!Number.isNaN(e)&&e>0&&(this.mDensity=e)}getDocLoadTime(){return this.mDocLoadTime}setDocLoadTime(){this.mDocLoadTime=this.mClock.millis()}isAnimationEnabled(){return this.mAnimate}setAnimationEnabled(e){this.mAnimate=e}setAnimationTime(e){this.mAnimationTime=e}getAnimationTime(){return this.mAnimationTime}getClock(){return this.mClock}setClock(e){this.mClock=e}setPaintTheme(e){this.mPaintTheme=e}getPaintTheme(){return this.mPaintTheme}setTouchVersion(e){this.mTouchVersion=e}getTouchVersion(){return this.mTouchVersion}getTheme(){return this.mTheme}setTheme(e){this.mTheme=e}getMode(){return this.mMode}setMode(e){this.mMode=e}getPaintContext(){return this.mPaintContext}setPaintContext(e){this.mPaintContext=e}getDocument(){return this.mDocument}setDocument(e){this.mDocument=e,this.mClock=e.getClock()}isBasicDebug(){return this.mDebug===1}isVisualDebug(){return this.mDebug===2}isLayoutDebug(){return this.mDebug===3}setDebug(e){this.mDebug=e}needsRepaint(){this.mPaintContext&&this.mPaintContext.needsRepaint()}incrementOpCount(e){if(this.mOpCount++,this.mMeasurement!==null&&this.mMeasurement.record(e),this.mOpCount>o.MAX_OP_COUNT)throw new Error("Too many operations executed")}setMeasurementSink(e){e===null?this.mMeasurement=null:this.mMeasurement===null?this.mMeasurement=new Do(e):this.mMeasurement.setSink(e)}isMeasurementEnabled(){return this.mMeasurement!==null}beginMeasuredFrame(){this.mMeasurement!==null&&this.mMeasurement.markFrameStart()}emitMeasuredFrame(){this.mMeasurement!==null&&this.mMeasurement.emit()}getLastOpCount(){let e=this.mOpCount;return this.mOpCount=0,e}clearLastOpCount(){this.mOpCount=0}loadFont(e,t){let i=this.getObject(e);i&&i.mFontData===t||this.putObject(e,{mFontId:e,mFontData:t,fontBuilder:null})}header(e,t,i,r,n,s,a){this.mDocument&&(this.mDocument.setVersion(e,t,i),this.mDocument.mHeaderSized||(this.mDocument.setWidth(r),this.mDocument.setHeight(n),this.mDocument.mHeaderSized=!0),this.mDocument.setRequiredCapabilities(s),this.mDocument.setProperties(a))}setRootContentBehavior(e,t,i,r){this.mDocument&&this.mDocument.setRootContentBehavior(e,t,i,r)}setDocumentContentDescription(e){let t=this.mRemoteComposeState.getFromId(e);this.mDocument&&this.mDocument.setContentDescription(t)}markVariableDirty(e){}addTouchListener(e){this.mDocument&&this.mDocument.addTouchListener(e)}createEdgeEffect(e){return null}getListeners(e){return null}getCollectionsAccess(){return this.mRemoteComposeState}static{this.ID_CONTINUOUS_SEC=1}static{this.ID_TIME_IN_SEC=2}static{this.ID_TIME_IN_MIN=3}static{this.ID_TIME_IN_HR=4}static{this.ID_WINDOW_WIDTH=5}static{this.ID_WINDOW_HEIGHT=6}static{this.ID_COMPONENT_WIDTH=7}static{this.ID_COMPONENT_HEIGHT=8}static{this.ID_CALENDAR_MONTH=9}static{this.ID_OFFSET_TO_UTC=10}static{this.ID_WEEK_DAY=11}static{this.ID_DAY_OF_MONTH=12}static{this.ID_TOUCH_POS_X=13}static{this.ID_TOUCH_POS_Y=14}static{this.ID_TOUCH_VEL_X=15}static{this.ID_TOUCH_VEL_Y=16}static{this.ID_ACCELERATION_X=17}static{this.ID_ACCELERATION_Y=18}static{this.ID_ACCELERATION_Z=19}static{this.ID_GYRO_ROT_X=20}static{this.ID_GYRO_ROT_Y=21}static{this.ID_GYRO_ROT_Z=22}static{this.ID_MAGNETIC_X=23}static{this.ID_MAGNETIC_Y=24}static{this.ID_MAGNETIC_Z=25}static{this.ID_LIGHT=26}static{this.ID_DENSITY=27}static{this.ID_API_LEVEL=28}static{this.ID_TOUCH_EVENT_TIME=29}static{this.ID_ANIMATION_TIME=30}static{this.ID_ANIMATION_DELTA_TIME=31}static{this.ID_EPOCH_SECOND=32}static{this.ID_FONT_SIZE=33}static{this.ID_DAY_OF_YEAR=34}static{this.ID_YEAR=35}static{this.ID_FIRST_BASELINE=36}static{this.ID_LAST_BASELINE=37}static{this.FLOAT_DENSITY=bt(27)}static{this.FLOAT_CONTINUOUS_SEC=bt(1)}static{this.FLOAT_TIME_IN_SEC=bt(2)}static{this.FLOAT_TIME_IN_MIN=bt(3)}static{this.FLOAT_TIME_IN_HR=bt(4)}static{this.FLOAT_WINDOW_WIDTH=bt(5)}static{this.FLOAT_WINDOW_HEIGHT=bt(6)}static{this.FLOAT_COMPONENT_WIDTH=bt(7)}static{this.FLOAT_COMPONENT_HEIGHT=bt(8)}static{this.FLOAT_CALENDAR_MONTH=bt(9)}static{this.FLOAT_OFFSET_TO_UTC=bt(10)}static{this.FLOAT_WEEK_DAY=bt(11)}static{this.FLOAT_DAY_OF_MONTH=bt(12)}static{this.FLOAT_TOUCH_POS_X=bt(13)}static{this.FLOAT_TOUCH_POS_Y=bt(14)}static{this.FLOAT_TOUCH_VEL_X=bt(15)}static{this.FLOAT_TOUCH_VEL_Y=bt(16)}static{this.FLOAT_TOUCH_EVENT_TIME=bt(29)}static{this.FLOAT_ANIMATION_TIME=bt(30)}static{this.FLOAT_ANIMATION_DELTA_TIME=bt(31)}static{this.FLOAT_DAY_OF_YEAR=bt(34)}static{this.FLOAT_YEAR=bt(35)}static{this.FLOAT_API_LEVEL=bt(28)}static{this.FLOAT_FONT_SIZE=bt(33)}static{this.FIRST_BASELINE=bt(36)}static{this.LAST_BASELINE=bt(37)}static isTime(e){let t=Ci(e);return t>=o.ID_CONTINUOUS_SEC&&t<=o.ID_DAY_OF_MONTH}};var D=class o{constructor(){this.mDirty=!0}static{this.ENABLE_DIRTY_FLAG_OPTIMIZATION=!0}materialize(e,t,i){t.push(this);let r=this.getList;if(typeof r=="function"){let n=r.call(this);e.expandRecursive(n,t,i),n.length=0,t.push(e.makeContainerEnd())}}markDirty(){this.mDirty=!0}markNotDirty(){o.ENABLE_DIRTY_FLAG_OPTIMIZATION&&(this.mDirty=!1)}isDirty(){return o.ENABLE_DIRTY_FLAG_OPTIMIZATION?this.mDirty:!0}};var Ct=class o extends D{static{this.OP_CODE=0}static{this.MAGIC_NUMBER=76283904}static{this.MAX_TABLE_SIZE=1e3}static{this.DOC_WIDTH=5}static{this.DOC_HEIGHT=6}static{this.DOC_DENSITY_AT_GENERATION=7}static{this.DOC_DENSITY_BEHAVIOR=27}static{this.DOC_DESIRED_FPS=8}static{this.DOC_CONTENT_DESCRIPTION=9}static{this.DOC_SOURCE=11}static{this.DOC_DATA_UPDATE=12}static{this.HOST_EXCEPTION_HANDLER=13}static{this.DOC_PROFILES=14}static{this.FEATURE_PAINT_MEASURE=15}static{this.DEBUG=16}static{this.FEATURE_MEASURE_VERSION=17}static{this.FEATURE_TOUCH_VERSION=18}static{this.FEATURE_PRIORITY_FIX=23}static{this.DATA_TYPE_INT=0}static{this.DATA_TYPE_FLOAT=1}static{this.DATA_TYPE_LONG=2}static{this.DATA_TYPE_STRING=3}constructor(e,t,i,r=null,n=256,s=256,a=0){if(super(),this.mMajorVersion=e,this.mMinorVersion=t,this.mPatchVersion=i,this.mWidth=n,this.mHeight=s,this.mCapabilities=a,this.mProperties=r,this.mProfiles=0,r){let m=r.get(o.DOC_PROFILES);m!=null&&(this.mProfiles=m);let u=r.get(o.DOC_WIDTH);u!=null&&(this.mWidth=u);let l=r.get(o.DOC_HEIGHT);l!=null&&(this.mHeight=l)}}get(e){return this.mProperties?.get(e)??null}getInt(e,t){let i=this.mProperties?.get(e);return i!=null&&typeof i=="number"?i:t}getProfiles(){return this.mProfiles}setVersion(e){e.setVersion(this.mMajorVersion,this.mMinorVersion,this.mPatchVersion),e.mHeaderSized||(e.setWidth(this.mWidth),e.setHeight(this.mHeight),e.mHeaderSized=!0),e.setAuthorDimensions(this.mWidth,this.mHeight),e.setRequiredCapabilities(this.mCapabilities),e.setProperties(this.mProperties)}write(e){e.start(o.OP_CODE)}apply(e){e.header(this.mMajorVersion,this.mMinorVersion,this.mPatchVersion,this.mWidth,this.mHeight,this.mCapabilities,this.mProperties)}deepToString(e){return`${e}Header v${this.mMajorVersion}.${this.mMinorVersion}.${this.mPatchVersion} ${this.mWidth}x${this.mHeight}`}static peekApiLevel(e){let t=e.getIndex();e.readByte();let i=e.readInt();if(e.setIndex(t),(i&4294901760)===o.MAGIC_NUMBER){let r=i&65535,n=e.peekInt();if(r>=1){e.setIndex(t),e.readByte(),e.readInt();let s=e.readInt();return e.setIndex(t),s>=2?8:s>=1?7:6}return 6}return 6}static readDirect(e){e.readByte();let t=e.readInt();if((t&4294901760)===o.MAGIC_NUMBER){let u=t&65535,l=e.readInt(),h=e.readInt(),c=e.readInt(),f=new re;c>o.MAX_TABLE_SIZE&&console.warn(`Header: property table size ${c} exceeds limit ${o.MAX_TABLE_SIZE}, truncating`);for(let d=0;d<c;d++){let p=e.readShort(),b=p>>10,g=p&1023,C=e.readShort();if(d>=o.MAX_TABLE_SIZE){for(let y=0;y<C;y++)e.readByte();continue}switch(b){case o.DATA_TYPE_INT:f.put(g,e.readInt());break;case o.DATA_TYPE_FLOAT:f.put(g,e.readFloat());break;case o.DATA_TYPE_LONG:f.put(g,e.readLong());break;case o.DATA_TYPE_STRING:f.put(g,e.readUTF8());break;default:for(let y=0;y<C;y++)e.readByte();break}}return new o(u,l,h,f)}let i=t,r=e.readInt(),n=e.readInt(),s=e.readInt(),a=e.readInt(),m=e.readLong();return new o(i,r,n,null,s,a,m)}static read(e,t){let i=e.getIndex()-1;e.setIndex(i);let r=o.readDirect(e);t.push(r)}};var $t=class o extends D{static{this.OP_CODE=214}write(e){e.start(o.OP_CODE)}apply(e){}deepToString(e){return`${e}ContainerEnd`}static read(e,t){t.push(new o)}};var Au=1<<30,Eu=65535;function Sc(o){return typeof o.getList=="function"}function Pc(o){return typeof o.updateVariables=="function"}var Z=class extends D{static{this.PTR_DEREFERENCE=Au}static{this.VALUE_MASK=Eu}apply(e){if(e.mMode==="PAINT"){let t=e.getPaintContext();t&&this.paint(t)}else if(Sc(this))for(let t of this.getList())t.isDirty()&&(Pc(t)&&(t.markNotDirty(),t.updateVariables(e)),t.apply(e))}deepToString(e){return e+this.constructor.name}getId(e,t){let i=e&Eu;return(e&Au)!==0&&(i=t.getContext().getInteger(i)),i}};var mt=class{constructor(){this.mType=0}getType(){return this.mType}static{this.CUBIC_STANDARD=1}static{this.CUBIC_ACCELERATE=2}static{this.CUBIC_DECELERATE=3}static{this.CUBIC_LINEAR=4}static{this.CUBIC_ANTICIPATE=5}static{this.CUBIC_OVERSHOOT=6}static{this.CUBIC_CUSTOM=11}static{this.SPLINE_CUSTOM=12}static{this.EASE_OUT_BOUNCE=13}static{this.EASE_OUT_ELASTIC=14}};var Yr=[.4,0,.2,1],_c=[.4,.05,.8,.7],Rc=[0,0,.2,.95],Bc=[1,1,0,0],Dc=[.36,0,.66,-.56],wc=[.34,1.56,.64,1],Lc=.01,Nc=1e-4,Jt=class extends mt{constructor(t,i,r,n){super();this.mX1=0;this.mY1=0;this.mX2=0;this.mY2=0;i!==void 0&&r!==void 0&&n!==void 0?this.setup(t,i,r,n):t!==void 0?(this.mType=t,this.config(t)):this.setup(Yr[0],Yr[1],Yr[2],Yr[3])}config(t){switch(t){case mt.CUBIC_STANDARD:this.setupArr(Yr);break;case mt.CUBIC_ACCELERATE:this.setupArr(_c);break;case mt.CUBIC_DECELERATE:this.setupArr(Rc);break;case mt.CUBIC_LINEAR:this.setupArr(Bc);break;case mt.CUBIC_ANTICIPATE:this.setupArr(Dc);break;case mt.CUBIC_OVERSHOOT:this.setupArr(wc);break}this.mType=t}setupArr(t){this.setup(t[0],t[1],t[2],t[3])}setup(t,i,r,n){this.mX1=t,this.mY1=i,this.mX2=r,this.mY2=n}getX(t){let i=1-t;return this.mX1*3*i*i*t+this.mX2*3*i*t*t+t*t*t}getY(t){let i=1-t;return this.mY1*3*i*i*t+this.mY2*3*i*t*t+t*t*t}get(t){if(t<=0)return 0;if(t>=1)return 1;let i=.5,r=.5;for(;r>Lc;){let u=this.getX(i);r*=.5,u<t?i+=r:i-=r}let n=this.getX(i-r),s=this.getX(i+r),a=this.getY(i-r);return(this.getY(i+r)-a)*(t-n)/(s-n)+a}getDiff(t){let i=.5,r=.5;for(;r>Nc;){let u=this.getX(i);r*=.5,u<t?i+=r:i-=r}let n=this.getX(i-r),s=this.getX(i+r),a=this.getY(i-r);return(this.getY(i+r)-a)/(s-n)}};var Je=7.5625,zt=2.75,wo=class extends mt{constructor(e){super(),this.mType=e}get(e){let t=e;return t<0?0:t<1/zt?1/(1+1/zt)*(Je*t*t+t):t<2/zt?(t-=1.5/zt,Je*t*t+.75):t<2.5/zt?(t-=2.25/zt,Je*t*t+.9375):t<=1?(t-=2.625/zt,Je*t*t+.984375):1}getDiff(e){return e<0?0:e<1/zt?2*Je*e/(1+1/zt)+1/(1+1/zt):e<2/zt?2*Je*(e-1.5/zt):e<2.5/zt?2*Je*(e-2.25/zt):e<=1?2*Je*(e-2.625/zt):0}};var Vc=2*Math.PI/3,Mu=20*Math.PI,Wc=Math.log(8),Lo=class extends mt{get(e){return e<=0?0:e>=1?1:Math.pow(2,-10*e)*Math.sin((e*10-.75)*Vc)+1}getDiff(e){return e<0||e>1?0:5*Math.pow(2,1-10*e)*(Wc*Math.cos(Mu*e/3)+2*Math.PI*Math.sin(Mu*e/3))/3}};var No=class o{constructor(e,t){this.mExtrapolate=!0;let i=e.length,r=t[0].length;this.mDim=r,this.mSlopeTemp=new Float64Array(r),this.mT=e instanceof Float64Array?e:Float64Array.from(e),this.mY=new Array(i);for(let a=0;a<i;a++)this.mY[a]=Float64Array.from(t[a]);let n=new Array(i-1);for(let a=0;a<i-1;a++)n[a]=new Float64Array(r);let s=new Array(i);for(let a=0;a<i;a++)s[a]=new Float64Array(r);for(let a=0;a<r;a++){for(let m=0;m<i-1;m++){let u=this.mT[m+1]-this.mT[m];n[m][a]=(this.mY[m+1][a]-this.mY[m][a])/u,m===0?s[m][a]=n[m][a]:s[m][a]=(n[m-1][a]+n[m][a])*.5}s[i-1][a]=n[i-2][a]}for(let a=0;a<i-1;a++)for(let m=0;m<r;m++)if(n[a][m]===0)s[a][m]=0,s[a+1][m]=0;else{let u=s[a][m]/n[a][m],l=s[a+1][m]/n[a][m],h=Math.hypot(u,l);if(h>9){let c=3/h;s[a][m]=c*u*n[a][m],s[a+1][m]=c*l*n[a][m]}}this.mTangent=s}getPos(e,t){let i=this.mT.length;if(this.mExtrapolate){if(e<=this.mT[0])return this.mY[0][t]+(e-this.mT[0])*this.getSlope(this.mT[0],t);if(e>=this.mT[i-1])return this.mY[i-1][t]+(e-this.mT[i-1])*this.getSlope(this.mT[i-1],t)}else{if(e<=this.mT[0])return this.mY[0][t];if(e>=this.mT[i-1])return this.mY[i-1][t]}for(let r=0;r<i-1;r++){if(e===this.mT[r])return this.mY[r][t];if(e<this.mT[r+1]){let n=this.mT[r+1]-this.mT[r],s=(e-this.mT[r])/n;return o.interpolate(n,s,this.mY[r][t],this.mY[r+1][t],this.mTangent[r][t],this.mTangent[r+1][t])}}return 0}getSlope(e,t){let i=this.mT.length;e<this.mT[0]?e=this.mT[0]:e>=this.mT[i-1]&&(e=this.mT[i-1]);for(let r=0;r<i-1;r++)if(e<=this.mT[r+1]){let n=this.mT[r+1]-this.mT[r],s=(e-this.mT[r])/n;return o.diff(n,s,this.mY[r][t],this.mY[r+1][t],this.mTangent[r][t],this.mTangent[r+1][t])/n}return 0}static interpolate(e,t,i,r,n,s){let a=t*t,m=a*t;return-2*m*r+3*a*r+2*m*i-3*a*i+i+e*s*m+e*n*m-e*s*a-2*e*n*a+e*n*t}static diff(e,t,i,r,n,s){let a=t*t;return-6*a*r+6*t*r+6*a*i-6*t*i+3*e*s*a+3*e*n*a-2*e*s*t-4*e*n*t+e*n}};var Vo=class o extends mt{constructor(e,t,i){super(),this.mCurveFit=o.genSpline(e,t,i)}static genSpline(e,t,i){let r=i*3-2,n=i-1,s=1/n,a=new Array(r);for(let u=0;u<r;u++)a[u]=[0];let m=new Float64Array(r);for(let u=0;u<i;u++){let l=e[u+t];a[u+n][0]=l,m[u+n]=u*s,u>0&&(a[u+n*2][0]=l+1,m[u+n*2]=u*s+1,a[u-1][0]=l-1-s,m[u-1]=u*s+-1-s)}return new No(m,a)}get(e){return e<0?0:e>1?1:this.mCurveFit.getPos(e,0)}getDiff(e){return e<0||e>1?0:this.mCurveFit.getSlope(e,0)}};var Fu=new DataView(new ArrayBuffer(4));function kc(o){return Fu.setFloat32(0,o,!1),Fu.getInt32(0,!1)}var Wo=class o extends mt{constructor(t){super();this.mDuration=1;this.mWrap=NaN;this.mInitialValue=NaN;this.mTargetValue=NaN;this.mDirectionalSnap=0;this.mOffset=0;this.mPropagate=!1;this.mType=mt.CUBIC_STANDARD,this.mSpec=t,this.setAnimationDescription(t)}setAnimationDescription(t){this.mSpec=t,this.mDuration=this.mSpec.length===0?1:this.mSpec[0];let i=0;if(this.mSpec.length>1){let r=kc(this.mSpec[1]);this.mType=r&255;let n=(r>>8&1)>0,s=(r>>8&2)>0;this.mDirectionalSnap=r>>10&3,this.mPropagate=(r>>12&1)>0,i=r>>16&65535;let a=2+i;s&&(this.mInitialValue=this.mSpec[a++]),n&&(this.mWrap=this.mSpec[a])}this.create(this.mType,t,2,i)}create(t,i,r,n){switch(t){case mt.CUBIC_STANDARD:case mt.CUBIC_ACCELERATE:case mt.CUBIC_DECELERATE:case mt.CUBIC_LINEAR:case mt.CUBIC_ANTICIPATE:case mt.CUBIC_OVERSHOOT:this.mEasingCurve=new Jt(t);break;case mt.CUBIC_CUSTOM:i?this.mEasingCurve=new Jt(i[r],i[r+1],i[r+2],i[r+3]):this.mEasingCurve=new Jt;break;case mt.EASE_OUT_BOUNCE:this.mEasingCurve=new wo(t);break;case mt.EASE_OUT_ELASTIC:this.mEasingCurve=new Lo;break;case mt.SPLINE_CUSTOM:i?this.mEasingCurve=new Vo(i,r,n):this.mEasingCurve=new Jt;break;default:this.mEasingCurve=new Jt;break}}getDuration(){return this.mDuration}setInitialValue(t){Number.isNaN(this.mWrap)?this.mInitialValue=t:this.mInitialValue=t%this.mWrap,this.setScaleOffset()}static wrap(t,i){return i=i%t,i<0&&(i+=t),i}wrapDistance(t,i,r){let n=(r-i)%360;return n<-t/2?n+=t:n>t/2&&(n-=t),n}setTargetValue(t){if(this.mTargetValue=t,!Number.isNaN(this.mWrap)){this.mInitialValue=o.wrap(this.mWrap,this.mInitialValue),this.mTargetValue=o.wrap(this.mWrap,this.mTargetValue),Number.isNaN(this.mInitialValue)&&(this.mInitialValue=this.mTargetValue);let i=this.wrapDistance(this.mWrap,this.mInitialValue,this.mTargetValue);i>0&&this.mTargetValue<this.mInitialValue?this.mTargetValue+=this.mWrap:i<0&&this.mDirectionalSnap!==0&&(this.mDirectionalSnap===1&&this.mTargetValue>this.mInitialValue&&(this.mInitialValue=this.mTargetValue),this.mDirectionalSnap===2&&this.mTargetValue<this.mInitialValue&&(this.mInitialValue=this.mTargetValue),this.mTargetValue-=this.mWrap)}this.setScaleOffset()}getTargetValue(){return this.mTargetValue}getInitialValue(){return this.mInitialValue}isPropagate(){return this.mPropagate}setScaleOffset(){!Number.isNaN(this.mInitialValue)&&!Number.isNaN(this.mTargetValue)?this.mOffset=this.mInitialValue:this.mOffset=0}get(t){return this.mDirectionalSnap===1&&this.mTargetValue<this.mInitialValue?(this.mInitialValue=this.mTargetValue,this.mTargetValue):this.mDirectionalSnap===2&&this.mTargetValue>this.mInitialValue?(this.mInitialValue=this.mTargetValue,this.mTargetValue):this.mEasingCurve.get(t/this.mDuration)*(this.mTargetValue-this.mInitialValue)+this.mInitialValue}getDiff(t){return this.mEasingCurve.getDiff(t/this.mDuration)*(this.mTargetValue-this.mInitialValue)}};var ko=class{constructor(e){this.mDamping=.5;this.mStiffness=0;this.mTargetPos=0;this.mLastTime=0;this.mPos=0;this.mV=0;this.mMass=1;this.mStopThreshold=0;this.mBoundaryMode=0;if(e){if(e[0]!==0)throw new Error("parameter[0] should be 0");let t=new DataView(new ArrayBuffer(4));t.setFloat32(0,e[4],!1);let i=t.getInt32(0,!1);this.springParameters(1,e[1],e[2],e[3],i)}}getTargetValue(){return this.mTargetPos}setInitialValue(e){this.mPos=e}setTargetValue(e){this.mTargetPos=e}springStart(e,t,i){this.mTargetPos=t,this.mPos=e,this.mLastTime=0}springParameters(e,t,i,r,n){this.mDamping=i,this.mStiffness=t,this.mMass=e,this.mStopThreshold=r,this.mBoundaryMode=n,this.mLastTime=0}getVelocity(e){return this.mV}get(e){return this.compute(e-this.mLastTime),this.mLastTime=e,this.isStopped()&&(this.mPos=this.mTargetPos),this.mPos}isStopped(){let e=this.mPos-this.mTargetPos,t=this.mV*this.mV*this.mMass+this.mStiffness*e*e;return Math.sqrt(t/this.mStiffness)<=this.mStopThreshold}compute(e){if(e<=0)return;let t=this.mStiffness,i=this.mDamping,r=Math.trunc(1+9/(Math.sqrt(this.mStiffness/this.mMass)*e*4));e/=r;for(let n=0;n<r;n++){let s=this.mPos-this.mTargetPos,a=(-t*s-i*this.mV)/this.mMass,m=this.mV+a*e/2,h=(-(this.mPos+e*m/2-this.mTargetPos)*t-m*i)/this.mMass*e,c=this.mV+h/2;this.mV+=h,this.mPos+=c*e,this.mBoundaryMode>0&&(this.mPos<0&&(this.mBoundaryMode&1)===1&&(this.mPos=-this.mPos,this.mV=-this.mV),this.mPos>1&&(this.mBoundaryMode&2)===2&&(this.mPos=2-this.mPos,this.mV=-this.mV))}}};var Va=2**42;function ne(o){return o>=Va?o-Va|0:Ci(o)}var yt=class o extends D{constructor(t,i,r){super();this.mFloatAnimation=null;this.mSpring=null;this.mLastChange=NaN;this.mLastCalculatedValue=NaN;this.mLastAnimatedValue=NaN;this.mR0=0;this.mR1=0;this.mR2=0;this.mR3=0;this.mVar=[0,0,0];this.mId=t,this.mBits=i,this.mAnimation=r,r&&(r.length>4&&r[0]===0?this.mSpring=new ko(r):this.mFloatAnimation=new Wo(r))}static{this.OP_CODE=81}write(t){}registerListening(t){for(let i=0;i<this.mBits.length;i++){let r=this.mBits[i];O(r)&&!o.isMathOperatorBits(r)&&!o.isDataVariableBits(r)&&t.listensTo(x(r),this)}}updateVariables(t){let i=o.evalRPN(t,this.mBits,this.mVar),r=i!==this.mLastCalculatedValue;r&&(i!==this.mLastCalculatedValue?(this.mLastChange=t.getAnimationTime(),this.mLastCalculatedValue=i):r=!1),r&&this.mFloatAnimation?(Number.isNaN(this.mFloatAnimation.getTargetValue())?this.mFloatAnimation.setInitialValue(i):this.mFloatAnimation.setInitialValue(this.mFloatAnimation.getTargetValue()),this.mFloatAnimation.setTargetValue(i)):r&&this.mSpring&&this.mSpring.setTargetValue(i)}static isMathOperatorBits(t){if(!O(t))return!1;let i=x(t);return i>o.OFFSET&&i<=o.OFFSET+79}static isDataVariableBits(t){return O(t)?(x(t)&o.ID_REGION_MASK)===o.ID_REGION_ARRAY:!1}apply(t){let i=t.getAnimationTime();if(Number.isNaN(this.mLastChange)&&(this.mLastChange=i),this.mFloatAnimation){Number.isNaN(this.mLastCalculatedValue)&&(this.mLastCalculatedValue=this.evaluate(t),this.mFloatAnimation.setTargetValue(this.mLastCalculatedValue),Number.isNaN(this.mFloatAnimation.getInitialValue())&&this.mFloatAnimation.setInitialValue(this.mLastCalculatedValue));let r=this.mFloatAnimation.get(i-this.mLastChange);(r!==this.mLastAnimatedValue||i-this.mLastChange<=this.mFloatAnimation.getDuration())&&(this.mLastAnimatedValue=r,t.loadFloat(this.mId,r),t.needsRepaint())}else if(this.mSpring){let r=this.mSpring.get(i);(r!==this.mLastAnimatedValue||Math.abs(this.mSpring.getTargetValue()-r)>.01)&&(this.mLastAnimatedValue=r,t.loadFloat(this.mId,r),t.needsRepaint())}else{let r=this.evaluate(t);t.loadFloat(this.mId,r)}}static{this.OFFSET=3211264}static{this.ID_REGION_MASK=7340032}static{this.ID_REGION_ARRAY=2097152}evaluate(t){return o.evalRPN(t,this.mBits,this.mVar)}static evalRPN(t,i,r=[0,0,0]){let n=[],s=o.OFFSET,a=t.getCollectionsAccess(),m=i instanceof Int32Array,u=0,l=0,h=0,c=0;for(let f=0;f<i.length;f++){let d=i[f],p=m?d|0:et(d),b=m?F(p):d;if(O(p)){let g=x(p);if((g&o.ID_REGION_MASK)===o.ID_REGION_ARRAY)n.push(Va+g);else if(g>s&&g<=s+79)switch(g-s){case 1:{let y=n.pop(),I=n.pop();n.push(I+y);break}case 2:{let y=n.pop(),I=n.pop();n.push(I-y);break}case 3:{let y=n.pop(),I=n.pop();n.push(I*y);break}case 4:{let y=n.pop(),I=n.pop();n.push(y!==0?I/y:0);break}case 5:{let y=n.pop(),I=n.pop();n.push(I%y);break}case 6:{let y=n.pop(),I=n.pop();n.push(Math.min(I,y));break}case 7:{let y=n.pop(),I=n.pop();n.push(Math.max(I,y));break}case 8:{let y=n.pop(),I=n.pop();n.push(Math.pow(I,y));break}case 9:n.push(Math.sqrt(n.pop()));break;case 10:n.push(Math.abs(n.pop()));break;case 11:n.push(Math.sign(n.pop()));break;case 12:{let y=n.pop(),I=n.pop();n.push(1/y<0||y<0?-Math.abs(I):Math.abs(I));break}case 13:n.push(Math.exp(n.pop()));break;case 14:n.push(Math.floor(n.pop()));break;case 15:n.push(Math.log10(n.pop()));break;case 16:n.push(Math.log(n.pop()));break;case 17:n.push(Math.round(n.pop()));break;case 18:n.push(Math.sin(n.pop()));break;case 19:n.push(Math.cos(n.pop()));break;case 20:n.push(Math.tan(n.pop()));break;case 21:n.push(Math.asin(n.pop()));break;case 22:n.push(Math.acos(n.pop()));break;case 23:n.push(Math.atan(n.pop()));break;case 24:{let y=n.pop(),I=n.pop();n.push(Math.atan2(I,y));break}case 25:{let y=n.pop(),I=n.pop(),T=n.pop();n.push(T*I+y);break}case 26:{let y=n.pop(),I=n.pop(),T=n.pop();n.push(y>0?I:T);break}case 27:{let y=n.pop(),I=n.pop(),T=n.pop();n.push(Math.min(Math.max(T,y),I));break}case 28:n.push(Math.pow(n.pop(),1/3));break;case 29:n.push(n.pop()*(180/Math.PI));break;case 30:n.push(n.pop()*(Math.PI/180));break;case 31:n.push(Math.ceil(n.pop()));break;case 32:{let y=n.pop(),I=ne(n.pop());n.push(a.getFloatValue(I,Math.trunc(y)));break}case 33:{let y=ne(n.pop()),I=a.getFloats(y);if(I&&I.length>0){let T=I[0];for(let v=1;v<I.length;v++)T=Math.max(T,I[v]);n.push(T)}else n.push(0);break}case 34:{let y=ne(n.pop()),I=a.getFloats(y);if(I&&I.length>0){let T=I[0];for(let v=1;v<I.length;v++)T=Math.min(T,I[v]);n.push(T)}else n.push(0);break}case 35:{let y=ne(n.pop()),I=a.getFloats(y),T=0;if(I)for(let v=0;v<I.length;v++)T+=I[v];n.push(T);break}case 36:{let y=ne(n.pop()),I=a.getFloats(y),T=0;if(I&&I.length>0){for(let v=0;v<I.length;v++)T+=I[v];n.push(T/I.length)}else n.push(0);break}case 37:{let y=ne(n.pop());n.push(a.getListLength(y));break}case 38:{let y=n.pop(),I=ne(n.pop()),T=a.getFloats(I);n.push(T?o.splineInterp(T,y):0);break}case 39:n.push(jt.nextRandom());break;case 40:jt.seedRandom(n.pop());break;case 41:{let y=et(n.pop());y=y<<13^y|0,n.push(1-(Math.imul(y,Math.imul(y,Math.imul(y,15731))+789221)+1376312589&2147483647)/1073741800);break}case 42:{let y=n.pop(),I=n.pop();n.push(I+jt.nextRandom()*(y-I));break}case 43:{let y=n.pop(),I=n.pop();n.push(I*I+y*y);break}case 44:{let y=n.pop(),I=n.pop();n.push(I>y?1:0);break}case 45:{let y=n.pop();n.push(y*y);break}case 46:n.push(n[n.length-1]);break;case 47:{let y=n.pop(),I=n.pop();n.push(Math.hypot(I,y));break}case 48:{let y=n.pop(),I=n.pop();n.push(y,I);break}case 49:{let y=n.pop(),I=n.pop(),T=n.pop();n.push(T+(I-T)*y);break}case 50:{let y=n.pop(),I=n.pop(),T=n.pop();if(T<y)n.push(0);else if(T>I)n.push(1);else{let v=(T-y)/(I-y);n.push(v*v*(3-2*v))}break}case 51:n.push(Math.log(n.pop())/Math.log(2));break;case 52:n.push(1/n.pop());break;case 53:{let y=n.pop();n.push(y-Math.trunc(y));break}case 54:{let y=n.pop(),I=n.pop(),T=y*2,v=I%T;n.push(v<y?v:T-v);break}case 55:break;case 56:u=n.pop();break;case 57:l=n.pop();break;case 58:h=n.pop();break;case 59:c=n.pop();break;case 60:n.push(u);break;case 61:n.push(l);break;case 62:n.push(h);break;case 63:n.push(c);break;case 64:case 65:case 66:case 67:break;case 70:n.push(r[0]);break;case 71:n.push(r[1]);break;case 72:n.push(r[2]);break;case 73:n.push(-n.pop());break;case 74:{let y=n.pop(),I=n.pop(),T=n.pop(),v=n.pop(),_=n.pop();n.push(o.cubicEasing(_,v,T,I,y));break}case 75:{let y=n.pop(),I=ne(n.pop()),T=y-Math.floor(y),v=a.getFloats(I);n.push(v?o.splineInterp(v,T<0?T+1:T):0);break}case 76:{let y=Math.trunc(n.pop()),I=ne(n.pop()),T=0;for(let v=0;v<=y;v++)T+=a.getFloatValue(I,v);n.push(T);break}case 77:{let y=ne(n.pop()),I=ne(n.pop()),T=a.getFloats(I),v=a.getFloats(y),_=0;if(T&&v)for(let P=0;P<T.length;P++)_+=T[P]*v[P];n.push(_);break}case 78:{let y=ne(n.pop()),I=a.getFloats(y),T=0;if(I)for(let v=0;v<I.length;v++)T+=I[v]*I[v];n.push(T);break}case 79:{let y=n.pop(),I=ne(n.pop()),T=a.getFloats(I);if(T&&T.length>0){let v=y*(T.length-1),_=Math.trunc(v);if(_<0)n.push(T[0]);else if(_>=T.length-1)n.push(T[T.length-1]);else{let P=v-_;n.push(T[_]+P*(T[_+1]-T[_]))}}else n.push(0);break}default:n.push(0);break}else n.push(t.getFloat(g))}else n.push(b)}return n.length>0?n[n.length-1]:0}static splineInterp(t,i){let r=t.length;if(r===0)return 0;if(r===1)return t[0];let n=new Float64Array(r);for(let m=0;m<r;m++)n[m]=m/(r-1);let s=new Float64Array(r-1),a=new Float64Array(r);for(let m=0;m<r-1;m++){let u=n[m+1]-n[m];s[m]=(t[m+1]-t[m])/u,m===0?a[m]=s[m]:a[m]=(s[m-1]+s[m])*.5}a[r-1]=s[r-2];for(let m=0;m<r-1;m++)if(s[m]===0)a[m]=0,a[m+1]=0;else{let u=a[m]/s[m],l=a[m+1]/s[m],h=Math.hypot(u,l);if(h>9){let c=3/h;a[m]=c*u*s[m],a[m+1]=c*l*s[m]}}if(i<=n[0]){let m=n[1]-n[0],u=(-0*t[1]+0*t[1]+0*t[0]-0*t[0]+3*m*a[1]*0+3*m*a[0]*0-2*m*a[1]*0-4*m*a[0]*0+m*a[0])/m;return t[0]+(i-n[0])*u}if(i>=n[r-1]){let m=n[r-1]-n[r-2],u=(-6*t[r-1]+6*t[r-1]+6*t[r-2]-6*t[r-2]+3*m*a[r-1]+3*m*a[r-2]-2*m*a[r-1]-4*m*a[r-2]+m*a[r-2])/m;return t[r-1]+(i-n[r-1])*u}for(let m=0;m<r-1;m++)if(i<n[m+1]){let u=n[m+1]-n[m],l=(i-n[m])/u,h=l*l,c=h*l,f=t[m],d=t[m+1],p=a[m],b=a[m+1];return-2*c*d+3*h*d+2*c*f-3*h*f+f+u*b*c+u*p*c-u*b*h-2*u*p*h+u*p*l}return t[r-1]}static cubicEasing(t,i,r,n,s){if(s<=0)return 0;if(s>=1)return 1;let a=0,m=1;for(let l=0;l<20;l++){let h=(a+m)/2;o.bezier(h,t,r)<s?a=h:m=h}let u=(a+m)/2;return o.bezier(u,i,n)}static bezier(t,i,r){let n=1-t;return 3*n*n*t*i+3*n*t*t*r+t*t*t}deepToString(t){return`${t}FloatExpression(${this.mId})`}static read(t,i){let r=t.declareId(),n=t.readInt(),s=n&65535,a=n>>16&65535,m=new Int32Array(s);for(let l=0;l<s;l++)m[l]=t.readNanIdBits();let u=null;if(a>0){u=new Float32Array(a);for(let l=0;l<a;l++)u[l]=F(t.readNanIdBits())}i.push(new o(r,m,u))}};var Wa=2**42;function se(o){return o>=Wa?o-Wa|0:Ci(o)}var jt=class o{constructor(){this.mStack=new Float32Array(128);this.mR0=0;this.mR1=0;this.mR2=0;this.mR3=0}static{this.RNG_MULT=0x5deece66dn}static{this.RNG_MASK=(1n<<48n)-1n}static{this.rngState=null}static seedRandom(e){if(e===0){o.rngState=null;return}let t=BigInt.asUintN(64,BigInt(et(e)));o.rngState=(t^o.RNG_MULT)&o.RNG_MASK}static nextRandom(){return o.rngState===null?Math.random():(o.rngState=o.rngState*o.RNG_MULT+0xbn&o.RNG_MASK,Number(o.rngState>>24n)/16777216)}static{this.OFFSET=3211264}static{this.LAST_OP=o.OFFSET+79}static{this.ID_REGION_MASK=7340032}static{this.ID_REGION_ARRAY=2097152}static isMathOperator(e){if(!Number.isNaN(e))return!1;let t=Ci(e);return(t&o.ID_REGION_MASK)===o.ID_REGION_ARRAY?!1:t>o.OFFSET&&t<=o.LAST_OP}static isMathOperatorBits(e){if(!O(e))return!1;let t=x(e);return(t&o.ID_REGION_MASK)===o.ID_REGION_ARRAY?!1:t>o.OFFSET&&t<=o.LAST_OP}eval(...e){let t=null,i,r,n=[];typeof e[0]=="number"||e[0]instanceof Float32Array||e[0]instanceof Int32Array||Array.isArray(e[0])?(i=e[0],r=e[1],n=e.slice(2)):(t=e[0],i=e[1],r=e[2],n=e.slice(3));let s=i instanceof Int32Array,a=this.mStack,m=-1;for(let u=0;u<r;u++){let l=i[u],h=s?l|0:et(l);if(O(h)){let c=x(h);(c&o.ID_REGION_MASK)===o.ID_REGION_ARRAY?a[++m]=Wa+c:m=this.opEval(m,c,a,t,n)}else a[++m]=s?F(h):l}return m>=0?a[m]:0}opEval(e,t,i,r,n){let s=o.OFFSET;switch(t){case s+1:return i[e-1]+=i[e],e-1;case s+2:return i[e-1]-=i[e],e-1;case s+3:return i[e-1]*=i[e],e-1;case s+4:return i[e-1]/=i[e],e-1;case s+5:return i[e-1]%=i[e],e-1;case s+6:return i[e-1]=Math.min(i[e-1],i[e]),e-1;case s+7:return i[e-1]=Math.max(i[e-1],i[e]),e-1;case s+8:return i[e-1]=Math.pow(i[e-1],i[e]),e-1;case s+9:return i[e]=Math.sqrt(i[e]),e;case s+10:return i[e]=Math.abs(i[e]),e;case s+11:return i[e]=Math.sign(i[e]),e;case s+12:return i[e-1]=Math.abs(i[e-1])*Math.sign(i[e]),e-1;case s+13:return i[e]=Math.exp(i[e]),e;case s+14:return i[e]=Math.floor(i[e]),e;case s+15:return i[e]=Math.log10(i[e]),e;case s+16:return i[e]=Math.log(i[e]),e;case s+17:return i[e]=Math.round(i[e]),e;case s+18:return i[e]=Math.sin(i[e]),e;case s+19:return i[e]=Math.cos(i[e]),e;case s+20:return i[e]=Math.tan(i[e]),e;case s+21:return i[e]=Math.asin(i[e]),e;case s+22:return i[e]=Math.acos(i[e]),e;case s+23:return i[e]=Math.atan(i[e]),e;case s+24:return i[e-1]=Math.atan2(i[e-1],i[e]),e-1;case s+25:return i[e-2]=i[e]+i[e-1]*i[e-2],e-2;case s+26:{let a=i[e];return i[e-2]=a>0?i[e-1]:i[e-2],e-2}case s+27:return i[e-2]=Math.min(Math.max(i[e-2],i[e]),i[e-1]),e-2;case s+28:return i[e]=Math.pow(i[e],1/3),e;case s+29:return i[e]=i[e]*57.29578,e;case s+30:return i[e]=i[e]*.017453292,e;case s+31:return i[e]=Math.ceil(i[e]),e;case s+32:{let a=se(i[e-1]);return r&&(i[e-1]=r.getFloatValue(a,Math.trunc(i[e]))),e-1}case s+33:{let a=se(i[e]);if(r){let m=r.getFloats(a),u=m[0];for(let l=1;l<m.length;l++)u=Math.max(u,m[l]);i[e]=u}return e}case s+34:{let a=se(i[e]);if(r){let m=r.getFloats(a);if(m.length>0){let u=m[0];for(let l=1;l<m.length;l++)u=Math.min(u,m[l]);i[e]=u}}return e}case s+35:{let a=se(i[e]);if(r){let m=r.getFloats(a),u=0;for(let l=0;l<m.length;l++)u+=m[l];i[e]=u}return e}case s+36:{let a=se(i[e]);if(r){let m=r.getFloats(a),u=0;for(let l=0;l<m.length;l++)u+=m[l];i[e]=m.length>0?u/m.length:0}return e}case s+37:{let a=se(i[e]);return r&&(i[e]=r.getListLength(a)),e}case s+38:{let a=se(i[e-1]);if(r){let m=r.getFloats(a);i[e-1]=m?yt.splineInterp(m,i[e]):0}return e-1}case s+39:return i[++e]=o.nextRandom(),e;case s+40:return o.seedRandom(i[e]),e-1;case s+41:{let a=Math.trunc(i[e]);return a=a<<13^a,i[e]=1-(a*(a*a*15731+789221)+1376312589&2147483647)/1073741800,e}case s+42:return i[e]=Math.random()*(i[e]-i[e-1])+i[e-1],e;case s+43:return i[e-1]=i[e-1]*i[e-1]+i[e]*i[e],e-1;case s+44:return i[e-1]=i[e-1]>i[e]?1:0,e-1;case s+45:return i[e]=i[e]*i[e],e;case s+46:return i[e+1]=i[e],e+1;case s+47:return i[e-1]=Math.hypot(i[e-1],i[e]),e-1;case s+48:{let a=i[e-1];return i[e-1]=i[e],i[e]=a,e}case s+49:{let a=i[e];return i[e-2]=i[e-2]+(i[e-1]-i[e-2])*a,e-2}case s+50:{let a=i[e-2],m=i[e-1],u=i[e];if(a<u)i[e-2]=0;else if(a>m)i[e-2]=1;else{let l=(a-u)/(m-u);i[e-2]=l*l*(3-2*l)}return e-2}case s+51:return i[e]=Math.log(i[e])/Math.log(2),e;case s+52:return i[e]=1/i[e],e;case s+53:return i[e]=i[e]-Math.trunc(i[e]),e;case s+54:{let a=i[e]*2,m=i[e-1]%a;return i[e-1]=m<i[e]?m:a-m,e-1}case s+55:return e;case s+56:return this.mR0=i[e],e-1;case s+57:return this.mR1=i[e],e-1;case s+58:return this.mR2=i[e],e-1;case s+59:return this.mR3=i[e],e-1;case s+60:return i[++e]=this.mR0,e;case s+61:return i[++e]=this.mR1,e;case s+62:return i[++e]=this.mR2,e;case s+63:return i[++e]=this.mR3,e;case s+70:return i[++e]=n.length>0?n[0]:0,e;case s+71:return i[++e]=n.length>1?n[1]:0,e;case s+72:return i[++e]=n.length>2?n[2]:0,e;case s+73:return i[e]=-i[e],e;case s+74:{let a=i[e-4],m=i[e-3],u=i[e-2],l=i[e-1],h=i[e];return i[e-4]=yt.cubicEasing(a,m,u,l,h),e-4}case s+75:{let a=se(i[e-1]),m=i[e]-Math.floor(i[e]),u=m<0?m+1:m;if(r){let l=r.getFloats(a);i[e-1]=l?yt.splineInterp(l,u):0}return e-1}case s+76:{let a=se(i[e-1]),m=Math.trunc(i[e]),u=0;if(r)for(let l=0;l<=m;l++)u+=r.getFloatValue(a,l);return i[e-1]=u,e-1}case s+77:{let a=se(i[e-1]),m=se(i[e]);if(r){let u=r.getFloats(a),l=r.getFloats(m),h=0;for(let c=0;c<u.length;c++)h+=u[c]*l[c];i[e-1]=h}return e-1}case s+78:{let a=se(i[e]);if(r){let m=r.getFloats(a),u=0;for(let l=0;l<m.length;l++)u+=m[l]*m[l];i[e]=u}return e}case s+79:{let a=se(i[e-1]);if(r){let m=r.getFloats(a),u=i[e]*(m.length-1),l=Math.trunc(u);if(l<0)i[e-1]=m[0];else if(l>=m.length-1)i[e-1]=m[m.length-1];else{let h=u-l;i[e-1]=m[l]+h*(m[l+1]-m[l])}}return e-1}}return e}};var Xr=class{constructor(e){this.mStartV=0;this.mStartPos=0;this.mStartTime=0;this.mEndV=0;this.mEndPos=0;this.mEndTime=0;this.mDeltaV=0;this.mDeltaT=0;this.mStage=e}setUp(e,t,i,r,n,s){this.mStartV=e,this.mStartPos=t,this.mStartTime=i,this.mEndV=r,this.mEndTime=s,this.mEndPos=n,this.mDeltaV=this.mEndV-this.mStartV,this.mDeltaT=this.mEndTime-this.mStartTime}getPos(e){let t=e-this.mStartTime,i=t/this.mDeltaT,r=this.mStartV+this.mDeltaV*i;return t*(this.mStartV+r)/2+this.mStartPos}getVel(e){let i=(e-this.mStartTime)/(this.mEndTime-this.mStartTime);return this.mStartV+this.mDeltaV*i}},Ho=class{constructor(){this.mStartPos=0;this.mStartV=0;this.mEndPos=0;this.mDuration=0;this.mStage=[new Xr(1),new Xr(2),new Xr(3)];this.mNumberOfStages=0;this.mEasing=null;this.mEasingAdapterDistance=0;this.mEasingAdapterA=0;this.mEasingAdapterB=0;this.mOneDimension=!0;this.mTotalEasingDuration=0}getDuration(){return this.mEasing!==null?this.mTotalEasingDuration:this.mDuration}getV(e){if(this.mEasing===null){for(let i=0;i<this.mNumberOfStages;i++)if(this.mStage[i].mEndTime>e)return this.mStage[i].getVel(e);return 0}let t=this.mNumberOfStages-1;for(let i=0;i<t;i++)if(this.mStage[i].mEndTime>e)return this.mStage[i].getVel(e);return this.getEasingDiff(e-this.mStage[t].mStartTime)}getPos(e){if(this.mEasing===null){for(let r=0;r<this.mNumberOfStages;r++)if(this.mStage[r].mEndTime>e)return this.mStage[r].getPos(e);return this.mEndPos}let t=this.mNumberOfStages-1;for(let r=0;r<t;r++)if(this.mStage[r].mEndTime>e)return this.mStage[r].getPos(e);let i=this.getEasing(e-this.mStage[t].mStartTime);return i+=this.mStage[t].mStartPos,i}config(e,t,i,r,n,s,a){let m=e,u=i;m===t&&(m+=1),this.mStartPos=m,this.mEndPos=t,a!==null?this.mEasing=a.clone():this.mEasing=null;let l=Math.sign(t-m),h=s*l,c=n*l;u===0&&(u=1e-4*l),this.mStartV=u,this.rampDown(m,t,u,r)||this.mOneDimension&&this.cruseThenRampDown(m,t,u,r,c,h)||this.rampUpRampDown(m,t,u,c,h,r)||this.rampUpCruseRampDown(m,t,u,c,h,r),this.mOneDimension&&this.configureEasingAdapter()}rampDown(e,t,i,r){let n=2*((t-e)/i);return n>0&&n<=r?(this.mNumberOfStages=1,this.mStage[0].setUp(i,e,0,0,t,n),this.mDuration=n,!0):!1}cruseThenRampDown(e,t,i,r,n,s){let a=i/n,m=i*a/2,u=t-e-m,l=u/i,h=l+a;return h>0&&h<r?(this.mNumberOfStages=2,this.mStage[0].setUp(i,e,0,i,u,l),this.mStage[1].setUp(i,e+u,l,0,t,l+a),this.mDuration=l+a,!0):!1}rampUpRampDown(e,t,i,r,n,s){let a=Math.sign(r)*Math.sqrt(r*(t-e)+i*i/2);if(n/a>1){let m=(a-i)/r,u=(a+i)*m/2+e,l=a/r;return this.mNumberOfStages=2,this.mStage[0].setUp(i,e,0,a,u,m),this.mStage[1].setUp(a,u,m,0,t,l+m),this.mDuration=l+m,!(this.mDuration>s||this.mDuration<s/2&&(m=this.mDuration/2,l=m,a=(2*(t-e)/m-i)/2,u=(a+i)*m/2+e,this.mNumberOfStages=2,this.mStage[0].setUp(i,e,0,a,u,m),this.mStage[1].setUp(a,u,m,0,t,l+m),this.mDuration=l+m,this.mDuration>s))}return!1}rampUpCruseRampDown(e,t,i,r,n,s){let a=s/3,m=a*2,u=t-e,l=m-a,h=s-m,c=(2*u-i*a)/(a+2*l+h);this.mDuration=s;let f=(i+c)*a/2,d=(c+c)*(m-a)/2;this.mNumberOfStages=3,this.mStage[0].setUp(i,e,0,c,e+f,a),this.mStage[1].setUp(c,e+f,a,c,e+f+d,m),this.mStage[2].setUp(c,e+f+d,m,0,t,s),this.mDuration=s}getEasing(e){let t=e*e*this.mEasingAdapterA+e*this.mEasingAdapterB;return t>1?this.mEasingAdapterDistance:this.mEasing.get(t)*this.mEasingAdapterDistance}getEasingDiff(e){let t=e*e*this.mEasingAdapterA+e*this.mEasingAdapterB;return t>1?0:this.mEasing.getDiff(t)*this.mEasingAdapterDistance*(e*this.mEasingAdapterA+this.mEasingAdapterB)}configureEasingAdapter(){if(this.mEasing===null)return;let e=this.mNumberOfStages-1,t=this.mStage[e].mStartV,i=this.mStage[e].mEndPos-this.mStage[e].mStartPos,r=this.mEasing.getDiff(0);this.mEasingAdapterB=t/(r*i),this.mEasingAdapterA=1-this.mEasingAdapterB,this.mEasingAdapterDistance=i;let n=(Math.sqrt(4*this.mEasingAdapterA+this.mEasingAdapterB*this.mEasingAdapterB)-this.mEasingAdapterB)/(2*this.mEasingAdapterA);this.mTotalEasingDuration=n+this.mStage[e].mStartTime}};var Ht=class o extends D{constructor(t,i,r,n,s,a,m,u,l,h){super();this.mMaxTime=1;this.mMaxAcceleration=5;this.mMaxVelocity=7;this.mWrapMode=!1;this.mTouchDown=!1;this.mEasingToStop=!1;this.mValue=0;this.mValueAtDown=0;this.mDownTouchValue=0;this.mCurrentValue=NaN;this.mUnmodified=!0;this.mLastValue=0;this.mMaxAtDown=NaN;this.mMinAtDown=NaN;this.mTouchUpTime=0;this.mLastChange=NaN;this.mLastCalculatedValue=NaN;this.mPreCalcValue=null;this.mExp=new jt;this.mEasyTouch=new Ho;this.mScrLeft=0;this.mScrRight=0;this.mScrTop=0;this.mScrBottom=0;this.mComponent=null;this.mId=t,this.mSrcExp=i,this.mDefValueBits=r,this.mOutDefValue=O(r)?0:F(r),this.mMode=o.STOP_ABSOLUTE_POS===u?1:0,this.mMaxBits=s,this.mOutMax=O(s)?0:F(s),this.mTouchEffects=a,this.mVelocityId=m,this.mStopSpec=l,this.mOutStopSpec=new Float32Array(l.length);for(let c=0;c<l.length;c++)this.mOutStopSpec[c]=O(l[c])?0:F(l[c]);O(n)&&x(n)===0?(this.mWrapMode=!0,this.mMinBits=et(0),this.mOutMin=0):(this.mMinBits=n,this.mOutMin=O(n)?0:F(n)),this.mStopMode=u,h!==null&&h.length>=4&&h[0]===0&&(this.mMaxTime=h[1],this.mMaxAcceleration=h[2],this.mMaxVelocity=h[3])}static{this.OP_CODE=157}static{this.STOP_GENTLY=0}static{this.STOP_INSTANTLY=1}static{this.STOP_ENDS=2}static{this.STOP_NOTCHES_EVEN=3}static{this.STOP_NOTCHES_PERCENTS=4}static{this.STOP_NOTCHES_ABSOLUTE=5}static{this.STOP_ABSOLUTE_POS=6}static{this.STOP_NOTCHES_SINGLE_EVEN=7}write(t){}registerListening(t){O(this.mMaxBits)&&t.listensTo(x(this.mMaxBits),this),O(this.mMinBits)&&t.listensTo(x(this.mMinBits),this),O(this.mDefValueBits)&&t.listensTo(x(this.mDefValueBits),this),this.mComponent===null&&t.addTouchListener(this);for(let i of this.mSrcExp)O(i)&&!jt.isMathOperatorBits(i)&&!this.isDataVariableBits(i)&&t.listensTo(x(i),this);for(let i of this.mStopSpec)O(i)&&t.listensTo(x(i),this)}isDataVariableBits(t){return O(t)?(x(t)&7340032)===2097152:!1}updateVariables(t){(this.mPreCalcValue===null||this.mPreCalcValue.length!==this.mSrcExp.length)&&(this.mPreCalcValue=new Int32Array(this.mSrcExp.length)),this.mOutStopSpec.length!==this.mStopSpec.length&&(this.mOutStopSpec=new Float32Array(this.mStopSpec.length)),O(this.mMaxBits)&&(this.mOutMax=t.getFloat(x(this.mMaxBits))),O(this.mMinBits)&&(this.mOutMin=t.getFloat(x(this.mMinBits))),O(this.mDefValueBits)&&(this.mOutDefValue=t.getFloat(x(this.mDefValueBits)));for(let i=0;i<this.mSrcExp.length;i++){let r=this.mSrcExp[i];O(r)&&!jt.isMathOperatorBits(r)&&!this.isDataVariableBits(r)?this.mPreCalcValue[i]=et(t.getFloat(x(r))):this.mPreCalcValue[i]=r}for(let i=0;i<this.mStopSpec.length;i++){let r=this.mStopSpec[i];O(r)?this.mOutStopSpec[i]=t.getFloat(x(r)):this.mOutStopSpec[i]=F(r)}}wrap(t){return this.mWrapMode&&(t=t%this.mOutMax,t<0&&(t+=this.mOutMax)),t}getStopPosition(t,i){let r=t+i/2;this.mWrapMode?(t=this.wrap(t),r=t+i/2):r=Math.max(Math.min(r,this.mOutMax),this.mOutMin);let n=this.mWrapMode?0:this.mOutMin;switch(this.mStopMode){case o.STOP_ENDS:return t+i>(this.mOutMax+n)/2?this.mOutMax:n;case o.STOP_INSTANTLY:return t;case o.STOP_NOTCHES_EVEN:case o.STOP_NOTCHES_SINGLE_EVEN:{let s=Math.trunc(this.mOutStopSpec[0]),m=((this.mOutStopSpec.length>1?this.mOutStopSpec[1]:this.mOutMax)-n)/s,u=n+m*Math.trunc(.5+(r-this.mOutMin)/m);return this.mStopMode===o.STOP_NOTCHES_SINGLE_EVEN&&(u=Math.min(this.mMaxAtDown,u),u=Math.max(this.mMinAtDown,u)),this.mWrapMode||(u=Math.max(Math.min(u,this.mOutMax),n)),u}case o.STOP_NOTCHES_PERCENTS:{let s=n,a=Math.abs(this.mOutMin-r);for(let m=0;m<this.mStopSpec.length;m++){let u=this.mOutMin+this.mOutStopSpec[m]*(this.mOutMax-this.mOutMin),l=Math.abs(u-r);a>l&&(a=l,s=u)}return s}case o.STOP_NOTCHES_ABSOLUTE:{let s=this.mOutMin,a=Math.abs(this.mOutMin-r);for(let m=0;m<this.mStopSpec.length;m++){let u=Math.abs(this.mOutStopSpec[m]-r);a>u&&(a=u,s=this.mOutStopSpec[m])}return s}case o.STOP_GENTLY:default:return r}}haptic(t){let i=this.mTouchEffects&255;(this.mTouchEffects&32768)!==0&&(i=t.getInteger(this.mTouchEffects&32767)),t.hapticEffect(i)}crossNotchCheck(t){let i=this.mLastValue,r=this.mCurrentValue;this.mLastValue=r;let n=this.mWrapMode?0:this.mOutMin,s=this.mOutMax;switch(this.mStopMode){case o.STOP_ENDS:(n-i)*(s-i)<0!=(n-r)*(s-r)<0&&this.haptic(t);break;case o.STOP_INSTANTLY:this.haptic(t);break;case o.STOP_NOTCHES_EVEN:case o.STOP_NOTCHES_SINGLE_EVEN:{let a=Math.trunc(this.mOutStopSpec[0]),m=(s-n)/a;Math.trunc((i-n)/m)!==Math.trunc((r-n)/m)&&this.haptic(t);break}case o.STOP_NOTCHES_PERCENTS:for(let a=0;a<this.mStopSpec.length;a++){let m=this.mOutMin+this.mOutStopSpec[a]*(this.mOutMax-this.mOutMin);(i-m)*(r-m)<0&&this.haptic(t)}break;case o.STOP_NOTCHES_ABSOLUTE:for(let a=0;a<this.mStopSpec.length;a++){let m=this.mOutStopSpec[a];(i-m)*(r-m)<0&&this.haptic(t)}break}}updateBounds(t){let i=this.mComponent;if(i!==null)if(t.getTouchVersion()===1)this.mScrLeft=0,this.mScrTop=0,this.mScrRight=i.getWidth(),this.mScrBottom=i.getHeight();else{let r=i.getX(),n=i.getY(),s=i.getWidth(),a=i.getHeight(),m=i.getParent();for(;m!==null;)r+=m.getX(),n+=m.getY(),m=m.getParent();this.mScrLeft=r,this.mScrTop=n,this.mScrRight=s+r,this.mScrBottom=a+n}}apply(t){if(this.updateBounds(t),this.mUnmodified){this.mCurrentValue=this.mOutDefValue,t.loadFloat(this.mId,this.wrap(this.mCurrentValue));return}if(this.mEasingToStop){let i=t.getAnimationTime()-this.mTouchUpTime,r=this.mEasyTouch.getPos(i);this.mCurrentValue=r,this.mWrapMode?r=this.wrap(r):r=Math.min(Math.max(r,this.mOutMin),this.mOutMax),t.loadFloat(this.mId,r),this.mEasyTouch.getDuration()<i&&(this.mEasingToStop=!1),this.crossNotchCheck(t),t.needsRepaint();return}if(this.mTouchDown&&this.mPreCalcValue){let i=this.mExp.eval(t.getCollectionsAccess(),this.mPreCalcValue,this.mPreCalcValue.length);this.mMode===0&&(i=this.mValueAtDown+(i-this.mDownTouchValue)),this.mWrapMode?i=this.wrap(i):i=Math.min(Math.max(i,this.mOutMin),this.mOutMax),this.mCurrentValue=i}this.crossNotchCheck(t),this.mStopMode===o.STOP_NOTCHES_SINGLE_EVEN&&(this.mCurrentValue=Math.min(this.mMaxAtDown,this.mCurrentValue),this.mCurrentValue=Math.max(this.mMinAtDown,this.mCurrentValue)),this.mWrapMode||(Number.isNaN(this.mOutMin)||(this.mCurrentValue=Math.max(this.mCurrentValue,this.mOutMin)),Number.isNaN(this.mOutMax)||(this.mCurrentValue=Math.min(this.mCurrentValue,this.mOutMax))),t.loadFloat(this.mId,this.wrap(this.mCurrentValue))}touchDown(t,i,r){if(i>=this.mScrLeft&&i<=this.mScrRight&&r>=this.mScrTop&&r<=this.mScrBottom){if(this.mEasingToStop=!1,this.mTouchDown=!0,this.mUnmodified=!1,this.mMode===0&&this.mPreCalcValue){if(this.mValueAtDown=t.getFloat(this.mId),o.STOP_NOTCHES_SINGLE_EVEN===this.mStopMode){let n=this.mWrapMode?0:this.mOutMin,s=Math.trunc(this.mOutStopSpec[0]),m=((this.mOutStopSpec.length>1?this.mOutStopSpec[1]:this.mOutMax)-n)/s,u=this.mValueAtDown;this.mMaxAtDown=u+m,this.mMinAtDown=u-m}this.mDownTouchValue=this.mExp.eval(t.getCollectionsAccess(),this.mPreCalcValue,this.mPreCalcValue.length)}t.needsRepaint()}}touchDrag(t,i,r){this.mTouchDown&&(this.apply(t),t.needsRepaint())}touchUp(t,i,r,n,s){if(!this.mTouchDown)return;this.mTouchDown=!1;let a=1e-4;if(this.mStopMode===o.STOP_INSTANTLY||!this.mPreCalcValue)return;let m=this.mExp.eval(t.getCollectionsAccess(),this.mPreCalcValue,this.mPreCalcValue.length);if(t.getTouchVersion()===1){for(let d=0;d<this.mSrcExp.length;d++)if(O(this.mSrcExp[d])){let p=x(this.mSrcExp[d]);p===st.ID_TOUCH_POS_X?this.mPreCalcValue[d]=et(F(this.mPreCalcValue[d])+n*a):p===st.ID_TOUCH_POS_Y&&(this.mPreCalcValue[d]=et(F(this.mPreCalcValue[d])+s*a))}}else for(let d=0;d<this.mSrcExp.length;d++)if(O(this.mSrcExp[d])){let p=x(this.mSrcExp[d]);p===st.ID_TOUCH_POS_X?this.mPreCalcValue[d]=et(i+n*a):p===st.ID_TOUCH_POS_Y&&(this.mPreCalcValue[d]=et(r+s*a))}let l=(this.mExp.eval(t.getCollectionsAccess(),this.mPreCalcValue,this.mPreCalcValue.length)-m)/a,h=t.getFloat(this.mId);this.mTouchUpTime=t.getAnimationTime();let c=this.getStopPosition(h,l),f=Math.min(2,this.mMaxTime*Math.abs(c-h)/(2*this.mMaxVelocity));this.mEasyTouch.config(h,c,l,f,this.mMaxAcceleration,this.mMaxVelocity,null),this.mEasingToStop=!0,t.needsRepaint()}setComponent(t){if(this.mComponent=t,this.mComponent!==null)try{this.mComponent.getRoot().setHasTouchListeners(!0)}catch{}}deepToString(t){return`${t}TouchExpression(${this.mId})`}static read(t,i){let r=t.readId(),n=t.readNanIdBits(),s=t.readNanIdBits(),a=t.readNanIdBits(),m=t.readNanIdBits(),u=t.readInt(),h=t.readInt()&65535,c=new Int32Array(h);for(let y=0;y<h;y++)c[y]=t.readNanIdBits();let f=t.readInt(),d=f&65535,p=f>>16,b=new Int32Array(d);for(let y=0;y<d;y++)b[y]=t.readNanIdBits();let g=t.readInt(),C=g>0?new Float32Array(g):null;for(let y=0;y<g;y++)C[y]=F(t.readNanIdBits());i.push(new o(r,c,n,s,a,u,m,p,b,C))}};var ke=class o{constructor(e,t,i,r,n,s=o.VISIBLE){this.mAllowsAnimation=!0;this.mId=e,this.mX=t,this.mY=i,this.mW=r,this.mH=n,this.mVisibility=s}static{this.GONE=0}static{this.VISIBLE=1}static{this.INVISIBLE=2}getX(){return this.mX}setX(e){this.mX=e}getY(){return this.mY}setY(e){this.mY=e}getW(){return this.mW}setW(e){this.mW=e}getH(){return this.mH}setH(e){this.mH=e}getVisibility(){return this.mVisibility}setVisibility(e){this.mVisibility=e}getAllowsAnimation(){return this.mAllowsAnimation}setAllowsAnimation(e){this.mAllowsAnimation=e}copyFrom(e){this.mX=e.mX,this.mY=e.mY,this.mW=e.mW,this.mH=e.mH,this.mVisibility=e.mVisibility}same(e){return this.mX===e.mX&&this.mY===e.mY&&this.mW===e.mW&&this.mH===e.mH&&this.mVisibility===e.mVisibility}isGone(){return this.mVisibility>>4>0?(this.mVisibility&16)===16:this.mVisibility===o.GONE}isVisible(){return this.mVisibility>>4>0?(this.mVisibility&32)===32:this.mVisibility===o.VISIBLE}isInvisible(){return this.mVisibility>>4>0?(this.mVisibility&64)===64:this.mVisibility===o.INVISIBLE}clearVisibilityOverride(){this.mVisibility=this.mVisibility&15}addVisibilityOverride(e){let t=this.mVisibility&15;t+=e,(t&128)===128&&(t=t&15),this.mVisibility=t}};function Su(o){switch(o&255){case 0:return 0;case 1:return 1;case 2:return 2;case 3:return 3;case 4:return 4;case 5:return 5;case 6:return 6;case 7:return 7;default:return 0}}var ue=class o extends D{static{this.OP_CODE=14}static{this.DEFAULT=new o(-1,300,mt.CUBIC_STANDARD,300,mt.CUBIC_STANDARD,0,1)}static{this.DISABLED=new o(0,0,mt.CUBIC_STANDARD,0,mt.CUBIC_STANDARD,0,1)}constructor(e=-1,t=300,i=mt.CUBIC_STANDARD,r=300,n=mt.CUBIC_STANDARD,s=0,a=1){super(),this.mAnimationId=e,this.mMotionDuration=t,this.mMotionEasingType=i,this.mVisibilityDuration=r,this.mVisibilityEasingType=n,this.mEnterAnimation=s,this.mExitAnimation=a}isAnimationEnabled(){return this.mAnimationId!==0}getAnimationId(){return this.mAnimationId}getMotionDuration(){return this.mMotionDuration}getMotionEasingType(){return this.mMotionEasingType}getVisibilityDuration(){return this.mVisibilityDuration}getVisibilityEasingType(){return this.mVisibilityEasingType}getEnterAnimation(){return this.mEnterAnimation}getExitAnimation(){return this.mExitAnimation}write(e){e.start(o.OP_CODE),e.writeInt(this.mAnimationId),e.writeFloat(this.mMotionDuration),e.writeInt(this.mMotionEasingType),e.writeFloat(this.mVisibilityDuration),e.writeInt(this.mVisibilityEasingType),e.writeInt(this.mEnterAnimation),e.writeInt(this.mExitAnimation)}apply(e){}deepToString(e){return`${e}AnimationSpec(id=${this.mAnimationId}, motion=${this.mMotionDuration}ms, vis=${this.mVisibilityDuration}ms)`}static read(e,t){let i=e.readId(),r=e.readFloat(),n=e.readInt(),s=e.readFloat(),a=e.readInt(),m=e.readInt(),u=e.readInt(),l=Su(m),h=Su(u);((m&255)===8||(u&255)===8)&&(e.readId(),e.readId());let c=new o(i,r,n,s,a,l,h);t.push(c)}};var Uo=class{constructor(e,t,i,r,n,s,a=0,m=1,u=mt.CUBIC_STANDARD,l=mt.CUBIC_ACCELERATE){this.mP=0;this.mVp=0;this.paintBundle=new ot;this.mStartTime=e,this.mComponent=t,this.mOriginal=i,this.mTarget=r,this.mDuration=n,this.mDurationVisibilityChange=s,this.mEnterAnimation=a,this.mExitAnimation=m,this.mMotionEasingType=u,this.mVisibilityEasingType=l,this.mMotionEasing=new Jt(u),this.mVisibilityEasing=new Jt(l),t.mVisibility=r.getVisibility()}update(e){let t=Math.max(0,e-this.mStartTime),i=this.mDuration>0?Math.min(1,t/this.mDuration):1,r=this.mDurationVisibilityChange>0?Math.min(1,t/this.mDurationVisibilityChange):1;this.mP=this.mMotionEasing.get(i),this.mVp=this.mVisibilityEasing.get(r)}apply(e){let t=e.mClock?.millis()??Date.now();this.update(t),this.mComponent.setX(this.getX()),this.mComponent.setY(this.getY()),this.mComponent.setWidth(this.getWidth()),this.mComponent.setHeight(this.getHeight()),typeof this.mComponent.updateVariables=="function"&&this.mComponent.updateVariables(e)}paint(e){this.apply(e.getContext());let t=this.mOriginal.getVisibility(),i=this.mTarget.getVisibility();if(t!==i)if(this.mTarget.isGone())switch(this.mExitAnimation){case 1:{e.save(),e.savePaint(),this.paintBundle.reset(),this.paintBundle.setColor(Math.max(0,Math.min(1,1-this.mVp)),0,0,0),e.applyPaint(this.paintBundle),e.saveLayer(this.mComponent.getX(),this.mComponent.getY(),this.mComponent.getWidth(),this.mComponent.getHeight()),this.mComponent.paintingComponent(e),e.restore(),e.restorePaint(),e.restore();break}case 2:{let r=this.mComponent.getParent()?.getWidth()??e.getContext().mWidth;e.save(),e.translate(-this.mVp*r,0),e.saveLayer(this.mComponent.getX(),this.mComponent.getY(),this.mComponent.getWidth(),this.mComponent.getHeight()),this.mComponent.paintingComponent(e),e.restore(),e.restore();break}case 3:{let r=this.mComponent.getParent()?.getWidth()??e.getContext().mWidth;e.save(),e.translate(this.mVp*r,0),e.saveLayer(this.mComponent.getX(),this.mComponent.getY(),this.mComponent.getWidth(),this.mComponent.getHeight()),this.mComponent.paintingComponent(e),e.restore(),e.restore();break}case 4:{let r=this.mComponent.getParent()?.getHeight()??e.getContext().mHeight;e.save(),e.translate(0,-this.mVp*r),e.saveLayer(this.mComponent.getX(),this.mComponent.getY(),this.mComponent.getWidth(),this.mComponent.getHeight()),this.mComponent.paintingComponent(e),e.restore(),e.restore();break}case 5:{let r=this.mComponent.getParent()?.getHeight()??e.getContext().mHeight;e.save(),e.translate(0,this.mVp*r),e.saveLayer(this.mComponent.getX(),this.mComponent.getY(),this.mComponent.getWidth(),this.mComponent.getHeight()),this.mComponent.paintingComponent(e),e.restore(),e.restore();break}default:{e.save(),e.savePaint(),this.paintBundle.reset(),this.paintBundle.setColor(Math.max(0,Math.min(1,1-this.mVp)),0,0,0),e.applyPaint(this.paintBundle),e.saveLayer(this.mComponent.getX(),this.mComponent.getY(),this.mComponent.getWidth(),this.mComponent.getHeight()),this.mComponent.paintingComponent(e),e.restore(),e.restorePaint(),e.restore();break}}else if(this.mOriginal.isGone()&&!this.mTarget.isGone())switch(this.mEnterAnimation){case 6:{let r=this.mTarget.getX()+this.mTarget.getW()/2,n=this.mTarget.getY()+this.mTarget.getH()/2;e.save(),e.savePaint(),e.matrixRotate(this.mVp*360,r,n),e.matrixScale(this.mVp,this.mVp,r,n),this.paintBundle.reset(),this.paintBundle.setColor(Math.max(0,Math.min(1,this.mVp)),0,0,0),e.applyPaint(this.paintBundle),e.saveLayer(this.mComponent.getX(),this.mComponent.getY(),this.mComponent.getWidth(),this.mComponent.getHeight()),this.mComponent.paintingComponent(e),e.restore(),e.restorePaint(),e.restore();break}case 0:{e.save(),e.savePaint(),this.paintBundle.reset(),this.paintBundle.setColor(Math.max(0,Math.min(1,this.mVp)),0,0,0),e.applyPaint(this.paintBundle),e.saveLayer(this.mComponent.getX(),this.mComponent.getY(),this.mComponent.getWidth(),this.mComponent.getHeight()),this.mComponent.paintingComponent(e),e.restore(),e.restorePaint(),e.restore();break}case 2:{let r=this.mComponent.getParent()?.getWidth()??e.getContext().mWidth;e.save(),e.translate((1-this.mVp)*r,0),e.saveLayer(this.mComponent.getX(),this.mComponent.getY(),this.mComponent.getWidth(),this.mComponent.getHeight()),this.mComponent.paintingComponent(e),e.restore(),e.restore();break}case 3:{let r=this.mComponent.getParent()?.getWidth()??e.getContext().mWidth;e.save(),e.translate(-(1-this.mVp)*r,0),e.saveLayer(this.mComponent.getX(),this.mComponent.getY(),this.mComponent.getWidth(),this.mComponent.getHeight()),this.mComponent.paintingComponent(e),e.restore(),e.restore();break}case 4:{let r=this.mComponent.getParent()?.getHeight()??e.getContext().mHeight;e.save(),e.translate(0,(1-this.mVp)*r),e.saveLayer(this.mComponent.getX(),this.mComponent.getY(),this.mComponent.getWidth(),this.mComponent.getHeight()),this.mComponent.paintingComponent(e),e.restore(),e.restore();break}case 5:{let r=this.mComponent.getParent()?.getHeight()??e.getContext().mHeight;e.save(),e.translate(0,-(1-this.mVp)*r),e.saveLayer(this.mComponent.getX(),this.mComponent.getY(),this.mComponent.getWidth(),this.mComponent.getHeight()),this.mComponent.paintingComponent(e),e.restore(),e.restore();break}default:{this.mComponent.paintingComponent(e);break}}else this.mComponent.paintingComponent(e);else this.mTarget.isGone()||this.mComponent.paintingComponent(e);this.mP>=1&&this.mVp>=1&&(this.mComponent.mVisibility=this.mTarget.getVisibility(),this.mComponent.setX(this.mTarget.getX()),this.mComponent.setY(this.mTarget.getY()),this.mComponent.setWidth(this.mTarget.getW()),this.mComponent.setHeight(this.mTarget.getH()))}isDone(){return this.mP>=1&&this.mVp>=1}getX(){return this.mOriginal.getX()*(1-this.mP)+this.mTarget.getX()*this.mP}getY(){return this.mOriginal.getY()*(1-this.mP)+this.mTarget.getY()*this.mP}getWidth(){return this.mOriginal.getW()*(1-this.mP)+this.mTarget.getW()*this.mP}getHeight(){return this.mOriginal.getH()*(1-this.mP)+this.mTarget.getH()*this.mP}getVisibility(){return this.mOriginal.getVisibility()===this.mTarget.getVisibility()?1:this.mTarget.isGone()?1-this.mVp:this.mVp}updateTarget(e,t,i){let r=this.getX(),n=this.getY(),s=this.getWidth(),a=this.getHeight();this.mOriginal.setX(r),this.mOriginal.setY(n),this.mOriginal.setW(s),this.mOriginal.setH(a);let m=t.getX(),u=t.getY(),l=t.getW(),h=t.getH(),c=t.getVisibility();(this.mTarget.getX()!==m||this.mTarget.getY()!==u||this.mTarget.getW()!==l||this.mTarget.getH()!==h||this.mTarget.getVisibility()!==c)&&(this.mTarget.setX(m),this.mTarget.setY(u),this.mTarget.setW(l),this.mTarget.setH(h),this.mTarget.setVisibility(c),this.mStartTime=i,this.mP=0,this.mVp=0)}getOriginal(){return this.mOriginal}getTarget(){return this.mTarget}};var tt=class o{static{this.GONE=0}static{this.VISIBLE=1}static{this.INVISIBLE=2}static{this.OVERRIDE_GONE=16}static{this.OVERRIDE_VISIBLE=32}static{this.OVERRIDE_INVISIBLE=64}static{this.CLEAR_OVERRIDE=128}static isGone(e){return e>>4>0?(e&o.OVERRIDE_GONE)===o.OVERRIDE_GONE:e===o.GONE}static isVisible(e){return e>>4>0?(e&o.OVERRIDE_VISIBLE)===o.OVERRIDE_VISIBLE:e===o.VISIBLE}static isInvisible(e){return e>>4>0?(e&o.OVERRIDE_INVISIBLE)===o.OVERRIDE_INVISIBLE:e===o.INVISIBLE}static hasOverride(e){return e>>4>0}static clearOverride(e){return e&15}static add(e,t){let i=(e&15)+t;return(i&o.CLEAR_OVERRIDE)===o.CLEAR_OVERRIDE&&(i=i&15),i}},vt=class o extends Z{constructor(t,i=-1,r=0,n=0,s=0,a=0){super();this.mAnimationId=-1;this.mParent=null;this.mChildren=[];this.mX=0;this.mY=0;this.mWidth=0;this.mHeight=0;this.mZIndex=0;this.mVisibility=tt.VISIBLE;this.mNeedsMeasure=!0;this.mNeedsRepaint=!0;this.mFirstLayout=!0;this.mLayoutVisibility=tt.VISIBLE;this.mAnimationSpec=ue.DEFAULT;this.mAnimateMeasure=null;this.mNeedsBoundsAnimation=!1;this.mComponentValues=[];this.mComponentId=t,this.mAnimationId=i,this.mX=r,this.mY=n,this.mWidth=s,this.mHeight=a}getComponentId(){return this.mComponentId}setComponentId(t){this.mComponentId=t}getAnimationId(){return this.mAnimationId}setAnimationId(t){this.mAnimationId=t}getParent(){return this.mParent}setParent(t){this.mParent=t}getList(){return this.mChildren}getX(){return this.mX}setX(t){this.mX=t}getY(){return this.mY}setY(t){this.mY=t}getWidth(){return this.mWidth}setWidth(t){this.mWidth=t}getHeight(){return this.mHeight}setHeight(t){this.mHeight=t}getZIndex(){return this.mZIndex}getScrollX(){return 0}getScrollY(){return 0}needsMeasure(){return this.mNeedsMeasure}invalidateMeasure(){this.mNeedsMeasure=!0,this.mParent&&this.mParent.invalidateMeasure()}clearNeedsMeasure(){this.mNeedsMeasure=!1}needsRepaint(){return this.mNeedsRepaint}doesNeedsRepaint(){return this.mNeedsRepaint}setNeedsRepaint(t){this.mNeedsRepaint=t}needsBoundsAnimation(){return this.mNeedsBoundsAnimation}markNeedsBoundsAnimation(){this.mNeedsBoundsAnimation=!0,this.mParent&&this.mParent.markNeedsBoundsAnimation()}clearNeedsBoundsAnimation(){this.mNeedsBoundsAnimation=!1}isVisible(){return tt.isGone(this.mVisibility)?!1:this.mParent?this.mParent.isVisible():!0}isGone(){return tt.isGone(this.mVisibility)}getVisibility(){return this.mVisibility}setVisibility(t){t!==this.mVisibility&&(this.mVisibility=t,this.invalidateMeasure(),this.mParent&&this.mParent.invalidateMeasure())}inflate(){for(let t of this.mChildren){t instanceof ue&&(this.mAnimationSpec=t,this.mAnimationId=t.getAnimationId()),t instanceof o&&t.setParent(this);let i=t;typeof i.setComponent=="function"&&typeof i.touchDown=="function"&&i.setComponent(this)}}minIntrinsicHeight(){let t=0;for(let i of this.mChildren)i instanceof o&&(t=Math.max(t,i.minIntrinsicHeight()));return t}minIntrinsicWidth(){let t=0;for(let i of this.mChildren)i instanceof o&&(t=Math.max(t,i.minIntrinsicWidth()));return t}measure(t,i,r,n,s,a){let m=a.get(this);m.setW(this.mWidth),m.setH(this.mHeight)}layout(t,i){let r=i.get(this);if(!this.mFirstLayout&&t.isAnimationEnabled()&&this.mAnimationSpec.isAnimationEnabled()&&r.getAllowsAnimation()&&!(tt.isGone(this.mLayoutVisibility)&&tt.isGone(r.getVisibility())))if(this.mAnimateMeasure===null){let s=new ke(this.mComponentId,this.mX,this.mY,this.mWidth,this.mHeight,this.mLayoutVisibility),a=new ke(this.mComponentId,r.getX(),r.getY(),r.getW(),r.getH(),r.getVisibility());if(!a.same(s)){let m=t.mClock?.millis()??Date.now();this.mAnimateMeasure=new Uo(m,this,s,a,this.mAnimationSpec.getMotionDuration(),this.mAnimationSpec.getVisibilityDuration(),this.mAnimationSpec.getEnterAnimation(),this.mAnimationSpec.getExitAnimation(),this.mAnimationSpec.getMotionEasingType(),this.mAnimationSpec.getVisibilityEasingType())}}else{let s=t.mClock?.millis()??Date.now();this.mAnimateMeasure.updateTarget(t,r,s)}else(!t.isAnimationEnabled()||!this.mAnimationSpec.isAnimationEnabled())&&(this.mAnimateMeasure=null);this.mAnimateMeasure===null?(this.mVisibility=r.getVisibility(),this.mX=r.getX(),this.mY=r.getY(),this.mWidth=r.getW(),this.mHeight=r.getH(),this.updateComponentValues(t,this.mWidth,this.mHeight),this.mParent&&this.clearNeedsBoundsAnimation()):(this.mAnimateMeasure.apply(t),this.updateComponentValues(t,this.mWidth,this.mHeight),this.markNeedsBoundsAnimation()),this.mLayoutVisibility=r.getVisibility(),this.mFirstLayout=!1}animatingBounds(t){t.isAnimationEnabled()?this.mAnimateMeasure!==null?(this.mAnimateMeasure.apply(t),this.mAnimateMeasure.isDone()?(this.mAnimateMeasure=null,this.mParent&&this.clearNeedsBoundsAnimation()):this.markNeedsBoundsAnimation()):this.mParent&&this.clearNeedsBoundsAnimation():(this.mAnimateMeasure=null,this.mParent&&this.clearNeedsBoundsAnimation());for(let i of this.mChildren)i instanceof o&&i.animatingBounds(t)}applyAnimationAsNeeded(t){return t.isAnimationEnabled()?this.mAnimateMeasure!==null?(this.mAnimateMeasure.paint(t),this.mAnimateMeasure.isDone()?(this.mAnimateMeasure=null,this.mParent&&this.clearNeedsBoundsAnimation(),t.needsRepaint()):(this.markNeedsBoundsAnimation(),t.needsRepaint()),!0):!1:(this.mAnimateMeasure!==null&&(this.mAnimateMeasure=null,this.mParent&&this.clearNeedsBoundsAnimation()),!1)}paint(t){this.applyAnimationAsNeeded(t)||tt.isGone(this.mVisibility)||tt.isInvisible(this.mVisibility)||this.paintingComponent(t)}paintingComponent(t){let i=t.getContext();t.matrixSave(),t.matrixTranslate(this.mX,this.mY);for(let r of this.mChildren)i.incrementOpCount(r),r.isDirty()&&typeof r.updateVariables=="function"&&(r.markNotDirty(),r.updateVariables(i)),r.apply(i);t.matrixRestore()}apply(t){for(let i of this.mChildren)i.isDirty()&&typeof i.updateVariables=="function"&&(i.markNotDirty(),i.updateVariables(t));super.apply(t)}onClick(t,i,r,n){if(!this.isVisible())return!1;for(let s=this.mChildren.length-1;s>=0;s--){let a=this.mChildren[s];if(a instanceof o&&a.onClick(t,i,r,n))return!0}return!1}onTouchDown(t,i,r,n){if(!this.contains(r,n))return!1;let s=this.getLocationInWindow(),a=r-s[0],m=n-s[1],u=!1,l=!1;for(let h=this.mChildren.length-1;h>=0;h--){let c=this.mChildren[h];c instanceof o?!l&&c.onTouchDown(t,i,r,n)&&(l=!0):c instanceof Ht&&(c.updateVariables(t),c.touchDown(t,a,m),i.appliedTouchOperation(this),u=!0)}return l||u}onTouchDrag(t,i,r,n,s){if(!s&&!this.contains(r,n))return!1;let a=this.getLocationInWindow(),m=r-a[0],u=n-a[1],l=!1,h=!1;for(let c=this.mChildren.length-1;c>=0;c--){let f=this.mChildren[c];f instanceof o?!h&&f.onTouchDrag(t,i,r,n,s)&&(h=!0):f instanceof Ht&&(f.updateVariables(t),f.touchDrag(t,m,u),l=!0)}return h||l}onTouchUp(t,i,r,n,s,a,m){if(!m&&!this.contains(r,n))return!1;let u=this.getLocationInWindow(),l=r-u[0],h=n-u[1],c=!1,f=!1;for(let d=this.mChildren.length-1;d>=0;d--){let p=this.mChildren[d];p instanceof o?!f&&p.onTouchUp(t,i,r,n,s,a,m)&&(f=!0):p instanceof Ht&&(p.updateVariables(t),p.touchUp(t,l,h,s,a),c=!0)}return f||c}onTouchCancel(t,i,r,n,s){if(!s&&!this.contains(r,n))return!1;let a=this.getLocationInWindow(),m=r-a[0],u=n-a[1],l=!1,h=!1;for(let c=this.mChildren.length-1;c>=0;c--){let f=this.mChildren[c];f instanceof o?!h&&f.onTouchCancel(t,i,r,n,s)&&(h=!0):f instanceof Ht&&(f.updateVariables(t),f.touchUp(t,m,u,0,0),l=!0)}return h||l}contains(t,i){let r=this.getLocationInWindow();return t>=r[0]&&t<=r[0]+this.mWidth&&i>=r[1]&&i<=r[1]+this.mHeight}getLocationInWindow(){let t=this.mX,i=this.mY,r=this.mParent;for(;r;){let n=r;t+=r.mX+(n.mPaddingLeft??0)+r.getScrollX(),i+=r.mY+(n.mPaddingTop??0)+r.getScrollY(),r=r.getParent()}return[t,i]}getRoot(){let t=this;for(;t.mParent;)t=t.mParent;return t}getComponent(t){if(this.mComponentId===t)return this;for(let i of this.mChildren)if(i instanceof o){let r=i.getComponent(t);if(r)return r}return null}addComponentValue(t){t&&(this.mComponentValues||(this.mComponentValues=[]),this.mComponentValues.includes(t)||this.mComponentValues.push(t))}updateComponentValues(t,i,r){for(let n of this.mComponentValues??[]){let s=typeof n.getType=="function"?n.getType():n.mType,a=typeof n.getValueId=="function"?n.getValueId():n.mValueId;if(typeof a=="number")switch(s){case 0:t.loadFloat(a,i);break;case 1:t.loadFloat(a,r);break;case 2:t.loadFloat(a,this.mX);break;case 3:t.loadFloat(a,this.mY);break;default:break}}}registerVariables(t){}updateVariables(t){}selfOrModifier(t){for(let i of this.mChildren)if(i instanceof t)return i;return null}hasComputedLayout(){return!1}applyComputedLayout(t,i,r,n){return!1}write(t){}deepToString(t){return`${t}Component(${this.mComponentId})`}};var ft=class o extends D{static{this.OP_CODE=16}static{this.EXACT=0}static{this.FILL=1}static{this.WRAP=2}static{this.WEIGHT=3}static{this.INTRINSIC_MIN=4}static{this.INTRINSIC_MAX=5}static{this.EXACT_DP=6}static{this.FILL_PARENT_MAX_WIDTH=7}static{this.FILL_PARENT_MAX_HEIGHT=8}constructor(e,t){super(),this.mType=e,this.mValueBits=t,this.mOutValue=O(t)?0:F(t)}getType(){return this.mType}getValue(){return this.mOutValue}hasFraction(){return!O(this.mValueBits)||Et(this.mValueBits)}registerListening(e){this.mType!==o.EXACT&&this.mType!==o.EXACT_DP&&Et(this.mValueBits)&&e.listensTo(x(this.mValueBits),this),(this.mType===o.EXACT||this.mType===o.EXACT_DP)&&(O(this.mValueBits)&&e.listensTo(x(this.mValueBits),this),(this.mType===o.EXACT_DP||e.getDensityBehavior?.()===st.DENSITY_BEHAVIOR_DP)&&e.listensTo(27,this))}updateVariables(e){if(this.mType!==o.EXACT&&this.mType!==o.EXACT_DP&&Et(this.mValueBits)&&(this.mOutValue=e.getFloat(x(this.mValueBits))),this.mType===o.EXACT||this.mType===o.EXACT_DP){let t=this.mOutValue;if(this.mOutValue=O(this.mValueBits)?e.getFloat(x(this.mValueBits)):F(this.mValueBits),this.mType===o.EXACT&&e.getDensityBehavior?.()===st.DENSITY_BEHAVIOR_DP){let i=e.getDensity();i>0&&!Number.isNaN(i)&&(this.mOutValue*=i)}t!==this.mOutValue&&e.getDocument?.()?.invalidateMeasure()}}write(e){}apply(e){}deepToString(e){return`${e}WidthModifier(${this.mType}, ${this.mOutValue})`}static read(e,t){t.push(new o(e.readInt(),e.readNanIdBits()))}},pt=class o extends D{static{this.OP_CODE=67}static{this.EXACT=0}static{this.FILL=1}static{this.WRAP=2}static{this.WEIGHT=3}static{this.INTRINSIC_MIN=4}static{this.INTRINSIC_MAX=5}static{this.EXACT_DP=6}static{this.FILL_PARENT_MAX_WIDTH=7}static{this.FILL_PARENT_MAX_HEIGHT=8}constructor(e,t){super(),this.mType=e,this.mValueBits=t,this.mOutValue=O(t)?0:F(t)}getType(){return this.mType}getValue(){return this.mOutValue}hasFraction(){return!O(this.mValueBits)||Et(this.mValueBits)}registerListening(e){(this.mType===o.EXACT||this.mType===o.EXACT_DP)&&(O(this.mValueBits)&&e.listensTo(x(this.mValueBits),this),(this.mType===o.EXACT_DP||e.getDensityBehavior?.()===st.DENSITY_BEHAVIOR_DP)&&e.listensTo(27,this))}updateVariables(e){if(this.mType===o.EXACT||this.mType===o.EXACT_DP){let t=this.mOutValue;if(this.mOutValue=O(this.mValueBits)?e.getFloat(x(this.mValueBits)):F(this.mValueBits),this.mType===o.EXACT&&e.getDensityBehavior?.()===st.DENSITY_BEHAVIOR_DP){let i=e.getDensity();i>0&&!Number.isNaN(i)&&(this.mOutValue*=i)}t!==this.mOutValue&&e.getDocument?.()?.invalidateMeasure()}}write(e){}apply(e){}deepToString(e){return`${e}HeightModifier(${this.mType}, ${this.mOutValue})`}static read(e,t){t.push(new o(e.readInt(),e.readNanIdBits()))}},Ai=class o extends D{static{this.OP_CODE=231}constructor(e,t){super(),this.mMinBits=e,this.mMaxBits=t,this.mOutMin=O(e)?0:F(e),this.mOutMax=O(t)?0:F(t)}getMin(){return this.mOutMin}getMax(){return this.mOutMax}registerListening(e){O(this.mMinBits)&&e.listensTo(x(this.mMinBits),this),O(this.mMaxBits)&&e.listensTo(x(this.mMaxBits),this)}updateVariables(e){if(O(this.mMinBits)&&(this.mOutMin=e.getFloat(x(this.mMinBits))),O(this.mMaxBits)&&(this.mOutMax=e.getFloat(x(this.mMaxBits))),e.getDensityBehavior?.()!==st.DENSITY_BEHAVIOR_PIXELS){let t=e.getDensity();t>0&&!Number.isNaN(t)&&(this.mOutMin!==-1&&(this.mOutMin*=t),this.mOutMax!==-1&&Number.isFinite(this.mOutMax)&&(this.mOutMax*=t))}}write(e){}apply(e){}deepToString(e){return`${e}WidthInModifier(${this.mOutMin}, ${this.mOutMax})`}static read(e,t){t.push(new o(e.readNanIdBits(),e.readNanIdBits()))}},Ei=class o extends D{static{this.OP_CODE=232}constructor(e,t){super(),this.mMinBits=e,this.mMaxBits=t,this.mOutMin=O(e)?0:F(e),this.mOutMax=O(t)?0:F(t)}getMin(){return this.mOutMin}getMax(){return this.mOutMax}registerListening(e){O(this.mMinBits)&&e.listensTo(x(this.mMinBits),this),O(this.mMaxBits)&&e.listensTo(x(this.mMaxBits),this)}updateVariables(e){if(O(this.mMinBits)&&(this.mOutMin=e.getFloat(x(this.mMinBits))),O(this.mMaxBits)&&(this.mOutMax=e.getFloat(x(this.mMaxBits))),e.getDensityBehavior?.()!==st.DENSITY_BEHAVIOR_PIXELS){let t=e.getDensity();t>0&&!Number.isNaN(t)&&(this.mOutMin!==-1&&(this.mOutMin*=t),this.mOutMax!==-1&&Number.isFinite(this.mOutMax)&&(this.mOutMax*=t))}}write(e){}apply(e){}deepToString(e){return`${e}HeightInModifier(${this.mOutMin}, ${this.mOutMax})`}static read(e,t){t.push(new o(e.readNanIdBits(),e.readNanIdBits()))}},ti=class o extends D{static{this.OP_CODE=235}constructor(e,t){super(),this.mOrientation=e,this.mPriority=t}getOrientation(){return this.mOrientation}getPriority(){return this.mPriority}write(e){}apply(e){}deepToString(e){return`${e}CollapsiblePriorityModifier`}static read(e,t){t.push(new o(e.readInt(),F(e.readNanIdBits())))}},Se=class o extends D{constructor(t,i,r,n,s,a,m){super();this.mComponent=null;this.mLayoutW=0;this.mLayoutH=0;this.mFlags=t,this.mColorId=i,this.mR=r,this.mG=n,this.mB=s,this.mA=a,this.mOutR=O(r)?0:F(r),this.mOutG=O(n)?0:F(n),this.mOutB=O(s)?0:F(s),this.mOutA=O(a)?0:F(a),this.mShapeType=m}static{this.OP_CODE=55}static{this.COLOR_REF=2}setComponent(t){this.mComponent=t}layoutDecorator(t,i){this.mLayoutW=t,this.mLayoutH=i}registerListening(t){this.mFlags===o.COLOR_REF?t.listensTo(this.mColorId,this):(O(this.mR)&&t.listensTo(x(this.mR),this),O(this.mG)&&t.listensTo(x(this.mG),this),O(this.mB)&&t.listensTo(x(this.mB),this),O(this.mA)&&t.listensTo(x(this.mA),this))}updateVariables(t){this.mFlags!==o.COLOR_REF&&(O(this.mR)&&(this.mOutR=t.getFloat(x(this.mR))),O(this.mG)&&(this.mOutG=t.getFloat(x(this.mG))),O(this.mB)&&(this.mOutB=t.getFloat(x(this.mB))),O(this.mA)&&(this.mOutA=t.getFloat(x(this.mA))))}write(t){}apply(t){if(t.mMode!=="PAINT")return;let i=t.getPaintContext();if(!i)return;let r=this.mLayoutW,n=this.mLayoutH;if(r<=0||n<=0)return;i.savePaint();let s;if(this.mFlags===o.COLOR_REF)s=t.mRemoteComposeState.getColor(this.mColorId);else{let m=Math.trunc(this.mOutA*255+.5),u=Math.trunc(this.mOutR*255+.5),l=Math.trunc(this.mOutG*255+.5),h=Math.trunc(this.mOutB*255+.5);s=m<<24|u<<16|l<<8|h|0}let a=new ot;a.mArray=[ot.STYLE,ot.COLOR,s],a.mPos=3,i.replacePaint(a),this.mShapeType===1?i.drawCircle(r/2,n/2,Math.min(r,n)/2):i.drawRect(0,0,r,n),i.restorePaint()}deepToString(t){return`${t}BackgroundModifier`}static read(t,i){let r=t.readInt(),n=t.readInt();(r&2)!==0&&(n=t.getRemapContext?.()?.resolveId(n)??n),t.readInt(),t.readInt();let s=t.readNanIdBits(),a=t.readNanIdBits(),m=t.readNanIdBits(),u=t.readNanIdBits(),l=t.readInt();i.push(new o(r,n,s,a,m,u,l))}},Mi=class o extends D{constructor(t,i,r,n,s,a,m,u,l){super();this.mComponent=null;this.mLayoutW=0;this.mLayoutH=0;this.mFlags=t,this.mColorId=i,this.mBorderWidth=r,this.mRoundedCorner=n,this.mR=s,this.mG=a,this.mB=m,this.mA=u,this.mShapeType=l}static{this.OP_CODE=107}static{this.COLOR_REF=2}setComponent(t){this.mComponent=t}layoutDecorator(t,i){this.mLayoutW=t,this.mLayoutH=i}write(t){}apply(t){if(t.mMode!=="PAINT")return;let i=t.getPaintContext();if(!i)return;let r=this.mLayoutW,n=this.mLayoutH;if(r<=0||n<=0)return;i.savePaint();let s=new ot,a;if(this.mFlags===o.COLOR_REF)a=t.mRemoteComposeState.getColor(this.mColorId);else{let m=Math.trunc(this.mA*255+.5),u=Math.trunc(this.mR*255+.5),l=Math.trunc(this.mG*255+.5),h=Math.trunc(this.mB*255+.5);a=m<<24|u<<16|l<<8|h|0}s.reset(),s.setStyle(ot.STROKE),s.setColor(a),s.setStrokeWidth(this.mBorderWidth),i.replacePaint(s),this.mRoundedCorner>0?i.drawRoundRect(0,0,r,n,this.mRoundedCorner,this.mRoundedCorner):i.drawRect(0,0,r,n),i.restorePaint()}deepToString(t){return`${t}BorderModifier`}static read(t,i){let r=t.readInt(),n=t.readInt();(r&2)!==0&&(n=t.getRemapContext?.()?.resolveId(n)??n),t.readInt(),t.readInt();let s=d=>O(d)?0:F(d),a=s(t.readNanIdBits()),m=s(t.readNanIdBits()),u=s(t.readNanIdBits()),l=s(t.readNanIdBits()),h=s(t.readNanIdBits()),c=s(t.readNanIdBits()),f=t.readInt();i.push(new o(r,n,a,m,u,l,h,c,f))}},Pe=class o extends D{static{this.OP_CODE=58}constructor(e,t,i,r){super(),this.mLeft=e,this.mTop=t,this.mRight=i,this.mBottom=r,this.mLeftValue=O(e)?0:F(e),this.mTopValue=O(t)?0:F(t),this.mRightValue=O(i)?0:F(i),this.mBottomValue=O(r)?0:F(r)}registerListening(e){O(this.mLeft)&&e.listensTo(x(this.mLeft),this),O(this.mTop)&&e.listensTo(x(this.mTop),this),O(this.mRight)&&e.listensTo(x(this.mRight),this),O(this.mBottom)&&e.listensTo(x(this.mBottom),this)}updateVariables(e){if(this.mLeftValue=O(this.mLeft)?e.getFloat(x(this.mLeft)):F(this.mLeft),this.mTopValue=O(this.mTop)?e.getFloat(x(this.mTop)):F(this.mTop),this.mRightValue=O(this.mRight)?e.getFloat(x(this.mRight)):F(this.mRight),this.mBottomValue=O(this.mBottom)?e.getFloat(x(this.mBottom)):F(this.mBottom),e.getDensityBehavior()===st.DENSITY_BEHAVIOR_DP){let t=e.getDensity();t>0&&!Number.isNaN(t)&&(this.mLeftValue*=t,this.mTopValue*=t,this.mRightValue*=t,this.mBottomValue*=t)}}write(e){}apply(e){}deepToString(e){return`${e}PaddingModifier(${this.mLeftValue}, ${this.mTopValue}, ${this.mRightValue}, ${this.mBottomValue})`}static read(e,t){t.push(new o(e.readNanIdBits(),e.readNanIdBits(),e.readNanIdBits(),e.readNanIdBits()))}},Fi=class o extends D{constructor(t,i,r,n){super();this.mLayoutW=0;this.mLayoutH=0;this.mComponent=null;this.mTopStart=t,this.mTopEnd=i,this.mBottomStart=r,this.mBottomEnd=n}static{this.OP_CODE=54}setComponent(t){this.mComponent=t}layoutDecorator(t,i){this.mLayoutW=t,this.mLayoutH=i}write(t){}apply(t){if(t.mMode!=="PAINT")return;let i=t.getPaintContext();if(!i)return;let r=this.mLayoutW,n=this.mLayoutH;if(r>0&&n>0){let s=(a,m)=>a!==void 0&&O(a)?t.getFloat(x(a)):m;i.roundedClipRect(r,n,s(this.mBits?.[0],this.mTopStart),s(this.mBits?.[1],this.mTopEnd),s(this.mBits?.[2],this.mBottomStart),s(this.mBits?.[3],this.mBottomEnd))}}deepToString(t){return`${t}RoundedClipRectModifier`}static read(t,i){let r=[t.readNanIdBits(),t.readNanIdBits(),t.readNanIdBits(),t.readNanIdBits()],n=new o(F(r[0]),F(r[1]),F(r[2]),F(r[3]));n.mBits=r,i.push(n)}},Si=class o extends D{constructor(){super();this.mComponent=null;this.mLayoutW=0;this.mLayoutH=0}static{this.OP_CODE=108}setComponent(t){this.mComponent=t}layoutDecorator(t,i){this.mLayoutW=t,this.mLayoutH=i}write(t){}apply(t){if(t.mMode!=="PAINT")return;let i=t.getPaintContext();if(!i)return;let r=this.mLayoutW,n=this.mLayoutH;r>0&&n>0&&i.clipRect(0,0,r,n)}deepToString(t){return`${t}ClipRectModifier`}static read(t,i){i.push(new o)}},$r=class o{constructor(){this.start=0;this.x=0;this.y=0}static{this.EASE=new Jt(mt.CUBIC_STANDARD)}animate(e,t,i){this.start=e.getClock?.()?.millis?.()??Date.now(),this.start===0&&(this.start=1),this.x=t,this.y=i,e.needsRepaint()}paint(e,t,i,r){if(this.start===0||i<=0||r<=0)return;e.needsRepaint();let s=((t.getClock?.()?.millis?.()??Date.now())-this.start)/1e3;s>1&&(this.start=0),s=Math.min(1,Math.max(0,s));let a=o.EASE.get(s),m=o.EASE.get(Math.min(1,s/.5)),u=bo(180<<24|250<<16|64e3|250|0,0|200<<16|51200|200|0,a);e.matrixSave(),e.savePaint();let l=new ot;l.mArray=[ot.STYLE,ot.COLOR,u],l.mPos=3,e.replacePaint(l),e.clipRect(0,0,i,r),e.drawCircle(this.x,this.y,Math.max(i,r)*m),e.restorePaint(),e.matrixRestore()}},ye=class o extends D{constructor(){super();this.mList=[];this.mComponent=null;this.ripple=new $r}static{this.OP_CODE=59}getList(){return this.mList}setComponent(t){this.mComponent=t}onClick(t,i,r,n){(t.isAnimationEnabled?.()??!0)&&this.ripple.animate(t,r,n);for(let s of this.mList)t.incrementOpCount(s),s.apply(t);return t.needsRepaint(),!0}write(t){}apply(t){}deepToString(t){return`${t}ClickModifier(${this.mList.length} actions)`}static read(t,i){i.push(new o)}},Ie=class o extends D{constructor(t=0){super();this.mClickType=0;this.mList=[];this.mComponent=null;this.ripple=new $r;this.mClickType=t}static{this.OP_CODE=83}static{this.CLICK_TYPE_SINGLE=0}static{this.CLICK_TYPE_LONG=1}static{this.CLICK_TYPE_DOUBLE=2}getList(){return this.mList}getClickType(){return this.mClickType}setComponent(t){this.mComponent=t}onClick(t,i,r,n){if(this.mClickType!==o.CLICK_TYPE_SINGLE)return!1;(t.isAnimationEnabled?.()??!0)&&this.ripple.animate(t,r,n);for(let s of this.mList)t.incrementOpCount(s),s.apply(t);return t.needsRepaint(),!0}onLongPress(t,i,r,n){if(this.mClickType!==o.CLICK_TYPE_LONG)return!1;for(let s of this.mList)t.incrementOpCount(s),s.apply(t);return t.needsRepaint(),!0}onDoubleClick(t,i,r,n){if(this.mClickType!==o.CLICK_TYPE_DOUBLE)return!1;for(let s of this.mList)t.incrementOpCount(s),s.apply(t);return t.needsRepaint(),!0}write(t){}apply(t){}deepToString(t){return`${t}MultiClickModifier(type=${this.mClickType}, ${this.mList.length} actions)`}static read(t,i){let r=t.readInt();i.push(new o(r))}},Ut=class o extends D{static{this.OP_CODE=243}static{this.HORIZONTAL=0}static{this.VERTICAL=1}static{this.REQUIRED_HORIZONTAL=2}static{this.REQUIRED_VERTICAL=3}constructor(e,t,i){super(),this.mType=e,this.mMin=t,this.mMax=i}getType(){return this.mType}getMin(){return this.mMin}getMax(){return this.mMax}write(e){}apply(e){}deepToString(e){return`${e}DimensionConstraintsModifier(type=${this.mType}, min=${this.mMin}, max=${this.mMax})`}static read(e,t){let i=e.readByte(),r=F(e.readNanIdBits()),n=F(e.readNanIdBits());t.push(new o(i,r,n))}},_e=class o extends D{constructor(){super();this.mList=[]}static{this.OP_CODE=219}getList(){return this.mList}onTouchDown(t){for(let i of this.mList)t.incrementOpCount(i),i.apply(t)}write(t){}apply(t){}deepToString(t){return`${t}TouchDownModifier(${this.mList.length} actions)`}static read(t,i){i.push(new o)}},le=class o extends D{constructor(){super();this.mList=[]}static{this.OP_CODE=220}getList(){return this.mList}onTouchUp(t){for(let i of this.mList)t.incrementOpCount(i),i.apply(t)}write(t){}apply(t){}deepToString(t){return`${t}TouchUpModifier(${this.mList.length} actions)`}static read(t,i){i.push(new o)}},he=class o extends D{constructor(){super();this.mList=[]}static{this.OP_CODE=225}getList(){return this.mList}onTouchCancel(t){for(let i of this.mList)t.incrementOpCount(i),i.apply(t)}write(t){}apply(t){}deepToString(t){return`${t}TouchCancelModifier(${this.mList.length} actions)`}static read(t,i){i.push(new o)}},Pi=class o extends D{constructor(t){super();this.mVisibility=tt.VISIBLE;this.mParent=null;this.mVisibilityId=t}static{this.OP_CODE=211}setParent(t){this.mParent=t}registerListening(t){t.listensTo(this.mVisibilityId,this)}updateVariables(t){let i=t.getInteger(this.mVisibilityId);tt.isVisible(i)?this.mVisibility=tt.VISIBLE:tt.isGone(i)?this.mVisibility=tt.GONE:tt.isInvisible(i)?this.mVisibility=tt.INVISIBLE:this.mVisibility=tt.GONE,this.mParent&&typeof this.mParent.setVisibility=="function"&&this.mParent.setVisibility(this.mVisibility),this.markNotDirty()}write(t){}apply(t){this.isDirty()&&this.updateVariables(t)}evaluateInLayout(t){let i=this.mVisibility;return this.updateVariables(t),i!==this.mVisibility}deepToString(t){return`${t}VisibilityModifier(${this.mVisibilityId})`}static read(t,i){i.push(new o(t.readId()))}},_i=class o extends D{static{this.OP_CODE=221}constructor(e,t){super(),this.mOffX=e,this.mOffY=t,this.mOutX=O(e)?0:F(e),this.mOutY=O(t)?0:F(t)}registerListening(e){O(this.mOffX)&&e.listensTo(x(this.mOffX),this),O(this.mOffY)&&e.listensTo(x(this.mOffY),this)}updateVariables(e){O(this.mOffX)&&(this.mOutX=e.getFloat(x(this.mOffX))),O(this.mOffY)&&(this.mOutY=e.getFloat(x(this.mOffY)))}write(e){}apply(e){if(e.mMode!=="PAINT")return;let t=e.getPaintContext();t&&t.translate(this.mOutX,this.mOutY)}deepToString(e){return`${e}OffsetModifier(${this.mOutX}, ${this.mOutY})`}static read(e,t){t.push(new o(e.readNanIdBits(),e.readNanIdBits()))}},Ri=class o extends D{static{this.OP_CODE=223}constructor(e){super(),this.mValueBits=e,this.mCurrentValue=O(e)?0:F(e)}getValue(){return this.mCurrentValue}write(e){}apply(e){e.mMode==="PAINT"&&Et(this.mValueBits)&&(this.mCurrentValue=e.getFloat(x(this.mValueBits)))}deepToString(e){return`${e}ZIndexModifier(${this.mCurrentValue})`}static read(e,t){t.push(new o(e.readNanIdBits()))}},ka=class{constructor(e){this.mIsVariable=!1;this.mId=0;this.mValue=0;this.mAnimateValueChanges=!0;this.mAnimate=!1;this.mAnimateTargetTime=0;this.mAnimateDuration=300;this.mTarget=0;this.mStart=0;this.mLastUpdate=0;this.mEasing=null;Et(e)?(this.mId=x(e),this.mIsVariable=!0):this.mValue=F(e)}getValue(){return this.mValue}evaluate(e){if(!this.mIsVariable)return this.mValue;let t=e.getContext().getFloat(this.mId),i=e.getClock().millis();if(t!==this.mValue){let r=i-this.mLastUpdate;this.mAnimateValueChanges=r>this.mAnimateDuration&&this.mLastUpdate!==0,this.mLastUpdate=i}if(!this.mAnimateValueChanges)this.mValue=t;else if(t!==this.mValue&&!this.mAnimate&&(this.mStart=this.mValue,this.mTarget=t,this.mAnimate=!0,this.mAnimateTargetTime=i,this.mEasing=new Jt(mt.CUBIC_STANDARD)),this.mAnimate){let r=i-this.mAnimateTargetTime,n=Math.min(1,Math.max(0,r/this.mAnimateDuration/.3)),s=n>=1?1:this.mEasing.get(n);this.mValue=(1-s)*this.mStart+s*this.mTarget,s>=1&&(this.mAnimate=!1)}else this.mValue=this.mTarget;return this.mValue}},Bi=class o extends D{constructor(){super(...arguments);this.mAttributes=new Map;this.mAnimatable=new Map;this.mHasBlurEffect=!1}static{this.OP_CODE=224}static{this.SCALE_X=0}static{this.SCALE_Y=1}static{this.ROTATION_X=2}static{this.ROTATION_Y=3}static{this.ROTATION_Z=4}static{this.TRANSFORM_ORIGIN_X=5}static{this.TRANSFORM_ORIGIN_Y=6}static{this.TRANSLATION_X=7}static{this.TRANSLATION_Y=8}static{this.TRANSLATION_Z=9}static{this.SHADOW_ELEVATION=10}static{this.ALPHA=11}static{this.CAMERA_DISTANCE=12}static{this.COMPOSITING_STRATEGY=13}static{this.SPOT_SHADOW_COLOR=14}static{this.AMBIENT_SHADOW_COLOR=15}static{this.HAS_BLUR=16}static{this.BLUR_RADIUS_X=17}static{this.BLUR_RADIUS_Y=18}static{this.BLUR_TILE_MODE=19}static{this.SHAPE=20}static{this.SHAPE_RADIUS=21}static{this.DATA_TYPE_INT=0}static{this.DATA_TYPE_FLOAT=1}static{this.DEFS=[["SCALE_X",!0,1],["SCALE_Y",!0,1],["ROTATION_X",!0,0],["ROTATION_Y",!0,0],["ROTATION_Z",!0,0],["TRANSFORM_ORIGIN_X",!0,0],["TRANSFORM_ORIGIN_Y",!0,0],["TRANSLATION_X",!0,0],["TRANSLATION_Y",!0,0],["TRANSLATION_Z",!0,0],["SHADOW_ELEVATION",!0,0],["ALPHA",!0,1],["CAMERA_DISTANCE",!0,8],["COMPOSITING_STRATEGY",!1,0],["SPOT_SHADOW_COLOR",!1,0],["AMBIENT_SHADOW_COLOR",!1,0],["HAS_BLUR",!1,0],["BLUR_RADIUS_X",!0,0],["BLUR_RADIUS_Y",!0,0],["BLUR_TILE_MODE",!1,0],["SHAPE",!1,-1],["SHAPE_RADIUS",!0,0]]}setFloat(t,i){let[r]=o.DEFS[t],n=new ka(i);this.mAnimatable.set(t,n),this.mAttributes.set(t,{id:t,name:r,isFloat:!0,bits:i,value:n.getValue()})}setInt(t,i){let[r]=o.DEFS[t];this.mAttributes.set(t,{id:t,name:r,isFloat:!1,bits:null,value:i})}attributeValue(t){let i=this.mAttributes.get(t);return i?i.value:o.DEFS[t][2]}getAlpha(){return this.attributeValue(o.ALPHA)}getScaleX(){return this.attributeValue(o.SCALE_X)}getScaleY(){return this.attributeValue(o.SCALE_Y)}getRotationZ(){return this.attributeValue(o.ROTATION_Z)}getTranslationX(){return this.attributeValue(o.TRANSLATION_X)}getTranslationY(){return this.attributeValue(o.TRANSLATION_Y)}fillInAttributes(t){for(let[i,r]of this.mAttributes){let n=o.DEFS[i][2];r.value!==n&&t.set(i,r.value)}}evaluate(t){for(let[i,r]of this.mAnimatable){let n=this.mAttributes.get(i);n.value=r.evaluate(t)}}write(t){}apply(t){}deepToString(t){return`${t}GraphicsLayerModifier(${this.getScaleX()}, ${this.getScaleY()})`}static read(t,i){let r=t.readInt(),n=new o;if(r<0||r>o.DEFS.length)throw new Error(`attempt to allocate an invalid number of attributes: ${r}`);let s=t.getRemapContext?.();for(let a=0;a<r;a++){let m=t.readInt(),u=m>>10,l=m&63;if(l<0||l>=o.DEFS.length)throw new Error(`attempt to read an invalid attribute index: ${l}`);if((l===o.BLUR_RADIUS_X||l===o.BLUR_RADIUS_Y)&&(n.mHasBlurEffect=!0,n.setInt(o.HAS_BLUR,1)),u===o.DATA_TYPE_FLOAT)n.setFloat(l,t.readNanIdBits());else if(u===o.DATA_TYPE_INT){let h=t.readInt();(l===o.SPOT_SHADOW_COLOR||l===o.AMBIENT_SHADOW_COLOR)&&s&&(h=s.resolveId(h)),n.setInt(l,h)}}i.push(n)}},He=class o extends D{constructor(t,i,r,n){super();this.mList=[];this.mTouchExpression=null;this.mTouchDown=!1;this.mTouchDownX=0;this.mTouchDownY=0;this.mInitialScrollX=0;this.mInitialScrollY=0;this.mScrollX=0;this.mScrollY=0;this.mMaxScrollX=0;this.mMaxScrollY=0;this.mContentDimension=0;this.mDirection=t,this.mPositionId=i,this.mMax=r,this.mNotchMax=n}static{this.OP_CODE=226}static{this.VERTICAL=0}static{this.HORIZONTAL=1}static{this.FIX_TOUCH_EVENT=1}getList(){return this.mList}getDirection(){return this.mDirection}getMaxNan(){return this.mMax}getNotchMaxNan(){return this.mNotchMax}getScrollX(){return this.mScrollX}getScrollY(){return this.mScrollY}isVertical(){return this.mDirection===o.VERTICAL}isExpressionDriven(){return O(this.mPositionId)}inflate(t){for(let i of this.mList)i instanceof Ht&&(this.mTouchExpression=i,i.setComponent(t))}updateVariables(t){this.mTouchExpression?.updateVariables(t)}setVerticalScrollDimension(t,i){this.mContentDimension=i,this.mMaxScrollY=Math.max(0,i-t)}setHorizontalScrollDimension(t,i){this.mContentDimension=i,this.mMaxScrollX=Math.max(0,i-t)}onTouchDown(t,i,r){return this.mTouchDown=!0,this.mTouchDownX=i,this.mTouchDownY=r,this.mInitialScrollX=this.mScrollX,this.mInitialScrollY=this.mScrollY,this.mTouchExpression&&(this.mTouchExpression.updateVariables(t),t.getTouchVersion()===o.FIX_TOUCH_EVENT?this.mTouchExpression.touchDown(t,i,r):this.mTouchExpression.touchDown(t,i+this.mScrollX,r+this.mScrollY)),!0}onTouchDrag(t,i,r){if(this.mTouchDown=!0,this.mTouchExpression&&(this.mTouchExpression.updateVariables(t),t.getTouchVersion()===o.FIX_TOUCH_EVENT?this.mTouchExpression.touchDrag(t,i,r):this.mTouchExpression.touchDrag(t,i+this.mScrollX,r+this.mScrollY)),!this.isExpressionDriven())if(this.isVertical()){let n=r-this.mTouchDownY;this.mScrollY=Math.max(-this.mMaxScrollY,Math.min(0,this.mInitialScrollY+n))}else{let n=i-this.mTouchDownX;this.mScrollX=Math.max(-this.mMaxScrollX,Math.min(0,this.mInitialScrollX+n))}return!0}onTouchUp(t,i,r,n,s){let a=this.mTouchDown;return this.mTouchDown=!1,this.mTouchExpression&&(this.mTouchExpression.updateVariables(t),t.getTouchVersion()===o.FIX_TOUCH_EVENT?this.mTouchExpression.touchUp(t,i,r,n,s):this.mTouchExpression.touchUp(t,i+this.mScrollX,r+this.mScrollY,n,s)),a}onTouchCancel(t,i,r){let n=this.mTouchDown;return this.mTouchDown=!1,this.mTouchExpression?.touchUp(t,i,r,0,0),n}write(t){}apply(t){if(t.mMode!=="PAINT")return;for(let r of this.mList)r.apply(t),t.incrementOpCount(r);let i=t.getPaintContext();if(i){if(this.mTouchExpression){let r=t.getFloat(x(this.mPositionId));this.isVertical()?this.mScrollY=-Math.min(this.mMaxScrollY,r):this.mScrollX=-Math.min(this.mMaxScrollX,r)}i.translate(this.mScrollX,this.mScrollY)}}deepToString(t){return`${t}ScrollModifier(dir=${this.mDirection})`}static read(t,i){let r=t.readInt(),n=t.readNanIdBits(),s=t.readNanIdBits(),a=t.readNanIdBits();i.push(new o(r,n,s,a))}},Di=class o extends D{constructor(t,i,r,n,s,a){super();this.mComponent=null;this.mScrollX=0;this.mStartTime=0;this.mLastTime=0;this.mComponentWidth=0;this.mContentWidth=0;this.mIterations=t,this.mAnimationMode=i,this.mRepeatDelayMillis=r,this.mInitialDelayMillis=n,this.mSpacing=s,this.mVelocity=a}static{this.OP_CODE=228}setComponent(t){this.mComponent=t}write(t){}apply(t){if(t.mMode!=="PAINT")return;let i=t.getPaintContext();if(!i||!this.mComponent)return;this.mComponentWidth=this.mComponent.getWidth?.()??0,this.mContentWidth=this.mComponent.getContentWidth?.()??this.mComponentWidth;let r=this.mContentWidth-this.mComponentWidth;if(r<=0)return;let n=t.getAnimationTime();this.mStartTime===0&&(this.mStartTime=n);let s=n-this.mStartTime-this.mInitialDelayMillis/1e3;if(s<0){t.needsRepaint();return}let a=r/(this.mVelocity>0?this.mVelocity:30),m=a+this.mRepeatDelayMillis/1e3,u=s%m;if(u<a){let l=u/a,h=(1+Math.sin(l*2*Math.PI-Math.PI/2))/2*-r;this.mScrollX=h}else this.mScrollX=0;i.translate(this.mScrollX,0),t.needsRepaint()}deepToString(t){return`${t}MarqueeModifier`}static read(t,i){let r=t.readInt(),n=t.readInt(),s=t.readFloat(),a=t.readFloat(),m=t.readFloat(),u=t.readFloat();i.push(new o(r,n,s,a,m,u))}},Ue=class o extends D{constructor(){super();this.ripple=new $r}static{this.OP_CODE=229}write(t){}apply(t){}deepToString(t){return`${t}RippleModifier`}static read(t,i){i.push(new o)}},wi=class o extends D{static{this.OP_CODE=174}constructor(){super()}write(e){}apply(e){}deepToString(e){return`${e}DrawContentModifier`}static read(e,t){t.push(new o)}},zr=class o extends D{static{this.OP_CODE=237}constructor(e,t){super(),this.mLine=e,this.mFlags=t}write(e){}apply(e){}deepToString(e){return`${e}AlignByModifier`}static read(e,t){t.push(new o(F(e.readNanIdBits()),e.readInt()))}},Li=class o extends D{static{this.OP_CODE=250}constructor(e,t,i,r,n,s,a){super(),this.mContentDescriptionId=e,this.mRole=t,this.mTextId=i,this.mStateDescriptionId=r,this.mMode=n,this.mEnabled=s,this.mClickable=a}getContentDescriptionId(){return this.mContentDescriptionId}write(e){}apply(e){}deepToString(e){return`${e}AccessibilitySemantics(contentDescriptionId=${this.mContentDescriptionId}, role=${this.mRole}, enabled=${this.mEnabled}, clickable=${this.mClickable})`}static read(e,t){let i=e.declareId?e.declareId():e.readInt(),r=e.readByte(),n=e.declareId?e.declareId():e.readInt(),s=e.declareId?e.declareId():e.readInt(),a=e.readByte(),m=e.readBoolean(),u=e.readBoolean();t.push(new o(i,r,n,s,a,m,u))}};var Ni=class o extends D{constructor(t,i){super();this.isDynamic=!0;this.mId=t;let r=O(i)?NaN:F(i);if(r>o.MAX_FLOAT_ARRAY)throw new Error("Array too large");this.mValues=new Float32Array(Math.floor(r)||0),this.mArrayLengthBits=i,this.mArrayLengthOut=r}static{this.OP_CODE=197}static{this.MAX_FLOAT_ARRAY=2e3}updateVariables(t){O(this.mArrayLengthBits)&&(this.mArrayLengthOut=t.getFloat(x(this.mArrayLengthBits))),Math.floor(this.mArrayLengthOut)!==this.mValues.length&&(this.mValues=new Float32Array(Math.floor(this.mArrayLengthOut)||0))}registerListening(t){t.addCollection(this.mId,this),O(this.mArrayLengthBits)&&t.listensTo(x(this.mArrayLengthBits),this)}apply(t){t.addCollection(this.mId,this)}getFloatValue(t){return this.mValues[t]}getFloats(){return this.mValues}getLength(){return this.mValues.length}updateValues(t){t.length!==this.mValues.length&&(this.mValues=new Float32Array(t.length)),this.mValues.set(t)}write(t){t.start(o.OP_CODE),t.writeInt(this.mId),t.writeFloat(this.mValues.length)}deepToString(t){return`${t}DataDynamicListFloat(id=${this.mId}, len=${this.mValues.length})`}static read(t,i){let r=t.declareId(),n=t.readNanIdBits(),s=O(n)?NaN:F(n);if(s>o.MAX_FLOAT_ARRAY)throw new Error(`${s} entries exceeds max = ${o.MAX_FLOAT_ARRAY}`);i.push(new o(r,n))}};var Ce=class o extends D{constructor(t,i,r){super();this.mList=[];this.mParent=null;this.mBounds=new Float32Array(6);this.mType=t,this.mBoundsId=i,this.mAnimateChanges=r}static{this.OP_CODE=238}static{this.TYPE_MEASURE=0}static{this.TYPE_POSITION=1}getList(){return this.mList}getType(){return this.mType}setParent(t){this.mParent=t}registerListening(t){for(let i of this.mList)typeof i.registerListening=="function"&&i.registerListening(t)}updateVariables(t){let i=!1;for(let r of this.mList)typeof r.updateVariables=="function"&&r.isDirty()&&(r.updateVariables(t),t.incrementOpCount(r),r.apply(t),r.markNotDirty(),i=!0);i&&this.mParent&&typeof this.mParent.invalidateMeasure=="function"&&this.mParent.invalidateMeasure()}markDirty(){}apply(t){}applyToMeasure(t,i,r){let n=t.getContext().getCollectionsAccess();if(!n)return!1;let s=n.getArray(this.mBoundsId);if(!s)return!1;this.mBounds[0]=i.getX(),this.mBounds[1]=i.getY(),this.mBounds[2]=i.getW(),this.mBounds[3]=i.getH(),this.mBounds[4]=r.getW(),this.mBounds[5]=r.getH(),s instanceof Ni&&s.updateValues(this.mBounds);for(let l of this.mList)typeof l.updateVariables=="function"&&l.isDirty()&&l.updateVariables(t.getContext()),l.apply(t.getContext());let a=s.getFloats?.()??null;if(!a)return!1;switch(this.mType){case o.TYPE_MEASURE:i.setW(a[2]),i.setH(a[3]);break;case o.TYPE_POSITION:i.setX(a[0]),i.setY(a[1]);break;default:i.setX(a[0]),i.setY(a[1]),i.setW(a[2]),i.setH(a[3])}i.setAllowsAnimation(this.mAnimateChanges);let m=a[0]!==this.mBounds[0]||a[1]!==this.mBounds[1],u=a[2]!==this.mBounds[2]||a[3]!==this.mBounds[3];return this.mType===o.TYPE_MEASURE&&u||this.mType===o.TYPE_POSITION&&m?!0:u||m}write(t){t.start(o.OP_CODE),t.writeInt(this.mType),t.writeInt(this.mBoundsId),t.writeBoolean(this.mAnimateChanges)}deepToString(t){return`${t}LayoutComputeOperation(type=${this.mType}, boundsId=${this.mBoundsId})`}static read(t,i){let r=t.readInt(),n=t.readId(),s=t.readBoolean();i.push(new o(r,n,s))}};var ei=class o extends vt{static{this.OP_CODE=201}constructor(e){super(e)}write(e){e.start(o.OP_CODE),e.writeInt(this.getComponentId())}apply(e){}deepToString(e){return`${e}LayoutComponentContent(${this.getComponentId()})`}static read(e,t){let i=e.declareId();t.push(new o(i))}};var Ge=class o extends vt{static{this.OP_CODE=207}constructor(e){super(e)}write(e){e.start(o.OP_CODE),e.writeInt(this.getComponentId())}apply(e){}deepToString(e){return`${e}CanvasContent(${this.getComponentId()})`}static read(e,t){let i=e.declareId();t.push(new o(i))}};var Vi=class o extends Z{constructor(){super();this.mList=[]}static{this.OP_CODE=173}getList(){return this.mList}write(t){t.start(o.OP_CODE)}paint(t){let i=t.getContext();for(let r of this.mList)r.isDirty()&&typeof r.updateVariables=="function"&&r.updateVariables(i),i.incrementOpCount(),r.apply(i)}deepToString(t){let i=this.mList.map(r=>r.deepToString(t+" ")).join(`
|
|
65
|
+
`);return`${t}CanvasOperations
|
|
66
|
+
${i}`}static read(t,i){i.push(new o)}};var Gt=class o extends D{static{this.OP_CODE=150}static{this.WIDTH=0}static{this.HEIGHT=1}static{this.POS_X=2}static{this.POS_Y=3}static{this.POS_ROOT_X=4}static{this.POS_ROOT_Y=5}static{this.CONTENT_WIDTH=6}static{this.CONTENT_HEIGHT=7}constructor(e,t,i){super(),this.mType=e,this.mComponentId=t,this.mValueId=i}getType(){return this.mType}getComponentId2(){return this.mComponentId}getValueId(){return this.mValueId}write(e){}apply(e){let t=e.getDocument();if(!t)return;let i=t.getComponent(this.mComponentId);if(!i){this.mType===o.WIDTH?e.loadFloat(this.mValueId,t.getWidth()):this.mType===o.HEIGHT&&e.loadFloat(this.mValueId,t.getHeight());return}let r=i;if(r.constructor?.OP_CODE===201){let n=r.getParent?.();n&&(r=n)}switch(typeof r.addComponentValue=="function"&&r.addComponentValue(this),this.mType){case o.WIDTH:e.loadFloat(this.mValueId,r.getWidth?r.getWidth():t.getWidth());break;case o.HEIGHT:e.loadFloat(this.mValueId,r.getHeight?r.getHeight():t.getHeight());break;case o.POS_X:e.loadFloat(this.mValueId,r.getX?r.getX():0);break;case o.POS_Y:e.loadFloat(this.mValueId,r.getY?r.getY():0);break;case o.POS_ROOT_X:{let n=r.getLocationInWindow?r.getLocationInWindow():[0,0];e.loadFloat(this.mValueId,n[0]);break}case o.POS_ROOT_Y:{let n=r.getLocationInWindow?r.getLocationInWindow():[0,0];e.loadFloat(this.mValueId,n[1]);break}case o.CONTENT_WIDTH:e.loadFloat(this.mValueId,r.getContentWidth?r.getContentWidth():r.getWidth?r.getWidth():0);break;case o.CONTENT_HEIGHT:e.loadFloat(this.mValueId,r.getContentHeight?r.getContentHeight():r.getHeight?r.getHeight():0);break;default:e.loadFloat(this.mValueId,0);break}}deepToString(e){return`${e}ComponentValue(${this.mType}, ${this.mComponentId}, ${this.mValueId})`}static read(e,t){let i=e.readInt(),r=e.readId(),n=e.readId();t.push(new o(i,r,n))}};var ct=class o extends vt{constructor(){super(...arguments);this.mWidthMod=null;this.mHeightMod=null;this.mWidthInMod=null;this.mHeightInMod=null;this.mZIndexMod=null;this.mGraphicsLayerMod=null;this.mPaddingLeft=0;this.mPadBeforeWidth=0;this.mHasWidthOp=!1;this.mHasHeightOp=!1;this.mPadBeforeHeight=0;this.mPaddingRight=0;this.mPaddingTop=0;this.mPaddingBottom=0;this.mChildrenComponents=[];this.mDrawContentOperations=null;this.mComponentModifiers=[];this.mContentOps=[];this.mHasCanvasLayoutContent=!1;this.mComputedLayoutModifiers=null;this.mComponentValues=null;this.mScrollModifier=null;this.mScrollContentDimension=0;this.mScrollHostDimension=0}getWidthModifier(){return this.mWidthMod}getHeightModifier(){return this.mHeightMod}getWidthInModifier(){return this.mWidthInMod}getHeightInModifier(){return this.mHeightInMod}getScrollModifier(){return this.mScrollModifier}static preferExactSize(t,i){return t&&(n=>n===ft.EXACT||n===ft.EXACT_DP)(t.getType())?t:i}inflate(){this.mChildrenComponents=[],this.mComponentModifiers=[],this.mContentOps=[],this.mPaddingLeft=0,this.mPaddingRight=0,this.mPaddingTop=0,this.mPaddingBottom=0,this.mPadBeforeWidth=0,this.mPadBeforeHeight=0;let t=!1,i=!1;this.mComputedLayoutModifiers=null;for(let r of this.getList())if(r instanceof ue&&(this.mAnimationSpec=r,this.mAnimationId=r.getAnimationId()),r instanceof Pe)this.mPaddingLeft+=r.mLeftValue,this.mPaddingTop+=r.mTopValue,this.mPaddingRight+=r.mRightValue,this.mPaddingBottom+=r.mBottomValue,t||(this.mPadBeforeWidth+=r.mLeftValue+r.mRightValue),i||(this.mPadBeforeHeight+=r.mTopValue+r.mBottomValue),this.mComponentModifiers.push(r);else if(r instanceof ft)this.mWidthMod=o.preferExactSize(this.mWidthMod,r),t=!0;else if(r instanceof pt)this.mHeightMod=o.preferExactSize(this.mHeightMod,r),i=!0;else if(r instanceof Ai)this.mWidthInMod=r;else if(r instanceof Ei)this.mHeightInMod=r;else if(r instanceof Ut){let n=r.getType();n===Ut.HORIZONTAL||n===Ut.REQUIRED_HORIZONTAL?this.mWidthInMod=r:(n===Ut.VERTICAL||n===Ut.REQUIRED_VERTICAL)&&(this.mHeightInMod=r)}else if(r instanceof Ri)this.mZIndexMod=r,this.mZIndex=r.mValue??0;else if(r instanceof Bi)this.mGraphicsLayerMod=r;else if(r instanceof Pi)r.setParent(this),this.mComponentModifiers.push(r);else if(r instanceof Se)r.setComponent(this),this.mComponentModifiers.push(r);else if(r instanceof Mi)r.setComponent(this),this.mComponentModifiers.push(r);else if(r instanceof Fi)r.setComponent(this),this.mComponentModifiers.push(r);else if(r instanceof Si)r.setComponent(this),this.mComponentModifiers.push(r);else if(r instanceof _i)this.mComponentModifiers.push(r);else if(r instanceof ye||r instanceof Ie)r.setComponent(this),this.mComponentModifiers.push(r);else if(r instanceof _e||r instanceof le||r instanceof he)this.mComponentModifiers.push(r);else if(r instanceof He)this.mScrollModifier=r,r.inflate(this),this.mComponentModifiers.push(r);else if(r instanceof Di)r.setComponent(this),this.mComponentModifiers.push(r);else if(r instanceof Ue)this.mComponentModifiers.push(r);else if(r instanceof Li)this.mComponentModifiers.push(r);else if(r instanceof Ce)this.mComputedLayoutModifiers===null&&(this.mComputedLayoutModifiers=[]),r.setParent(this),this.mComputedLayoutModifiers.push(r);else if(r instanceof wi)this.mDrawContentOperations=[];else if(r instanceof ei||r instanceof Ge){r instanceof ei&&r.setParent(this);for(let n of r.getList())n instanceof vt?(n.setParent(this),this.mChildrenComponents.push(n),n.inflate(),n instanceof Ge&&(this.mHasCanvasLayoutContent=!0)):n instanceof Gt?(this.mComponentValues===null&&(this.mComponentValues=[]),this.mComponentValues.push(n)):(typeof n.setComponent=="function"&&n.setComponent(this),this.mContentOps.push(n),this.hoistNestedComponentValues(n));r instanceof Ge&&(this.mHasCanvasLayoutContent=!0)}else r instanceof vt?(r.setParent(this),this.mChildrenComponents.push(r),r.inflate()):(this.mDrawContentOperations!==null?this.mDrawContentOperations.push(r):this.mContentOps.push(r),this.hoistNestedComponentValues(r));if(this.mHasWidthOp=t,this.mHasHeightOp=i,this.mWidthMod||(this.mWidthMod=new ft(ft.WRAP,0)),this.mHeightMod||(this.mHeightMod=new pt(pt.WRAP,0)),this.mAnimationSpec!==ue.DEFAULT)for(let r of this.mChildrenComponents)r.mAnimationSpec===ue.DEFAULT&&(r.mAnimationSpec=this.mAnimationSpec);this.mX=0,this.mY=0,this.mWidth=this.modifierDefinedWidth(!0),this.mHeight=this.modifierDefinedHeight(!0)}isWidthFill(){return this.mWidthMod?.getType()===ft.FILL}isHeightFill(){return this.mHeightMod?.getType()===pt.FILL}isWidthWrap(){return this.mWidthMod?.getType()===ft.WRAP}isHeightWrap(){return this.mHeightMod?.getType()===pt.WRAP}isWidthExact(){let t=this.mWidthMod?.getType();return t===ft.EXACT||t===ft.EXACT_DP}isHeightExact(){let t=this.mHeightMod?.getType();return t===pt.EXACT||t===pt.EXACT_DP}hasWidthWeight(){return this.mWidthMod?.getType()===ft.WEIGHT}hasHeightWeight(){return this.mHeightMod?.getType()===pt.WEIGHT}getWidthModValue(){return this.mWidthMod?.getValue()??0}getHeightModValue(){return this.mHeightMod?.getValue()??0}hasComputedLayout(){return this.mComputedLayoutModifiers!==null}applyComputedLayout(t,i,r,n){if(this.mComputedLayoutModifiers!==null){let s=!1;for(let a of this.mComputedLayoutModifiers)a.getType()===t&&(s=a.applyToMeasure(i,r,n)||s);return s}return!1}minIntrinsicHeight(){let t=this.modifierDefinedHeight(!0);for(let i of this.mChildrenComponents)t=Math.max(t,i.minIntrinsicHeight());return t}minIntrinsicWidth(){let t=this.modifierDefinedWidth(!0);for(let i of this.mChildrenComponents)t=Math.max(t,i.minIntrinsicWidth());return t}modifierDefinedWidth(t=!1){let i=0,r=this.mWidthMod?.getType();if(this.mWidthMod&&this.mHasWidthOp){r===ft.EXACT||r===ft.EXACT_DP?i=this.mWidthMod.getValue():(r===ft.FILL||r===ft.FILL_PARENT_MAX_WIDTH)&&(i=t?0:Number.MAX_VALUE);let n=this.mWidthInMod;n&&n.getMin()>=0&&(i=Math.max(i,n.getMin()))}return this.mPadBeforeWidth+i}modifierDefinedHeight(t=!1){let i=0,r=this.mHeightMod?.getType();if(this.mHeightMod&&this.mHasHeightOp){r===pt.EXACT||r===pt.EXACT_DP?i=this.mHeightMod.getValue():(r===pt.FILL||r===pt.FILL_PARENT_MAX_HEIGHT)&&(i=t?0:Number.MAX_VALUE);let n=this.mHeightInMod;n&&n.getMin()>=0&&(i=Math.max(i,n.getMin()))}return this.mPadBeforeHeight+i}computeModifierDefinedWidth(){return this.isWidthExact()?this.getWidthModValue()+this.mPaddingLeft+this.mPaddingRight:-1}computeModifierDefinedHeight(){return this.isHeightExact()?this.getHeightModValue()+this.mPaddingTop+this.mPaddingBottom:-1}hoistNestedComponentValues(t){if(t instanceof vt)return;let i=t.getList;if(typeof i=="function")for(let r of i.call(t))r instanceof Gt?r.getComponentId2()===this.getComponentId()&&(this.mComponentValues===null&&(this.mComponentValues=[]),this.mComponentValues.push(r)):this.hoistNestedComponentValues(r)}updateComponentValues(t,i,r){if(this.mComponentValues!==null)for(let n of this.mComponentValues)switch(n.getType()){case Gt.WIDTH:t.loadFloat(n.getValueId(),i);break;case Gt.HEIGHT:t.loadFloat(n.getValueId(),r);break;case Gt.POS_X:t.loadFloat(n.getValueId(),this.mX);break;case Gt.POS_Y:t.loadFloat(n.getValueId(),this.mY);break;case Gt.POS_ROOT_X:{let s=this.getLocationInWindow();t.loadFloat(n.getValueId(),s[0]);break}case Gt.POS_ROOT_Y:{let s=this.getLocationInWindow();t.loadFloat(n.getValueId(),s[1]);break}case Gt.CONTENT_WIDTH:t.loadFloat(n.getValueId(),i-this.mPaddingLeft-this.mPaddingRight);break;case Gt.CONTENT_HEIGHT:t.loadFloat(n.getValueId(),r-this.mPaddingTop-this.mPaddingBottom);break}}layout(t,i){super.layout(t,i),this.updateComponentValues(t,this.mWidth,this.mHeight);for(let r of this.mChildrenComponents)r.layout(t,i);this.mNeedsMeasure=!1}animatingBounds(t){super.animatingBounds(t),this.updateComponentValues(t,this.mWidth,this.mHeight),this.layoutModifiers(this.mWidth,this.mHeight)}layoutModifiers(t,i){let r=t,n=i;for(let s of this.mComponentModifiers)s instanceof Pe&&(r-=s.mLeftValue+s.mRightValue,n-=s.mTopValue+s.mBottomValue),typeof s.layoutDecorator=="function"&&s.layoutDecorator(r,n)}drawContent(t){t.matrixSave(),t.matrixTranslate(-this.mX,-this.mY),this.paintingComponent(t),t.matrixRestore()}paint(t){if(this.applyAnimationAsNeeded(t)||tt.isGone(this.mVisibility)||tt.isInvisible(this.mVisibility))return;let i=this.mDrawContentOperations;if(i!==null&&i.some(n=>n instanceof Z)){t.matrixSave(),t.matrixTranslate(this.mX,this.mY);let n=t.getContext();for(let s of i)n.incrementOpCount(s),s.isDirty()&&typeof s.updateVariables=="function"&&(s.markNotDirty(),s.updateVariables(n)),s.apply(n);t.matrixRestore()}else if(this.mGraphicsLayerMod){let n=this.mGraphicsLayerMod;n.evaluate(t),t.matrixSave(),t.matrixTranslate(this.mX,this.mY),t.startGraphicsLayer(Math.trunc(this.getWidth()),Math.trunc(this.getHeight()));let s=new Map;n.fillInAttributes(s),t.setGraphicsLayer(s),t.matrixTranslate(-this.mX,-this.mY),this.paintingComponent(t),t.endGraphicsLayer(),t.matrixRestore()}else super.paint(t)}paintModifiers(t){let i=t.getContext(),r=0,n=0;for(let m of[this.mWidthMod,this.mHeightMod])m&&m.isDirty()&&(m.markNotDirty(),m.updateVariables(i));let s=this.mWidth,a=this.mHeight;for(let m of this.mComponentModifiers)i.incrementOpCount(m),m.isDirty()&&typeof m.updateVariables=="function"&&(m.markNotDirty(),m.updateVariables(i)),m instanceof Pe?(t.matrixTranslate(m.mLeftValue,m.mTopValue),r+=m.mLeftValue,n+=m.mTopValue,s-=m.mLeftValue+m.mRightValue,a-=m.mTopValue+m.mBottomValue):m instanceof ye||m instanceof Ie?(t.matrixTranslate(-r,-n),m.ripple.paint(t,i,this.mWidth,this.mHeight),t.matrixTranslate(r,n)):m instanceof Ue?m.ripple.paint(t,i,s,a):m.apply(i);t.matrixTranslate(-r,-n)}paintingComponent(t){if(tt.isGone(this.mVisibility)&&this.mAnimateMeasure===null)return;let i=t.getContext();t.matrixSave(),t.matrixTranslate(this.mX,this.mY),this.paintModifiers(t),t.matrixTranslate(this.mPaddingLeft,this.mPaddingTop);for(let a of this.mContentOps){let m=a instanceof Vi;m&&t.matrixTranslate(-this.mPaddingLeft,-this.mPaddingTop),i.incrementOpCount(a),a.isDirty()&&typeof a.updateVariables=="function"&&(a.markNotDirty(),a.updateVariables(i)),a.apply(i),m&&t.matrixTranslate(this.mPaddingLeft,this.mPaddingTop)}let r=this.mChildrenComponents,n=a=>(a.mAnimateMeasure!==null||!tt.isGone(a.mVisibility))&&this.isChildVisibleInViewport(a),s=a=>{a.isDirty()&&typeof a.updateVariables=="function"&&(a.updateVariables(i),a.markNotDirty()),n(a)&&(i.incrementOpCount(a),a.paint(t))};if(r.length>1){let a=!1;for(let m of r)if(m.mZIndex!==0){a=!0;break}if(a){let m=[...r].sort((u,l)=>u.mZIndex-l.mZIndex);for(let u of m)s(u)}else for(let m of r)s(m)}else for(let a of r)s(a);t.matrixRestore()}isChildVisibleInViewport(t){let i=this.mScrollModifier;if(!i)return!0;let r=t.getX(),n=t.getY(),s=t.getWidth(),a=t.getHeight();if(s<=0&&a<=0)return!0;if(i.isVertical()){let m=this.mHeight-this.mPaddingTop-this.mPaddingBottom;if(m<=0)return!0;let l=-i.getScrollY(),h=l+m;if(n+a<l||n>h)return!1}else{let m=this.mWidth-this.mPaddingLeft-this.mPaddingRight;if(m<=0)return!0;let l=-i.getScrollX(),h=l+m;if(r+s<l||r>h)return!1}return!0}updateVariables(t){this.mComponentValues!==null&&this.mComponentValues.length>0&&this.updateComponentValues(t,this.mWidth,this.mHeight),this.updatePadding()}updatePadding(){this.mPaddingLeft=0,this.mPaddingTop=0,this.mPaddingRight=0,this.mPaddingBottom=0,this.mPadBeforeWidth=0,this.mPadBeforeHeight=0;let t=!1,i=!1;for(let r of this.getList())r instanceof Pe?(this.mPaddingLeft+=r.mLeftValue,this.mPaddingTop+=r.mTopValue,this.mPaddingRight+=r.mRightValue,this.mPaddingBottom+=r.mBottomValue,t||(this.mPadBeforeWidth+=r.mLeftValue+r.mRightValue),i||(this.mPadBeforeHeight+=r.mTopValue+r.mBottomValue)):r instanceof ft?t=!0:r instanceof pt&&(i=!0)}getScrollX(){return this.mScrollModifier?this.mScrollModifier.getScrollX():0}getScrollY(){return this.mScrollModifier?this.mScrollModifier.getScrollY():0}onClick(t,i,r,n){if(!this.isVisible()||!(r>=this.mX&&r<=this.mX+this.mWidth&&n>=this.mY&&n<=this.mY+this.mHeight))return!1;let s=r-this.mX-this.mPaddingLeft-this.getScrollX(),a=n-this.mY-this.mPaddingTop-this.getScrollY();for(let m=this.mChildrenComponents.length-1;m>=0;m--){let u=this.mChildrenComponents[m];if(u instanceof vt&&u.onClick(t,i,s,a))return!0}{let m=!1;for(let u=this.mComponentModifiers.length-1;u>=0;u--){let l=this.mComponentModifiers[u];(l instanceof ye||l instanceof Ie)&&l.onClick(t,i,r-this.mX,n-this.mY)&&(m=!0)}return m}return!1}onTouchDown(t,i,r,n){return this.contains(r,n)?this.dispatchTouch(t,i,r,n,0,0,!0,"down"):!1}onTouchDrag(t,i,r,n,s){return!s&&!this.contains(r,n)?!1:this.dispatchTouch(t,i,r,n,0,0,s,"drag")}onTouchUp(t,i,r,n,s,a,m){return!m&&!this.contains(r,n)?!1:this.dispatchTouch(t,i,r,n,s,a,m,"up")}onTouchCancel(t,i,r,n,s){return!s&&!this.contains(r,n)?!1:this.dispatchTouch(t,i,r,n,0,0,s,"cancel")}dispatchTouch(t,i,r,n,s,a,m,u){let l=this.getLocationInWindow(),h=r-l[0],c=n-l[1],f=!1,d=!1;for(let p=this.mChildrenComponents.length-1;p>=0;p--){let b=this.mChildrenComponents[p];if(!(b instanceof o)||d)continue;(u==="down"?b.onTouchDown(t,i,r,n):u==="drag"?b.onTouchDrag(t,i,r,n,m):u==="up"?b.onTouchUp(t,i,r,n,s,a,m):b.onTouchCancel(t,i,r,n,m))&&(d=!0)}for(let p of this.mContentOps)p instanceof Ht&&this.deliverToExpression(p,t,h,c,s,a,u)&&(u==="down"&&i.appliedTouchOperation(this),f=!0);for(let p of this.mChildrenComponents)p instanceof o||this.dispatchToOps(p.getList(),t,i,h,c,s,a,u)&&(f=!0);for(let p of this.mComponentModifiers)u==="down"&&p instanceof Ue?(p.ripple.animate(t,h,c),f=!0):u==="down"&&p instanceof _e?(p.onTouchDown(t),f=!0):u==="down"&&(p instanceof le||p instanceof he)?(i.modifierTouchTarget?.(this),f=!0):u==="up"&&p instanceof le?(p.onTouchUp(t),i.touchModifierRan?.(this),f=!0):u==="cancel"&&p instanceof he&&(p.onTouchCancel(t),i.touchModifierRan?.(this),f=!0);return this.mScrollModifier&&(u==="down"?(this.mScrollModifier.onTouchDown(t,h,c),i.appliedTouchOperation(this),f=!0):u==="drag"?this.mScrollModifier.onTouchDrag(t,h,c)&&(f=!0):u==="up"?this.mScrollModifier.onTouchUp(t,h,c,s,a)&&(f=!0):this.mScrollModifier.onTouchCancel(t,h,c)&&(f=!0)),d||f}runOwnTouchModifiers(t,i){for(let r of this.mComponentModifiers)i==="up"&&r instanceof le?r.onTouchUp(t):i==="cancel"&&r instanceof he&&r.onTouchCancel(t)}deliverToExpression(t,i,r,n,s,a,m){return t.updateVariables(i),m==="down"?t.touchDown(i,r,n):m==="drag"?t.touchDrag(i,r,n):m==="up"?t.touchUp(i,r,n,s,a):t.touchUp(i,r,n,0,0),!0}dispatchToOps(t,i,r,n,s,a,m,u){let l=!1;for(let h of t)h instanceof Ht?(this.deliverToExpression(h,i,n,s,a,m,u),u==="down"&&r.appliedTouchOperation(this),l=!0):typeof h.getList=="function"&&this.dispatchToOps(h.getList(),i,r,n,s,a,m,u)&&(l=!0);return l}dispatchTouchDownToOps(t,i,r,n,s){let a=!1;for(let m of t)m instanceof Ht?(m.updateVariables(i),m.touchDown(i,n,s),r.appliedTouchOperation(this),a=!0):typeof m.getList=="function"&&(a=this.dispatchTouchDownToOps(m.getList(),i,r,n,s)||a);return a}getLocationInWindow(){let t=this.mX+this.mPaddingLeft,i=this.mY+this.mPaddingTop,r=this.getParent();for(;r;)t+=r.mX,i+=r.mY,r instanceof o&&(t+=r.mPaddingLeft+r.getScrollX(),i+=r.mPaddingTop+r.getScrollY()),r=r.getParent();return[t,i]}};var jr=class{constructor(){this.mList=new Map}clear(){this.mList.clear()}add(e){if(e.mId===-1)throw new Error("Component has no id!");this.mList.set(e.mId,e)}contains(e){return this.mList.has(e)}get(e){if(typeof e=="number"){let n=this.mList.get(e);return n||(n=new ke(e,0,0,0,0,ke.GONE),this.mList.set(e,n)),n}let t=e,i=t.getComponentId(),r=this.mList.get(i);return r||(r=new ke(i,t.getX(),t.getY(),t.getWidth(),t.getHeight(),t.getVisibility()&15),this.mList.set(i,r)),r}};var ii=class o extends vt{constructor(t=-1){super(t);this.mCurrentId=-1;this.measuredContent=null;this.mHasTouchListeners=!1}static{this.OP_CODE=200}getHasTouchListeners(){return this.mHasTouchListeners}setHasTouchListeners(t){this.mHasTouchListeners=t}assignIds(t){this.mCurrentId=t,this.assignId(this)}assignId(t){t.getComponentId()===-1&&(this.mCurrentId--,t.mComponentId=this.mCurrentId);for(let i of t.getList())i instanceof vt&&this.assignId(i)}invalidateMeasure(){this.mNeedsMeasure=!0,this.invalidateMeasureChildren(this)}invalidateMeasureChildren(t){t.mNeedsMeasure=!0;for(let i of t.getList())i instanceof vt&&this.invalidateMeasureChildren(i)}layoutTree(t){if(!this.mNeedsMeasure)return;this.mNeedsMeasure=!1,this.setWidth(t.mWidth),this.setHeight(t.mHeight),t.mViewportWidth=t.mWidth,t.mViewportHeight=t.mHeight;let i=new jr,r;for(let n of this.getList())if(typeof n.measure=="function"){let s=t.getPaintContext();s&&(!r&&n instanceof vt&&(r=n),n.measure(s,0,this.mWidth,0,this.mHeight,i),typeof n.layout=="function"&&n.layout(t,i))}this.recordContentMeasurement(r,i)}getMeasuredContentSize(){return this.measuredContent?{...this.measuredContent}:null}recordContentMeasurement(t,i){if(this.measuredContent=null,!t)return;let r=[t],n=new Set;for(;r.length;){let a=r.pop();if(!n.has(a)){if(n.add(a),a instanceof ct){let m=a.getHeightModifier()?.getType();if(a.getScrollModifier()||m===pt.FILL||m===pt.WEIGHT)return;r.push(...a.mChildrenComponents)}for(let m of a.getList())m instanceof vt&&r.push(m)}}let s=i.get(t);this.measuredContent={width:s.getW(),height:s.getH()}}measureDoc(t,i,r,n,s){this.mNeedsMeasure=!1,this.setWidth(t.mWidth),this.setHeight(t.mHeight),t.mViewportWidth=t.mWidth,t.mViewportHeight=t.mHeight;let a=new jr,m=null;for(let u of this.getList())if(typeof u.measure=="function"){m===null&&u instanceof vt&&(m=u);let l=t.getPaintContext();l&&(u.measure(l,i,r,n,s,a),typeof u.layout=="function"&&u.layout(t,a))}m&&(this.setWidth(m.getWidth()),this.setHeight(m.getHeight()))}paint(t){this.mNeedsRepaint=!1;let i=t.getContext();t.save(),this.getParent()||t.clipRect(0,0,this.mWidth,this.mHeight);for(let r of this.getList())r instanceof Z&&(r.paint(t),i.incrementOpCount(r));t.restore()}getComponent(t){let i=[this];for(;i.length>0;){let r=i.shift();if(r.getComponentId()===t)return r;for(let n of r.getList())n instanceof vt&&i.push(n)}return null}displayHierarchy(){return`RootLayout(${this.getWidth()}x${this.getHeight()})`}onClick(t,i,r,n){for(let s of this.getList())if(typeof s.onClick=="function"&&s.onClick(t,i,r,n))return!0;return!1}onTouchDown(t,i,r,n){for(let s of this.getList())if(typeof s.onTouchDown=="function"&&s.onTouchDown(t,i,r,n))return!0;return!1}write(t){t.start(o.OP_CODE),t.writeInt(this.getComponentId())}deepToString(t){return`${t}RootLayoutComponent(${this.getComponentId()})`}static read(t,i){let r=t.declareId(),n=new o(r);i.push(n)}};var Go=class{constructor(e){this.mLastAnimationTime=-1;this.mClock=e,this.mStartTime=performance.now()/1e3}getClock(){return this.mClock}getElapsedSeconds(){return performance.now()/1e3-this.mStartTime}updateTime(e){let t=this.mClock.snapshot();e.loadFloat(st.ID_OFFSET_TO_UTC,t.getOffsetSeconds()),e.loadFloat(st.ID_CONTINUOUS_SEC,t.getContinuousSeconds()),e.loadInteger(st.ID_EPOCH_SECOND,t.getEpochSeconds()),e.loadFloat(st.ID_TIME_IN_SEC,t.getTimeInSec()),e.loadFloat(st.ID_TIME_IN_MIN,t.getTimeInMin()),e.loadFloat(st.ID_TIME_IN_HR,t.getHour()),e.loadFloat(st.ID_CALENDAR_MONTH,t.getMonth()),e.loadFloat(st.ID_DAY_OF_MONTH,t.getDayOfMonth()),e.loadFloat(st.ID_WEEK_DAY,t.getDayOfWeek()),e.loadFloat(st.ID_DAY_OF_YEAR,t.getDayOfYear()),e.loadFloat(st.ID_YEAR,t.getYear());let i=this.getElapsedSeconds(),r=this.mLastAnimationTime>=0?i-this.mLastAnimationTime:0;this.mLastAnimationTime=i,e.loadFloat(st.ID_ANIMATION_TIME,i),e.setAnimationTime(i),e.loadFloat(st.ID_ANIMATION_DELTA_TIME,r),e.loadFloat(st.ID_API_LEVEL,ri.DOCUMENT_API_LEVEL)}};var Pu=3145728;function _u(o){if(!O(o))return!1;let e=x(o);return e>=10&&e<=17||e>=Pu&&e<=Pu+6}var Re=class o extends D{static{this.OP_CODE=102}constructor(e,t){super(),this.mTextId=e,this.mText=t}update(e){this.mText=e.mText}write(e){}apply(e){e.loadText(this.mTextId,this.mText)}deepToString(e){return`${e}TextData(${this.mTextId}, "${this.mText}")`}static read(e,t){let i=e.declareId(),r=e.readUTF8();t.push(new o(i,r))}},oe=class o extends D{static{this.OP_CODE=101}constructor(e,t,i,r,n,s){super(),this.mImageId=e,this.mEncoding=t,this.mType=i,this.mWidth=r,this.mHeight=n,this.mBitmap=s}getWidth(){return this.mWidth}getHeight(){return this.mHeight}update(e){this.mEncoding=e.mEncoding,this.mType=e.mType,this.mWidth=e.mWidth,this.mHeight=e.mHeight,this.mBitmap=e.mBitmap}write(e){}apply(e){e.putObject(this.mImageId,this),e.loadBitmap(this.mImageId,this.mEncoding,this.mType,this.mWidth,this.mHeight,this.mBitmap)}deepToString(e){return`${e}BitmapData(${this.mImageId}, ${this.mWidth}x${this.mHeight})`}static read(e,t){let i=e.readId(),r=e.readInt(),n=e.readInt(),s=0,a=0;r>65535&&(s=r>>16,r=r&65535),n>65535&&(a=n>>16,n=n&65535);let m=e.readBuffer();t.push(new o(i,a,s,r,n,m))}},Kr=class o extends D{static{this.OP_CODE=40}constructor(e){super(),this.mPaintBundle=e}write(e){}registerListening(e){this.mPaintBundle.registerListening(e,this)}updateVariables(e){this.mPaintBundle.updateVariables(e)}apply(e){e.mMode!=="DATA"&&e.getPaintContext()?.applyPaint(this.mPaintBundle)}deepToString(e){return`${e}PaintData`}static read(e,t){let i=new ot;i.read(e),t.push(new o(i))}},qr=class o extends D{constructor(t,i,r){super();this.mPathChanged=!1;this.mPathId=t,this.mWinding=i,this.mPathBits=r,this.mOutputPath=Int32Array.from(r)}static{this.OP_CODE=123}write(t){}registerListening(t){for(let i of this.mPathBits)O(i)&&!_u(i)&&t.listensTo(x(i),this)}updateVariables(t){for(let i=0;i<this.mPathBits.length;i++){let r=this.mPathBits[i];if(_u(r))this.mOutputPath[i]=r;else if(O(r)){let n=this.mOutputPath[i];this.mOutputPath[i]=et(t.getFloat(x(r))),n!==this.mOutputPath[i]&&(this.mPathChanged=!0)}else this.mOutputPath[i]=r}}apply(t){t.loadPathData(this.mPathId,this.mWinding,this.mOutputPath)}deepToString(t){return`${t}PathData(${this.mPathId})`}static read(t,i){let r=t.readInt(),n=r>>24,s=t.getRemapContext?.(),a=s?s.resolveId(r&16777215):r&16777215,m=t.readInt();if(m<0||m>2e4)throw new Error(`PathData: invalid path length ${m}`);let u=new Int32Array(m);for(let l=0;l<m;l++){let h=t.readInt();u[l]=s&&O(h)&&x(h)>16?s.resolveNanIdBits(h):h}i.push(new o(a,n,u))}},Ye=class o extends D{static{this.OP_CODE=80}static{this.RAND_ID=3211303}constructor(e,t){super(),this.mId=e,this.mValue=O(t)&&x(t)===o.RAND_ID?Math.random():F(t)}update(e){this.mValue=e.mValue}write(e){}apply(e){e.loadFloat(this.mId,this.mValue)}deepToString(e){return`${e}FloatConstant(${this.mId}, ${this.mValue})`}static read(e,t){let i=e.declareId(),r=e.readNanIdBits();t.push(new o(i,r))}},Wi=class o extends D{static{this.OP_CODE=138}constructor(e,t){super(),this.mId=e,this.mColor=t}write(e){}apply(e){e.loadColor(this.mId,this.mColor)}deepToString(e){return`${e}ColorConstant(${this.mId})`}static read(e,t){t.push(new o(e.declareId(),e.readInt()))}},Vt=class o extends D{static{this.OP_CODE=63}static{this.UNSPECIFIED=-1}static{this.DARK=-2}static{this.LIGHT=-3}static{this.SYSTEM=0}constructor(e){super(),this.mTheme=e}write(e){}apply(e){e.setTheme(this.mTheme)}deepToString(e){return`${e}Theme(${this.mTheme})`}static read(e,t){t.push(new o(e.readInt()))}},Zr=class o extends D{static{this.OP_CODE=64}constructor(e,t,i,r,n,s,a){super(),this.mId=e,this.mContentDescriptionId=t,this.mLeft=i,this.mTop=r,this.mRight=n,this.mBottom=s,this.mOutLeft=O(i)?0:F(i),this.mOutTop=O(r)?0:F(r),this.mOutRight=O(n)?0:F(n),this.mOutBottom=O(s)?0:F(s),this.mMetadataId=a}write(e){}registerListening(e){O(this.mLeft)&&e.listensTo(x(this.mLeft),this),O(this.mTop)&&e.listensTo(x(this.mTop),this),O(this.mRight)&&e.listensTo(x(this.mRight),this),O(this.mBottom)&&e.listensTo(x(this.mBottom),this)}updateVariables(e){this.mOutLeft=O(this.mLeft)?e.getFloat(x(this.mLeft)):F(this.mLeft),this.mOutTop=O(this.mTop)?e.getFloat(x(this.mTop)):F(this.mTop),this.mOutRight=O(this.mRight)?e.getFloat(x(this.mRight)):F(this.mRight),this.mOutBottom=O(this.mBottom)?e.getFloat(x(this.mBottom)):F(this.mBottom)}apply(e){e.mMode!=="DATA"&&e.addClickArea(this.mId,this.mContentDescriptionId,this.mOutLeft,this.mOutTop,this.mOutRight,this.mOutBottom,this.mMetadataId)}deepToString(e){return`${e}ClickArea(${this.mId})`}static read(e,t){t.push(new o(e.declareId(),e.readId(),e.readNanIdBits(),e.readNanIdBits(),e.readNanIdBits(),e.readNanIdBits(),e.readId()))}},ki=class o extends D{static{this.OP_CODE=137}static{this.STRING_TYPE=0}static{this.FLOAT_TYPE=1}static{this.COLOR_TYPE=2}static{this.IMAGE_TYPE=3}static{this.INT_TYPE=4}static{this.LONG_TYPE=5}static{this.FLOAT_ARRAY_TYPE=6}constructor(e,t,i){super(),this.mVarName=e,this.mVarId=t,this.mVarType=i}write(e){}apply(e){e.loadVariableName(this.mVarName,this.mVarId,this.mVarType)}deepToString(e){return`${e}NamedVariable("${this.mVarName}", ${this.mVarId})`}static read(e,t){let i=e.declareId(),r=e.readInt(),n=e.readUTF8();t.push(new o(n,i,r))}},Qr=class o extends D{static{this.OP_CODE=103}constructor(e){super(),this.mContentDescription=e}write(e){}apply(e){e.setDocumentContentDescription(this.mContentDescription)}deepToString(e){return`${e}RootContentDescription(${this.mContentDescription})`}static read(e,t){t.push(new o(e.readId()))}},Ot=class o extends D{static{this.OP_CODE=65}static{this.NONE=0}static{this.SIZING_LAYOUT=1}static{this.SIZING_SCALE=2}static{this.ALIGNMENT_TOP=1}static{this.ALIGNMENT_VERTICAL_CENTER=2}static{this.ALIGNMENT_BOTTOM=4}static{this.ALIGNMENT_START=16}static{this.ALIGNMENT_HORIZONTAL_CENTER=32}static{this.ALIGNMENT_END=64}static{this.ALIGNMENT_CENTER=34}static{this.SCALE_INSIDE=1}static{this.SCALE_FIT=2}static{this.SCALE_FILL_WIDTH=3}static{this.SCALE_FILL_HEIGHT=4}static{this.SCALE_CROP=5}static{this.SCALE_FILL_BOUNDS=6}static{this.LAYOUT_MATCH_PARENT=0}static{this.LAYOUT_WRAP_CONTENT=1}constructor(e,t,i,r){super(),this.mScroll=e,this.mAlignment=t,this.mSizing=i,this.mMode=r}write(e){}apply(e){e.setRootContentBehavior(this.mScroll,this.mAlignment,this.mSizing,this.mMode)}deepToString(e){return`${e}RootContentBehavior`}static read(e,t){t.push(new o(e.readInt(),e.readInt(),e.readInt(),e.readInt()))}};var Jr=class o extends Z{constructor(t,i){super();this.mList=[];this.mProcess=null;this.mInitialPass=!0;this.mDuration=t,this.mStartAt=i,this.mOutDuration=t,this.mOutStartAt=i}static{this.OP_CODE=164}getList(){return this.mList}updateVariables(t){this.mOutDuration=Number.isNaN(this.mDuration)?t.getFloat(x(et(this.mDuration))):this.mDuration,this.mOutStartAt=Number.isNaN(this.mStartAt)?t.getFloat(x(et(this.mStartAt))):this.mStartAt}takeProcess(){if(this.mProcess||!this.mList.length)return;let t=this.mList[this.mList.length-1];t instanceof br&&(this.mProcess=t,this.mList.pop())}write(t){}paint(t){this.takeProcess();let i=t.getContext(),r=i.getAnimationTime();if(r<this.mOutStartAt){t.wakeIn(this.mOutStartAt-r);return}if(r<=this.mOutStartAt+this.mOutDuration)if(t.needsRepaint(),this.mInitialPass){for(let n of this.mList)n.isDirty()&&typeof n.updateVariables=="function"&&n.updateVariables(i),i.incrementOpCount(n),n.apply(i);this.mInitialPass=!1}else i.incrementOpCount(this),this.mProcess&&this.mProcess.paint(t);else this.mInitialPass=!0}deepToString(t){return`${t}ImpulseOperation(${this.mList.length} setup ops)`}static read(t,i){let r=F(t.readNanIdBits()),n=F(t.readNanIdBits());i.push(new o(r,n))}},br=class o extends Z{constructor(){super();this.mList=[]}static{this.OP_CODE=165}getList(){return this.mList}write(t){}paint(t){let i=t.getContext();for(let r of this.mList)r.isDirty()&&typeof r.updateVariables=="function"&&r.updateVariables(i),i.incrementOpCount(r),r.apply(i)}deepToString(t){return`${t}ImpulseProcess(${this.mList.length})`}static read(t,i){i.push(new o)}},ni=class o extends D{static{this.OP_CODE=179}constructor(){super()}write(e){}apply(e){}deepToString(e){return`${e}DebugMessage`}static read(e,t){e.readId(),F(e.readNanIdBits()),e.readInt(),t.push(new o)}},tn=class o extends D{static{this.OP_CODE=216}constructor(){super()}write(e){}apply(e){}deepToString(e){return`${e}HostActionMetadataOperation`}static read(e,t){e.readId(),e.readId(),t.push(new o)}},en=class o extends Z{constructor(){super();this.mList=[]}static{this.OP_CODE=236}getList(){return this.mList}write(t){}paint(t){let i=t.getContext();for(let r of this.mList)i.incrementOpCount(r),r.apply(i)}deepToString(t){return`${t}RunActionOperation(${this.mList.length} actions)`}static read(t,i){i.push(new o)}},rn=class o extends D{static{this.OP_CODE=227}constructor(e,t){super(),this.mTargetValueId=e,this.mValueExpressionId=t}write(e){}apply(e){if(e.mMode==="DATA")return;let t=e.getDocument();t&&t.evaluateFloatExpression(this.mValueExpressionId,this.mTargetValueId,e)}runAction(e,t,i,r,n){t?.evaluateFloatExpression(this.mValueExpressionId,this.mTargetValueId,e)}deepToString(e){return`${e}ValueFloatExpressionChangeAction(${this.mTargetValueId} <- ${this.mValueExpressionId})`}static read(e,t){let i=e.readId(),r=e.readId();t.push(new o(i,r))}},nn=class o extends Z{static{this.OP_CODE=158}constructor(e,t,i,r){super(),this.mOutId=e,this.mPathId1=t,this.mPathId2=i,this.mTween=r,this.mTweenOut=F(r)}write(e){e.start(o.OP_CODE),e.writeInt(this.mOutId),e.writeInt(this.mPathId1),e.writeInt(this.mPathId2),e.writeInt(this.mTween)}updateVariables(e){this.mTweenOut=O(this.mTween)?e.getFloat(x(this.mTween)):F(this.mTween)}registerListening(e){O(this.mTween)&&e.listensTo(x(this.mTween),this)}paint(e){e.tweenPath(this.mOutId,this.mPathId1,this.mPathId2,this.mTweenOut)}deepToString(e){return`${e}PathTween[${this.mOutId}] = [${this.mPathId1}] + [${this.mPathId2}], ${this.mTweenOut}`}static read(e,t){let i=e.readId(),r=e.readId(),n=e.readId(),s=e.readNanIdBits();t.push(new o(i,r,n,s))}},sn=class o extends D{static{this.OP_CODE=177}constructor(){super()}write(e){}apply(e){}deepToString(e){return`${e}HapticFeedback`}static read(e,t){e.readId(),t.push(new o)}},on=class o extends Z{static{this.OP_CODE=191}constructor(e){super(),this.mWakeBits=e,this.mWakeOut=F(e)}write(e){e.start(o.OP_CODE),e.writeInt(this.mWakeBits)}updateVariables(e){this.mWakeOut=O(this.mWakeBits)?e.getFloat(x(this.mWakeBits)):F(this.mWakeBits)}registerListening(e){O(this.mWakeBits)&&e.listensTo(x(this.mWakeBits),this)}paint(e){e.wakeIn(this.mWakeOut)}deepToString(e){return`${e}WakeIn(${this.mWakeOut})`}static read(e,t){t.push(new o(e.readNanIdBits()))}},an=class o extends Z{static{this.OP_CODE=172}static{this.TIME_FROM_NOW_SEC=0}static{this.TIME_FROM_NOW_MIN=1}static{this.TIME_FROM_NOW_HR=2}static{this.TIME_FROM_ARG_SEC=3}static{this.TIME_FROM_ARG_MIN=4}static{this.TIME_FROM_ARG_HR=5}static{this.TIME_IN_SEC=6}static{this.TIME_IN_MIN=7}static{this.TIME_IN_HR=8}static{this.TIME_DAY_OF_MONTH=9}static{this.TIME_MONTH_VALUE=10}static{this.TIME_DAY_OF_WEEK=11}static{this.TIME_YEAR=12}static{this.TIME_FROM_LOAD_SEC=14}static{this.TIME_DAY_OF_YEAR=15}constructor(e,t,i,r){super(),this.mId=e,this.mTimeId=t,this.mType=i,this.mArgs=r}write(e){}paint(e){let t=this.mType&255,i=e.getContext(),r=i.getDocLoadTime(),n=i.getObject(this.mTimeId),s=e.getClock().snapshot(),a=n&&typeof n.getValue=="function"?fr(n.getValue()):s,m=0;switch(t){case o.TIME_FROM_NOW_SEC:case o.TIME_FROM_NOW_MIN:case o.TIME_FROM_NOW_HR:m=a.getMillis()-s.getMillis();break;case o.TIME_FROM_ARG_SEC:case o.TIME_FROM_ARG_MIN:case o.TIME_FROM_ARG_HR:{let u=i.getObject(this.mArgs[0]);m=a.getMillis()-(u&&typeof u.getValue=="function"?u.getValue():0);break}default:break}switch(t){case o.TIME_FROM_NOW_SEC:case o.TIME_FROM_ARG_SEC:i.loadFloat(this.mId,m*.001),i.needsRepaint?.();break;case o.TIME_FROM_NOW_MIN:case o.TIME_FROM_ARG_MIN:i.loadFloat(this.mId,m*.001/60),i.needsRepaint?.();break;case o.TIME_FROM_NOW_HR:case o.TIME_FROM_ARG_HR:i.loadFloat(this.mId,m*.001/3600);break;case o.TIME_IN_SEC:i.loadFloat(this.mId,a.getSecond());break;case o.TIME_IN_MIN:i.loadFloat(this.mId,a.getMinute());break;case o.TIME_IN_HR:i.loadFloat(this.mId,a.getHour());break;case o.TIME_DAY_OF_MONTH:i.loadFloat(this.mId,a.getDayOfMonth());break;case o.TIME_DAY_OF_YEAR:i.loadFloat(this.mId,a.getDayOfYear());break;case o.TIME_MONTH_VALUE:i.loadFloat(this.mId,a.getMonth()-1);break;case o.TIME_DAY_OF_WEEK:i.loadFloat(this.mId,a.getDayOfWeek()-1);break;case o.TIME_YEAR:i.loadFloat(this.mId,a.getYear());break;case o.TIME_FROM_LOAD_SEC:i.loadFloat(this.mId,(a.getMillis()-r)*.001),i.needsRepaint?.();break;default:break}}deepToString(e){return`${e}TimeAttribute[${this.mId}] = ${this.mTimeId} ${this.mType}`}static read(e,t){let i=e.readId(),r=e.readId(),n=e.readShort(),s=e.readShort(),a=[];for(let m=0;m<s;m++)a.push(e.readId());t.push(new o(i,r,n,a))}};var Be=class o extends D{constructor(t){super();this.mList=[];this.mBody=null;this.mId=t}static{this.OP_CODE=142}getId(){return this.mId}setId(t){this.mId=t}getList(){return this.mList}setBody(t){this.mBody=t}getBody(){return this.mBody}write(t){}apply(t){let i=t;typeof i.putObject=="function"&&i.putObject(this.mId,this)}materialize(t,i,r){super.materialize(t,i,r)}deepToString(t){let i=`${t}ReferencedOperations[${this.mId}]
|
|
67
|
+
`;for(let r of this.mList)i+=r.deepToString(t+" ")+`
|
|
68
|
+
`;return i}static read(t,i){i.push(new o(t.declareId()))}},mn=class o extends D{constructor(t,i){super();this.mList=[];this.mId=t,this.mArgIds=i}static{this.OP_CODE=247}getId(){return this.mId}getArgIds(){return this.mArgIds}getList(){return this.mList}write(t){}apply(t){}materialize(t,i,r){let n=r.resolve(this,t.getDocument());if(n===null){i.push(this);return}let s=n.getBody();if(s===null||s.length===0)return;let a=t.getRemapContext().fork().withInsideMacro(!0),m=n.getParamIds(),u=this.mArgIds,l=Math.min(m.length,u.length);for(let f=0;f<l;f++)a.addMapping(m[f],u[f]);t.recordBlocks(this);let h=t.inflateBody(s,a);if(!h||h.length===0)return;Ha(t,r,a,t.getBlocksForCall(this),t.getDepth()+1).expandRecursive(h,i,r)}deepToString(t){let i=`${t}MacroCall[${this.mId}]
|
|
69
|
+
`;for(let r of this.mList)i+=r.deepToString(t+" ")+`
|
|
70
|
+
`;return i}static read(t,i){let r=t.readId(),n=t.readInt(),s=new Int32Array(n);for(let a=0;a<n;a++)s[a]=t.readId();i.push(new o(r,s))}},si=class o extends D{constructor(t){super();this.mList=[];this.mParamIndex=t}static{this.OP_CODE=249}getParamIndex(){return this.mParamIndex}getList(){return this.mList}write(t){}apply(t){}materialize(t,i,r){}deepToString(t){let i=`${t}MacroBlock[${this.mParamIndex}]
|
|
71
|
+
`;for(let r of this.mList)i+=r.deepToString(t+" ")+`
|
|
72
|
+
`;return i}static read(t,i){i.push(new o(t.readInt()))}},Hi=class o extends D{constructor(t,i){super();this.mList=[];this.mBody=null;this.mCollectionId=t,this.mLocalItemId=i}static{this.OP_CODE=244}getCollectionId(){return this.mCollectionId}getLocalItemId(){return this.mLocalItemId}getList(){return this.mList}setBody(t){this.mBody=t}getBody(){return this.mBody}write(t){}apply(t){}materialize(t,i,r){let n=t.getDocument().getArray(this.mCollectionId);if(n===null)return;let s=this.mBody;if(s===null||s.length===0)return;let a=n.getLength();for(let m=0;m<a;m++){let u=t.getRemapContext().fork().withInsideMacro(!0);u.addMapping(this.mLocalItemId,n.getId(m));let h=t.inflateBody(s,u).filter(f=>!(f instanceof Ct));Ha(t,r,u,new Map,t.getDepth()).expandRecursive(h,i,r)}}deepToString(t){let i=`${t}MacroForEach[coll=${this.mCollectionId}, item=${this.mLocalItemId}]
|
|
73
|
+
`;for(let r of this.mList)i+=r.deepToString(t+" ")+`
|
|
74
|
+
`;return i}static read(t,i){let r=t.readId(),n=t.readId();i.push(new o(r,n))}},un=class o extends D{static{this.OP_CODE=245}constructor(e){super(),this.mId=e}getReferenceId(){return this.mId}write(e){}apply(e){}materialize(e,t,i){let r=e.getDocument().getReferencedOperationsObject(this.mId);if(r instanceof Be){let s=r.getBody();if(s!==null&&s.length>0){let a=e.getRemapContext().fork().withInsideMacro(!0),u=e.inflateBody(s,a).filter(h=>!(h instanceof Ct));Ha(e,i,a,new Map,e.getDepth()+1).expandRecursive(u,t,i);return}}super.materialize(e,t,i)}deepToString(e){return`${e}IncludeReferencedOperations[${this.mId}]`}static read(e,t){t.push(new o(e.readId()))}},ln=class o extends D{static{this.OP_CODE=248}constructor(e){super(),this.mParamIndex=e}getParamIndex(){return this.mParamIndex}write(e){}apply(e){}materialize(e,t,i){let r=e.getBlock(this.mParamIndex);r!==null&&e.expandRecursive(r,t,i)}deepToString(e){return`${e}MacroArgument[${this.mParamIndex}]`}static read(e,t){t.push(new o(e.readInt()))}},Ui=class o extends D{constructor(t,i,r,n){super();this.mList=[];this.mId=t,this.mParamIds=i,this.mBody=r,this.mIsContainer=n,n&&(this.getList=()=>this.mList)}static{this.OP_CODE=246}getId(){return this.mId}getParamIds(){return this.mParamIds}getBody(){return this.mBody}setBody(t){this.mBody=t}isContainerForm(){return this.mIsContainer}write(t){}apply(t){}materialize(t,i,r){let n=t.getDocument().getText(this.mId)??null;r.add(this,n)}deepToString(t){return`${t}MacroDefine[${this.mId}]${this.mBody.length>0?` [body: ${this.mBody.length} bytes]`:""}`}static read(t,i){let r=t.readId(),n=t.readInt();if(n<0)throw new Error(`PatternDefine: invalid paramCount ${n}`);let s=new Int32Array(n);for(let l=0;l<n;l++)s[l]=t.readId();let a=t.readInt(),m=new Uint8Array(0),u=a===0;if(a>0){let l=t.getIndex();m=t.getBuffer().slice(l,l+a),t.setIndex(l+a)}i.push(new o(r,s,m,u))}};function Ha(o,e,t,i,r){let n=o.constructor;return new n(e,o.getDocument(),t,i,o.isSafeMode(),r)}var Yo=(o,e)=>o[e]<<24|o[e+1]<<16|o[e+2]<<8|o[e+3]|0,Xo=(o,e)=>o[e]<<8|o[e+1];function Ru(o){if(o.length<17||o[0]!==0||(Yo(o,1)&4294901760)!==76283904)return null;let e=Yo(o,13),t=17,i=null;for(let r=0;r<e;r++){if(t+4>o.length)throw new Error("Malformed header properties");let n=Xo(o,t),s=Xo(o,t+2),a=t+4+s;if(a>o.length)throw new Error("Malformed header properties");(n&63)===31&&n>>10===0&&s===4&&(i=Yo(o,t+4)),t=a}return{end:t,compression:i,count:e}}function Ya(o){try{let e=Ru(o);return!!e&&e.compression!==null&&e.compression!==0}catch{return!1}}function Xa(o){let e=Ru(o);if(!e||e.compression===null||e.compression===0)return o;if(e.compression!==1)throw new Error(`Unsupported document compression ${e.compression}`);let t=[];for(let a=0;a<13;a++)t.push(o[a]);let i=[],r=0;for(let a=0,m=17;a<e.count;a++){let u=Xo(o,m),l=m+4+Xo(o,m+2);if((u&63)!==31){for(let h=m;h<l;h++)i.push(o[h]);r++}m=l}let n=Hc(o.subarray(e.end),33554432),s=new Uint8Array(t.length+4+i.length+n.length);return s.set(t,0),s.set([r>>>24&255,r>>>16&255,r>>>8&255,r&255],t.length),s.set(i,t.length+4),s.set(n,t.length+4+i.length),s}function Hc(o,e=33554432){if(o.length<6)throw new Error("Truncated compressed document");let t=o[0],i=o[1];if((t&15)!==8||t>>4>7||(t<<8|i)%31!==0)throw new Error("Corrupted compressed document");if(i&32)throw new Error("Corrupted compressed document");let r=new Ga(o,2,e);r.run();let n=r.byteEnd();if(n+4>o.length)throw new Error("Truncated compressed document");let s=r.result();if(Yo(o,n)>>>0!==Uc(s))throw new Error("Corrupted compressed document");if(n+4!==o.length)throw new Error("Unexpected data after the compressed document");return s}function Uc(o){let e=1,t=0;for(let i=0;i<o.length;){let r=Math.min(o.length,i+3800);for(;i<r;i++)e+=o[i],t+=e;e%=65521,t%=65521}return(t<<16|e)>>>0}var Gc=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258],Yc=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],Xc=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],$c=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],zc=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Gi=class{constructor(e,t){this.counts=new Uint16Array(16);this.symbols=new Uint16Array(t);for(let n=0;n<t;n++)this.counts[e[n]]++;this.counts[0]=0;let i=1;for(let n=1;n<16;n++)if(i=(i<<1)-this.counts[n],i<0)throw new Error("Corrupted compressed document");let r=new Uint16Array(16);for(let n=1;n<15;n++)r[n+1]=r[n]+this.counts[n];for(let n=0;n<t;n++)e[n]&&(this.symbols[r[e[n]]++]=n)}},Ua=null;function jc(){if(!Ua){let o=new Uint8Array(288);o.fill(8,0,144),o.fill(9,144,256),o.fill(7,256,280),o.fill(8,280,288),Ua=[new Gi(o,288),new Gi(new Uint8Array(30).fill(5),30)]}return Ua}var Ga=class{constructor(e,t,i){this.src=e;this.max=i;this.bitBuf=0;this.bitCnt=0;this.n=0;this.pos=t,this.out=new Uint8Array(Math.min(i,Math.max(1024,e.length*4)))}bits(e){for(;this.bitCnt<e;){if(this.pos>=this.src.length)throw new Error("Truncated compressed document");this.bitBuf|=this.src[this.pos++]<<this.bitCnt,this.bitCnt+=8}let t=this.bitBuf&(1<<e)-1;return this.bitBuf>>>=e,this.bitCnt-=e,t}decode(e){let t=0,i=0,r=0;for(let n=1;n<16;n++){t|=this.bits(1);let s=e.counts[n];if(t-s<i)return e.symbols[r+(t-i)];r+=s,i=i+s<<1,t<<=1}throw new Error("Corrupted compressed document")}put(e){if(this.n>=this.out.length){if(this.n>=this.max)throw new Error(`Decompressed document exceeds ${this.max} bytes`);let t=new Uint8Array(Math.min(this.max,this.out.length*2));t.set(this.out),this.out=t}this.out[this.n++]=e}run(){let e=0;for(;!e;){e=this.bits(1);let t=this.bits(2);if(t===0)this.stored();else if(t===1){let[i,r]=jc();this.codes(i,r)}else if(t===2)this.dynamic();else throw new Error("Corrupted compressed document")}}stored(){if(this.bitBuf=0,this.bitCnt=0,this.pos+4>this.src.length)throw new Error("Truncated compressed document");let e=this.src[this.pos]|this.src[this.pos+1]<<8,t=this.src[this.pos+2]|this.src[this.pos+3]<<8;if(this.pos+=4,e!==(~t&65535))throw new Error("Corrupted compressed document");if(this.pos+e>this.src.length)throw new Error("Truncated compressed document");for(let i=0;i<e;i++)this.put(this.src[this.pos++])}dynamic(){let e=this.bits(5)+257,t=this.bits(5)+1,i=this.bits(4)+4;if(e>286||t>30)throw new Error("Corrupted compressed document");let r=new Uint8Array(320);for(let s=0;s<i;s++)r[zc[s]]=this.bits(3);let n=new Gi(r,19);r.fill(0);for(let s=0;s<e+t;){let a=this.decode(n);if(a<16){r[s++]=a;continue}let m=0,u;if(a===16){if(s===0)throw new Error("Corrupted compressed document");m=r[s-1],u=3+this.bits(2)}else a===17?u=3+this.bits(3):u=11+this.bits(7);if(s+u>e+t)throw new Error("Corrupted compressed document");for(;u--;)r[s++]=m}if(!r[256])throw new Error("Corrupted compressed document");this.codes(new Gi(r,e),new Gi(r.subarray(e),t))}codes(e,t){for(;;){let i=this.decode(e);if(i<256){this.put(i);continue}if(i===256)return;if(i-=257,i>=29)throw new Error("Corrupted compressed document");let r=Gc[i]+this.bits(Yc[i]),n=this.decode(t);if(n>=30)throw new Error("Corrupted compressed document");let s=Xc[n]+this.bits($c[n]);if(s>this.n)throw new Error("Corrupted compressed document");for(let a=0;a<r;a++)this.put(this.out[this.n-s])}}byteEnd(){return this.pos-(this.bitCnt>>3)}result(){return this.out.slice(0,this.n)}};var ve=class o{constructor(e=o.BUFFER_SIZE){this.mIndex=0;this.mStartingIndex=0;this.mSize=0;this.mValidOperations=new Array(256).fill(!0);this.mIdTrace=null;this.mMaxSize=e;let t=new ArrayBuffer(e);this.mBuffer=new Uint8Array(t),this.mDataView=new DataView(t)}static{this.BUFFER_SIZE=1024*1024}static fromArrayBuffer(e){let t=new o(e.byteLength);return t.mBuffer.set(new Uint8Array(e)),t.mSize=e.byteLength,t}resize(e){if(this.mSize+e>=this.mMaxSize){this.mMaxSize=Math.max(this.mMaxSize*2,this.mSize+e);let t=new ArrayBuffer(this.mMaxSize),i=new Uint8Array(t);i.set(this.mBuffer),this.mBuffer=i,this.mDataView=new DataView(t)}}getBuffer(){return this.mBuffer}getMaxSize(){return this.mMaxSize}getIndex(){return this.mIndex}setIndex(e){this.mIndex=e}getSize(){return this.mSize}size(){return this.mSize}available(){return this.mSize-this.mIndex>0}start(e){if(!this.mValidOperations[e])throw new Error(`Operation ${e} is not supported for this version`);this.mStartingIndex=this.mIndex,this.writeByte(e)}startWithSize(e){this.mStartingIndex=this.mIndex,this.writeByte(e),this.mIndex+=4}endWithSize(){let e=this.mIndex-this.mStartingIndex,t=this.mIndex;this.mIndex=this.mStartingIndex+1,this.writeInt(e),this.mIndex=t}reset(e){this.mIndex=0,this.mStartingIndex=0,this.mSize=0,e>=this.mMaxSize&&this.resize(e)}readOperationType(){return this.readByte()}readBoolean(){let e=this.mBuffer[this.mIndex];return this.mIndex++,e===1}readByte(){let e=this.mBuffer[this.mIndex]&255;return this.mIndex++,e}readShort(){let e=this.mDataView.getUint16(this.mIndex,!1);return this.mIndex+=2,e}peekInt(){return this.mDataView.getInt32(this.mIndex,!1)}declareId(){let e=this.readInt();return this.mIdTrace&&this.mIdTrace.push(e),e}readId(){let e=this.readInt();return this.mIdTrace&&this.mIdTrace.push(e),e}readNanIdBits(){return this.readInt()}readLongNanId(){return this.readLong()}readInt(){let e=this.mDataView.getInt32(this.mIndex,!1);return this.mIndex+=4,e}readLong(){let e=this.mDataView.getInt32(this.mIndex,!1),t=this.mDataView.getUint32(this.mIndex+4,!1);return this.mIndex+=8,e*4294967296+t}readFloat(){let e=this.mDataView.getFloat32(this.mIndex,!1);return this.mIndex+=4,e}readDouble(){let e=this.mDataView.getFloat64(this.mIndex,!1);return this.mIndex+=8,e}readBuffer(){let e=this.readInt(),t=this.mBuffer.slice(this.mIndex,this.mIndex+e);return this.mIndex+=e,t}readBufferMax(e){let t=this.readInt();if(t<0||t>e)throw new Error(`attempt read a buff of invalid size 0 <= ${t} > ${e}`);let i=this.mBuffer.slice(this.mIndex,this.mIndex+t);return this.mIndex+=t,i}readUTF8(){let e=this.readBuffer();return new TextDecoder().decode(e)}readUTF8Max(e){let t=this.readBufferMax(e);return new TextDecoder().decode(t)}writeBoolean(e){this.resize(1),this.mBuffer[this.mIndex++]=e?1:0,this.mSize++}writeByte(e){this.resize(1),this.mBuffer[this.mIndex++]=e&255,this.mSize++}writeShort(e){this.resize(2),this.mDataView.setUint16(this.mIndex,e,!1),this.mIndex+=2,this.mSize+=2}writeInt(e){this.resize(4),this.mDataView.setInt32(this.mIndex,e,!1),this.mIndex+=4,this.mSize+=4}writeLong(e){this.resize(8);let t=Math.floor(e/4294967296)|0,i=e-t*4294967296;this.mDataView.setInt32(this.mIndex,t,!1),this.mDataView.setUint32(this.mIndex+4,i,!1),this.mIndex+=8,this.mSize+=8}writeFloat(e){this.resize(4),this.mDataView.setFloat32(this.mIndex,e,!1),this.mIndex+=4,this.mSize+=4}writeDouble(e){this.resize(8),this.mDataView.setFloat64(this.mIndex,e,!1),this.mIndex+=8,this.mSize+=8}writeBuffer(e){this.resize(e.length+4),this.writeInt(e.length),this.mBuffer.set(e,this.mIndex),this.mIndex+=e.length,this.mSize+=e.length}writeUTF8(e){let t=new TextEncoder().encode(e);this.writeBuffer(t)}cloneBytes(){return this.mBuffer.slice(0,this.mSize)}setVersion(e,t){for(let i=0;i<this.mValidOperations.length;i++)this.mValidOperations[i]=!0}setValidOperationsFromSet(e){this.mValidOperations.fill(!1);for(let t of e)this.mValidOperations[t]=!0}setValidOperationsCallback(e,t,i){for(let r=0;r<this.mValidOperations.length;r++)this.mValidOperations[r]=e(r,t,i)}moveBlock(e,t){if(t<0||e>this.mSize||t>=e)return;let i=e-t,r=this.mSize-e;if(r<i){let n=this.mBuffer.slice(e,e+r);this.mBuffer.copyWithin(t+r,t,t+i),this.mBuffer.set(n,t)}else{let n=this.mBuffer.slice(t,t+i);this.mBuffer.copyWithin(t,e,e+r),this.mBuffer.set(n,t+r)}}};var oi=class extends Z{constructor(e,t,i,r){super(),this.mX1Bits=e,this.mY1Bits=t,this.mX2Bits=i,this.mY2Bits=r,this.mX1=O(e)?0:F(e),this.mY1=O(t)?0:F(t),this.mX2=O(i)?0:F(i),this.mY2=O(r)?0:F(r)}write(e){}registerListening(e){O(this.mX1Bits)&&e.listensTo(x(this.mX1Bits),this),O(this.mY1Bits)&&e.listensTo(x(this.mY1Bits),this),O(this.mX2Bits)&&e.listensTo(x(this.mX2Bits),this),O(this.mY2Bits)&&e.listensTo(x(this.mY2Bits),this)}updateVariables(e){this.mX1=O(this.mX1Bits)?e.getFloat(x(this.mX1Bits)):F(this.mX1Bits),this.mY1=O(this.mY1Bits)?e.getFloat(x(this.mY1Bits)):F(this.mY1Bits),this.mX2=O(this.mX2Bits)?e.getFloat(x(this.mX2Bits)):F(this.mX2Bits),this.mY2=O(this.mY2Bits)?e.getFloat(x(this.mY2Bits)):F(this.mY2Bits)}paint(e){this.paintBase4(e,this.mX1,this.mY1,this.mX2,this.mY2)}};var hn=class o extends oi{static{this.OP_CODE=42}paintBase4(e,t,i,r,n){e.drawRect(t,i,r,n)}deepToString(e){return`${e}DrawRect(${this.mX1}, ${this.mY1}, ${this.mX2}, ${this.mY2})`}static read(e,t){t.push(new o(e.readNanIdBits(),e.readNanIdBits(),e.readNanIdBits(),e.readNanIdBits()))}};var $o=class extends Z{constructor(e,t,i){super(),this.mV1Bits=e,this.mV2Bits=t,this.mV3Bits=i,this.mV1=O(e)?0:F(e),this.mV2=O(t)?0:F(t),this.mV3=O(i)?0:F(i)}write(e){}registerListening(e){O(this.mV1Bits)&&e.listensTo(x(this.mV1Bits),this),O(this.mV2Bits)&&e.listensTo(x(this.mV2Bits),this),O(this.mV3Bits)&&e.listensTo(x(this.mV3Bits),this)}updateVariables(e){this.mV1=O(this.mV1Bits)?e.getFloat(x(this.mV1Bits)):F(this.mV1Bits),this.mV2=O(this.mV2Bits)?e.getFloat(x(this.mV2Bits)):F(this.mV2Bits),this.mV3=O(this.mV3Bits)?e.getFloat(x(this.mV3Bits)):F(this.mV3Bits)}paint(e){this.paintBase3(e,this.mV1,this.mV2,this.mV3)}};var cn=class o extends $o{static{this.OP_CODE=46}paintBase3(e,t,i,r){e.drawCircle(t,i,r)}deepToString(e){return`${e}DrawCircle(${this.mV1}, ${this.mV2}, ${this.mV3})`}static read(e,t){t.push(new o(e.readNanIdBits(),e.readNanIdBits(),e.readNanIdBits()))}};var dn=class o extends oi{static{this.OP_CODE=56}paintBase4(e,t,i,r,n){e.drawOval(t,i,r,n)}deepToString(e){return`${e}DrawOval(${this.mX1}, ${this.mY1}, ${this.mX2}, ${this.mY2})`}static read(e,t){t.push(new o(e.readNanIdBits(),e.readNanIdBits(),e.readNanIdBits(),e.readNanIdBits()))}};var ai=class extends Z{constructor(e,t,i,r,n,s){super(),this.mV1Bits=e,this.mV2Bits=t,this.mV3Bits=i,this.mV4Bits=r,this.mV5Bits=n,this.mV6Bits=s,this.mV1=O(e)?0:F(e),this.mV2=O(t)?0:F(t),this.mV3=O(i)?0:F(i),this.mV4=O(r)?0:F(r),this.mV5=O(n)?0:F(n),this.mV6=O(s)?0:F(s)}write(e){}registerListening(e){O(this.mV1Bits)&&e.listensTo(x(this.mV1Bits),this),O(this.mV2Bits)&&e.listensTo(x(this.mV2Bits),this),O(this.mV3Bits)&&e.listensTo(x(this.mV3Bits),this),O(this.mV4Bits)&&e.listensTo(x(this.mV4Bits),this),O(this.mV5Bits)&&e.listensTo(x(this.mV5Bits),this),O(this.mV6Bits)&&e.listensTo(x(this.mV6Bits),this)}updateVariables(e){this.mV1=O(this.mV1Bits)?e.getFloat(x(this.mV1Bits)):F(this.mV1Bits),this.mV2=O(this.mV2Bits)?e.getFloat(x(this.mV2Bits)):F(this.mV2Bits),this.mV3=O(this.mV3Bits)?e.getFloat(x(this.mV3Bits)):F(this.mV3Bits),this.mV4=O(this.mV4Bits)?e.getFloat(x(this.mV4Bits)):F(this.mV4Bits),this.mV5=O(this.mV5Bits)?e.getFloat(x(this.mV5Bits)):F(this.mV5Bits),this.mV6=O(this.mV6Bits)?e.getFloat(x(this.mV6Bits)):F(this.mV6Bits)}paint(e){this.paintBase6(e,this.mV1,this.mV2,this.mV3,this.mV4,this.mV5,this.mV6)}};var pn=class o extends ai{static{this.OP_CODE=51}paintBase6(e,t,i,r,n,s,a){e.drawRoundRect(t,i,r,n,s,a)}deepToString(e){return`${e}DrawRoundRect(${this.mV1}, ${this.mV2}, ${this.mV3}, ${this.mV4}, rx=${this.mV5}, ry=${this.mV6})`}static read(e,t){t.push(new o(e.readNanIdBits(),e.readNanIdBits(),e.readNanIdBits(),e.readNanIdBits(),e.readNanIdBits(),e.readNanIdBits()))}};var fn=class o extends ai{static{this.OP_CODE=152}paintBase6(e,t,i,r,n,s,a){e.drawArc(t,i,r,n,s,a)}deepToString(e){return`${e}DrawArc(${this.mV1}, ${this.mV2}, ${this.mV3}, ${this.mV4}, start=${this.mV5}, sweep=${this.mV6})`}static read(e,t){t.push(new o(e.readNanIdBits(),e.readNanIdBits(),e.readNanIdBits(),e.readNanIdBits(),e.readNanIdBits(),e.readNanIdBits()))}};var gn=class o extends ai{static{this.OP_CODE=52}paintBase6(e,t,i,r,n,s,a){e.drawSector(t,i,r,n,s,a)}deepToString(e){return`${e}DrawSector`}static read(e,t){t.push(new o(e.readNanIdBits(),e.readNanIdBits(),e.readNanIdBits(),e.readNanIdBits(),e.readNanIdBits(),e.readNanIdBits()))}};var Uu=3211264,td=7340032,ed=2097152;function bn(o){return O(o)}var yn=class o extends D{constructor(t,i,r,n,s,a,m,u,l,h,c,f,d,p){super();this.mMeshId=t;this.mType=i;this.mLayout=r;this.mUCount=n;this.mVCount=s;this.mFlags=a;this.mAux=m;this.mExpressions=u;this.mSrcIndices=l;this.mSrcVerts=h;this.mSrcUv=c;this.mSrcColors=f;this.mWidths=d;this.mWidthPositions=p;this.mVerts=new Float32Array(0);this.mUv=new Float32Array(0);this.mColors=new Int32Array(0);this.mIndices=new Int32Array(0);this.mVars=[0,0,0];this.mPolyline=new Float32Array(0);this.mWidthSpline=new Fo;this.mMeshDirty=!0;this.mScratchPos=new Float32Array(2);this.mScratchSample=new Float32Array(4)}static{this.OP_CODE=104}write(t){}registerListening(t){let i=r=>{if(!O(r))return;let n=x(r);n>Uu&&n<=Uu+79||(n&td)!==ed&&t.listensTo(n,this)};for(let r of this.mExpressions)for(let n=0;n<r.length;n++)i(r[n]);for(let r of[this.mSrcVerts,this.mWidths,this.mWidthPositions])for(let n=0;n<r.length;n++)O(r[n])&&t.listensTo(x(r[n]),this)}markDirty(){this.mMeshDirty=!0}updateVariables(t){this.mMeshDirty=!0}apply(t){this.mMeshDirty&&(this.expand(t),this.mMeshDirty=!1);let i=t.getPaintContext();i&&i.setMesh(this.mMeshId,this.mLayout,this.mUCount,this.mVCount,this.mVerts,this.mUv,this.mColors,this.mIndices)}deepToString(t){return t+"AddMesh2D id="+this.mMeshId+" type="+this.mType+" layout="+this.mLayout}get isSplineStrip(){return this.mType===3||this.mType===4}val(t,i){return bn(i)?t.getFloat(x(i)):F(i)}expand(t){this.mType===0||this.isSplineStrip?this.expandParametric(t):this.expandLiteral(t)}expandLiteral(t){let i=this.mSrcVerts.length,r=new Float32Array(i);for(let s=0;s<i;s++)r[s]=this.val(t,this.mSrcVerts[s]);this.mVerts=r;let n=i/2;this.mUv=this.mSrcUv.length===i?new Float32Array(this.mSrcUv):new Float32Array(0),this.mColors=this.mSrcColors.length===n?new Int32Array(this.mSrcColors):new Int32Array(0),this.mIndices=new Int32Array(this.mSrcIndices)}roundCapColumns(){if(this.mType!==4)return 0;let t=this.mFlags;return t<=0?0:Math.max(0,Math.min(t,Math.trunc((this.mUCount-2)/2)))}evaluate(t,i,r,n,s){let a=this.mExpressions[i];return!a||a.length===0?s:a.length===1&&!O(a[0])?F(a[0]):(this.mVars[0]=r,this.mVars[1]=n,yt.evalRPN(t,a,this.mVars))}strokeWidthAt(t,i,r){return this.isSplineStrip?this.mWidthSpline.isEmpty?1:this.mWidthSpline.at(i):this.evaluate(t,8,i,r,1)}buildWidthSpline(t){let i=this.mWidths.length;if(i===0)return;let r=[],n=[];for(let s=0;s<i;s++){let a=this.mWidthPositions.length===i?this.val(t,this.mWidthPositions[s]):i===1?0:s/(i-1);r.push(a),n.push(this.val(t,this.mWidths[s]))}this.mWidthSpline.fit(r,n)}positionOnPath(t,i,r,n,s){let a=this.mScratchSample,m=i,u=this.roundCapColumns();if(u>0&&this.mUCount>1){let d=u/(this.mUCount-1);if(i<=d){Ro(this.mPolyline,n,0,a);let p=this.strokeWidthAt(t,0,r)*.5;La(a,p,d>0?i/d:0,r,-1,s);return}if(i>=1-d){Ro(this.mPolyline,n,1,a);let p=this.strokeWidthAt(t,1,r)*.5;La(a,p,d>0?(1-i)/d:0,r,1,s);return}m=(i-d)/(1-2*d)}Ro(this.mPolyline,n,m,a);let l=this.strokeWidthAt(t,m,r)*.5,h=(r-.5)*2*l,c=-a[3],f=a[2];s[0]=a[0]+c*h,s[1]=a[1]+f*h}expandParametric(t){let i=Math.max(1,this.mUCount),r=Math.max(1,this.mVCount),n=lu(this.mLayout,i,r);if(n<=0||n>uu)return;let s=new Float32Array(n*2),a=new Float32Array(n*2),m=this.mExpressions[2],u=this.mExpressions[3],l=(m?m.length:0)>0||(u?u.length:0)>0,h=this.mExpressions[4],c=this.mExpressions[5],f=this.mExpressions[6],d=this.mExpressions[7],p=(h?h.length:0)>0||(c?c.length:0)>0||(f?f.length:0)>0||(d?d.length:0)>0,b=p?new Int32Array(n):new Int32Array(0),g=0;if(this.mLayout===5){let I=t.getPathData(this.mAux);if(I){let T=new Float32Array(I.buffer,I.byteOffset,I.length);this.mPolyline=fu(T,v=>{if(!Number.isNaN(v))return v;let _=_o(v);return _>=So&&_<=Po?v:t.getFloat(_)}),g=this.mPolyline.length/2}this.isSplineStrip&&this.buildWidthSpline(t)}let C=this.mLayout===4,y=this.mScratchPos;for(let I=0;I<n;I++){let T,v;C?I===0?(T=0,v=0):(T=Ba(this.mLayout,I-1,i),v=1):(T=Ba(this.mLayout,I%i,i),v=hu(Math.trunc(I/i),r)),this.mLayout===5&&g>0?this.positionOnPath(t,T,v,g,y):du(this.mLayout,T,v,y),s[I*2]=this.evaluate(t,0,T,v,y[0]),s[I*2+1]=this.evaluate(t,1,T,v,y[1]),l?(a[I*2]=this.evaluate(t,2,T,v,T),a[I*2+1]=this.evaluate(t,3,T,v,v)):(a[I*2]=T,a[I*2+1]=v),p&&(b[I]=yu(this.evaluate(t,4,T,v,1),this.evaluate(t,5,T,v,1),this.evaluate(t,6,T,v,1),this.evaluate(t,7,T,v,1)))}this.mVerts=s,this.mUv=a,this.mColors=b,this.mIndices=cu(this.mLayout,i,r)}static read(t,i){let r=t.readId(),n=t.readInt(),s=t.readInt(),a=t.readInt(),m=t.readInt(),u=t.readInt(),l=t.readInt(),h=[],c=new Int32Array(0),f=new Int32Array(0),d=new Float32Array(0),p=new Int32Array(0),b=new Int32Array(0),g=new Int32Array(0);if(n===0)for(let C=0;C<9;C++){let y=t.readInt(),I=new Int32Array(Math.max(0,y));for(let T=0;T<y;T++)I[T]=t.readNanIdBits();h.push(I)}else if(n===3||n===4){let C=t.readInt();b=new Int32Array(Math.max(0,C));for(let I=0;I<C;I++)b[I]=t.readNanIdBits();let y=t.readInt();g=new Int32Array(Math.max(0,y));for(let I=0;I<y;I++)g[I]=t.readNanIdBits();for(let I=0;I<9;I++)h.push(new Int32Array(0))}else{let C=t.readInt();c=new Int32Array(Math.max(0,C));for(let v=0;v<C;v++)c[v]=t.readShort()&65535;let y=t.readInt(),I=t.readInt(),T=t.readInt();if(f=new Int32Array(Math.max(0,y)),d=new Float32Array(Math.max(0,I)),p=new Int32Array(Math.max(0,T)),n===2){for(let v=0;v<y;v++)f[v]=et(wa(t.readShort()&65535));for(let v=0;v<I;v++)d[v]=wa(t.readShort()&65535)}else{for(let v=0;v<y;v++)f[v]=t.readNanIdBits();for(let v=0;v<I;v++)d[v]=t.readFloat()}for(let v=0;v<T;v++)p[v]=t.readInt();for(let v=0;v<9;v++)h.push(new Int32Array(0))}i.push(new o(r,n,s,a,m,u,l,h,c,f,d,p,b,g))}},In=class o extends Z{constructor(t,i,r){super();this.mMeshId=t;this.mBlend=i;this.mImageId=r}static{this.OP_CODE=105}write(t){}paint(t){t.drawMesh(this.mMeshId,this.mBlend,this.mImageId)}deepToString(t){return t+"DrawMesh2D "+this.mMeshId}static read(t,i){i.push(new o(t.readId(),t.readInt(),t.readInt()))}},Cn=class o extends Z{constructor(t,i,r,n){super();this.mMeshId=t;this.mU=i;this.mV=r;this.mFlags=n;this.mOutU=0;this.mOutV=0;this.mOutU=i,this.mOutV=r}static{this.OP_CODE=106}write(t){}registerListening(t){bn(this.mU)&&t.listensTo(x(this.mU),this),bn(this.mV)&&t.listensTo(x(this.mV),this)}markDirty(){}updateVariables(t){this.mOutU=bn(this.mU)?t.getFloat(x(this.mU)):F(this.mU),this.mOutV=bn(this.mV)?t.getFloat(x(this.mV)):F(this.mV)}paint(t){t.matrixFromMesh(this.mMeshId,this.mOutU,this.mOutV,this.mFlags)}deepToString(t){return t+"MatrixFromMesh2D "+this.mMeshId}static read(t,i){i.push(new o(t.readId(),t.readNanIdBits(),t.readNanIdBits(),t.readInt()))}};var vn=class o extends Z{static{this.OP_CODE=124}constructor(e,t,i){super(),this.mPathId=e,this.mStart=t,this.mEnd=i}write(e){}paint(e){e.drawPath(this.getId(this.mPathId,e),this.mStart,this.mEnd)}deepToString(e){return`${e}DrawPath(${this.mPathId})`}static read(e,t){let i=e.readId();t.push(new o(i,0,1))}};var Tn=class o extends Z{static{this.OP_CODE=125}constructor(e,t,i,r,n){super(),this.mPath1Id=e,this.mPath2Id=t,this.mTweenBits=i,this.mStartBits=r,this.mEndBits=n,this.mOutTween=O(i)?0:F(i),this.mOutStart=O(r)?0:F(r),this.mOutEnd=O(n)?0:F(n)}write(e){}registerListening(e){O(this.mTweenBits)&&e.listensTo(x(this.mTweenBits),this),O(this.mStartBits)&&e.listensTo(x(this.mStartBits),this),O(this.mEndBits)&&e.listensTo(x(this.mEndBits),this)}updateVariables(e){this.mOutTween=O(this.mTweenBits)?e.getFloat(x(this.mTweenBits)):F(this.mTweenBits),this.mOutStart=O(this.mStartBits)?e.getFloat(x(this.mStartBits)):F(this.mStartBits),this.mOutEnd=O(this.mEndBits)?e.getFloat(x(this.mEndBits)):F(this.mEndBits)}paint(e){e.drawTweenPath(this.getId(this.mPath1Id,e),this.getId(this.mPath2Id,e),this.mOutTween,this.mOutStart,this.mOutEnd)}deepToString(e){return`${e}DrawTweenPath`}static read(e,t){t.push(new o(e.readId(),e.readId(),e.readNanIdBits(),e.readNanIdBits(),e.readNanIdBits()))}};var On=class o extends Z{constructor(){super(...arguments);this.mLayoutComponent=null;this.mInProcessing=!1}static{this.OP_CODE=139}setComponent(t){this.mLayoutComponent=t}write(t){}paint(t){this.mLayoutComponent!=null&&(this.mInProcessing||(this.mInProcessing=!0,this.mLayoutComponent.drawContent(t),this.mInProcessing=!1))}deepToString(t){return`${t}DrawContent`}static read(t,i){i.push(new o)}};var xn=class o extends Z{static{this.OP_CODE=44}constructor(e,t,i,r,n,s){super(),this.mImageId=e,this.mLeftBits=t,this.mTopBits=i,this.mRightBits=r,this.mBottomBits=n,this.mCdId=s,this.mOutLeft=O(t)?0:F(t),this.mOutTop=O(i)?0:F(i),this.mOutRight=O(r)?0:F(r),this.mOutBottom=O(n)?0:F(n)}write(e){}registerListening(e){O(this.mLeftBits)&&e.listensTo(x(this.mLeftBits),this),O(this.mTopBits)&&e.listensTo(x(this.mTopBits),this),O(this.mRightBits)&&e.listensTo(x(this.mRightBits),this),O(this.mBottomBits)&&e.listensTo(x(this.mBottomBits),this)}updateVariables(e){this.mOutLeft=O(this.mLeftBits)?e.getFloat(x(this.mLeftBits)):F(this.mLeftBits),this.mOutTop=O(this.mTopBits)?e.getFloat(x(this.mTopBits)):F(this.mTopBits),this.mOutRight=O(this.mRightBits)?e.getFloat(x(this.mRightBits)):F(this.mRightBits),this.mOutBottom=O(this.mBottomBits)?e.getFloat(x(this.mBottomBits)):F(this.mBottomBits)}paint(e){e.drawBitmapSimple(this.getId(this.mImageId,e),this.mOutLeft,this.mOutTop,this.mOutRight,this.mOutBottom)}deepToString(e){return`${e}DrawBitmap(${this.mImageId})`}static read(e,t){let i=e.readId(),r=e.readNanIdBits(),n=e.readNanIdBits(),s=e.readNanIdBits(),a=e.readNanIdBits(),m=e.readId();t.push(new o(i,r,n,s,a,m))}};var An=class o extends Z{static{this.OP_CODE=66}constructor(e,t,i,r,n,s,a,m,u,l){super(),this.mImageId=e,this.mSrcL=t,this.mSrcT=i,this.mSrcR=r,this.mSrcB=n,this.mDstL=s,this.mDstT=a,this.mDstR=m,this.mDstB=u,this.mCdId=l}write(e){}paint(e){e.drawBitmap(this.getId(this.mImageId,e),this.mSrcL,this.mSrcT,this.mSrcR,this.mSrcB,this.mDstL,this.mDstT,this.mDstR,this.mDstB,this.mCdId)}deepToString(e){return`${e}DrawBitmapInt(${this.mImageId})`}static read(e,t){t.push(new o(e.readId(),e.readInt(),e.readInt(),e.readInt(),e.readInt(),e.readInt(),e.readInt(),e.readInt(),e.readInt(),e.readId()))}};var yr=class o{constructor(){this.mFinalDstLeft=0;this.mFinalDstTop=0;this.mFinalDstRight=0;this.mFinalDstBottom=0}static{this.SCALE_NONE=0}static{this.SCALE_INSIDE=1}static{this.SCALE_FILL_WIDTH=2}static{this.SCALE_FILL_HEIGHT=3}static{this.SCALE_FIT=4}static{this.SCALE_CROP=5}static{this.SCALE_FILL_BOUNDS=6}static{this.SCALE_FIXED_SCALE=7}setup(e,t,i,r,n,s,a,m,u,l){let h=i-e|0,c=r-t|0,f=a-n,d=m-s,p=f|0,b=d|0,g=0,C=p,y=0,I=b;if(c===0||h===0){this.mFinalDstLeft=n,this.mFinalDstTop=s,this.mFinalDstRight=a,this.mFinalDstBottom=m;return}switch(u){case o.SCALE_NONE:b=c,p=h,y=((d|0)-b)/2|0,I=b+y,g=((f|0)-p)/2|0,C=p+g;break;case o.SCALE_INSIDE:b>c&&p>h?(b=c,p=h):h*d>f*c?b=p*c/h|0:p=b*h/c|0,y=((d|0)-b)/2|0,I=b+y,g=((f|0)-p)/2|0,C=p+g;break;case o.SCALE_FILL_WIDTH:b=p*c/h|0,y=((d|0)-b)/2|0,I=b+y,g=((f|0)-p)/2|0,C=p+g;break;case o.SCALE_FILL_HEIGHT:p=b*h/c|0,y=((d|0)-b)/2|0,I=b+y,g=((f|0)-p)/2|0,C=p+g;break;case o.SCALE_FIT:h*d>f*c?(b=p*c/h|0,y=((d|0)-b)/2|0,I=b+y):(p=b*h/c|0,g=((f|0)-p)/2|0,C=p+g);break;case o.SCALE_CROP:h*d<f*c?(b=p*c/h|0,y=((d|0)-b)/2|0,I=b+y):(p=b*h/c|0,g=((f|0)-p)/2|0,C=p+g);break;case o.SCALE_FILL_BOUNDS:break;case o.SCALE_FIXED_SCALE:b=c*l|0,p=h*l|0,y=((d|0)-b)/2|0,I=b+y,g=((f|0)-p)/2|0,C=p+g;break}this.mFinalDstRight=C+n,this.mFinalDstLeft=g+n,this.mFinalDstBottom=I+s,this.mFinalDstTop=y+s}};var En=class o extends Z{constructor(t,i,r,n,s,a,m,u,l,h,c,f){super();this.mScaling=new yr;let d=p=>O(p)?0:F(p);this.mImageId=t,this.mSrcLeft=i,this.mOutSrcLeft=d(i),this.mSrcTop=r,this.mOutSrcTop=d(r),this.mSrcRight=n,this.mOutSrcRight=d(n),this.mSrcBottom=s,this.mOutSrcBottom=d(s),this.mDstLeft=a,this.mOutDstLeft=d(a),this.mDstTop=m,this.mOutDstTop=d(m),this.mDstRight=u,this.mOutDstRight=d(u),this.mDstBottom=l,this.mOutDstBottom=d(l),this.mScaleType=h&255,(h>>8&1)!==0&&(this.mImageId|=Z.PTR_DEREFERENCE),this.mScaleFactor=c,this.mOutScaleFactor=d(c),this.mCdId=f}static{this.OP_CODE=149}write(t){}registerListening(t){let i=r=>{O(r)&&t.listensTo(x(r),this)};i(this.mSrcLeft),i(this.mSrcTop),i(this.mSrcRight),i(this.mSrcBottom),i(this.mDstLeft),i(this.mDstTop),i(this.mDstRight),i(this.mDstBottom),i(this.mScaleFactor)}updateVariables(t){let i=r=>O(r)?t.getFloat(x(r)):F(r);this.mOutSrcLeft=i(this.mSrcLeft),this.mOutSrcTop=i(this.mSrcTop),this.mOutSrcRight=i(this.mSrcRight),this.mOutSrcBottom=i(this.mSrcBottom),this.mOutDstLeft=i(this.mDstLeft),this.mOutDstTop=i(this.mDstTop),this.mOutDstRight=i(this.mDstRight),this.mOutDstBottom=i(this.mDstBottom),this.mOutScaleFactor=i(this.mScaleFactor)}paint(t){this.mScaling.setup(this.mOutSrcLeft,this.mOutSrcTop,this.mOutSrcRight,this.mOutSrcBottom,this.mOutDstLeft,this.mOutDstTop,this.mOutDstRight,this.mOutDstBottom,this.mScaleType,this.mOutScaleFactor),t.save(),t.clipRect(this.mOutDstLeft,this.mOutDstTop,this.mOutDstRight,this.mOutDstBottom),t.drawBitmap(this.getId(this.mImageId,t),this.mOutSrcLeft|0,this.mOutSrcTop|0,this.mOutSrcRight|0,this.mOutSrcBottom|0,this.mScaling.mFinalDstLeft|0,this.mScaling.mFinalDstTop|0,this.mScaling.mFinalDstRight|0,this.mScaling.mFinalDstBottom|0,this.mCdId),t.restore()}deepToString(t){return`${t}DrawBitmapScaled(${this.mImageId})`}static read(t,i){let r=t.readId(),n=t.readNanIdBits(),s=t.readNanIdBits(),a=t.readNanIdBits(),m=t.readNanIdBits(),u=t.readNanIdBits(),l=t.readNanIdBits(),h=t.readNanIdBits(),c=t.readNanIdBits(),f=t.readInt(),d=t.readNanIdBits(),p=t.readId();i.push(new o(r,n,s,a,m,u,l,h,c,f,d,p))}};var Mn=class o extends Z{static{this.OP_CODE=43}constructor(e,t,i,r,n,s,a,m){super(),this.mTextId=e,this.mStart=t,this.mEnd=i,this.mContextStart=r,this.mContextEnd=n,this.mXBits=s,this.mYBits=a,this.mX=O(s)?0:F(s),this.mY=O(a)?0:F(a),this.mRtl=m}write(e){}registerListening(e){e.listensTo(this.mTextId,this),O(this.mXBits)&&e.listensTo(x(this.mXBits),this),O(this.mYBits)&&e.listensTo(x(this.mYBits),this)}updateVariables(e){this.mX=O(this.mXBits)?e.getFloat(x(this.mXBits)):F(this.mXBits),this.mY=O(this.mYBits)?e.getFloat(x(this.mYBits)):F(this.mYBits)}paint(e){e.drawTextRun(this.mTextId,this.mStart,this.mEnd,this.mContextStart,this.mContextEnd,this.mX,this.mY,this.mRtl)}deepToString(e){return`${e}DrawText(${this.mTextId})`}static read(e,t){t.push(new o(e.readId(),e.readInt(),e.readInt(),e.readInt(),e.readInt(),e.readNanIdBits(),e.readNanIdBits(),e.readBoolean()))}};var Fn=class o extends Z{static{this.OP_CODE=53}constructor(e,t,i,r){super(),this.mTextId=e,this.mPathId=t,this.mHOffsetBits=i,this.mVOffsetBits=r,this.mOutHOffset=O(i)?0:F(i),this.mOutVOffset=O(r)?0:F(r)}write(e){}registerListening(e){e.listensTo(this.mTextId,this),O(this.mHOffsetBits)&&e.listensTo(x(this.mHOffsetBits),this),O(this.mVOffsetBits)&&e.listensTo(x(this.mVOffsetBits),this)}updateVariables(e){this.mOutHOffset=O(this.mHOffsetBits)?e.getFloat(x(this.mHOffsetBits)):F(this.mHOffsetBits),this.mOutVOffset=O(this.mVOffsetBits)?e.getFloat(x(this.mVOffsetBits)):F(this.mVOffsetBits)}paint(e){e.drawTextOnPath(this.mTextId,this.getId(this.mPathId,e),this.mOutHOffset,this.mOutVOffset)}deepToString(e){return`${e}DrawTextOnPath`}static read(e,t){let i=e.readId(),r=e.readId(),n=e.readNanIdBits(),s=e.readNanIdBits();t.push(new o(i,r,s,n))}};var Sn=class o extends Z{static{this.OP_CODE=190}constructor(e,t,i){super(),this.mBitmapId=e,this.mMode=t,this.mColor=i}write(e){}paint(e){e.drawToBitmap(this.getId(this.mBitmapId,e),this.mMode,this.mColor)}deepToString(e){return`${e}DrawToBitmap(${this.mBitmapId})`}static read(e,t){t.push(new o(e.readId(),e.readInt(),e.readInt()))}};var Pn=class o extends oi{static{this.OP_CODE=47}paintBase4(e,t,i,r,n){e.drawLine(t,i,r,n)}deepToString(e){return`${e}DrawLine(${this.mX1}, ${this.mY1}, ${this.mX2}, ${this.mY2})`}static read(e,t){t.push(new o(e.readNanIdBits(),e.readNanIdBits(),e.readNanIdBits(),e.readNanIdBits()))}};var _n=class o extends Z{constructor(t,i,r,n,s,a){super();this.mBounds=new Float32Array(4);this.mLastString=null;this.mTextID=t,this.mXBits=i,this.mYBits=r,this.mPanXBits=n,this.mPanYBits=s,this.mFlags=a,this.mOutX=O(i)?0:F(i),this.mOutY=O(r)?0:F(r),this.mOutPanX=O(n)?0:F(n),this.mOutPanY=F(s)}static{this.OP_CODE=133}static{this.ANCHOR_TEXT_RTL=1}static{this.ANCHOR_MONOSPACE_MEASURE=2}static{this.MEASURE_EVERY_TIME=4}static{this.BASELINE_RELATIVE=8}write(t){}registerListening(t){t.listensTo(this.mTextID,this),O(this.mXBits)&&t.listensTo(x(this.mXBits),this),O(this.mYBits)&&t.listensTo(x(this.mYBits),this),O(this.mPanXBits)&&t.listensTo(x(this.mPanXBits),this),O(this.mPanYBits)&&x(this.mPanYBits)>0&&t.listensTo(x(this.mPanYBits),this)}updateVariables(t){this.mOutX=O(this.mXBits)?t.getFloat(x(this.mXBits)):F(this.mXBits),this.mOutY=O(this.mYBits)?t.getFloat(x(this.mYBits)):F(this.mYBits),this.mOutPanX=O(this.mPanXBits)?t.getFloat(x(this.mPanXBits)):F(this.mPanXBits),this.mOutPanY=O(this.mPanYBits)&&x(this.mPanYBits)>0?t.getFloat(x(this.mPanYBits)):F(this.mPanYBits)}getHorizontalOffset(){return(0-1*(this.mBounds[2]-this.mBounds[0]))*(1+this.mOutPanX)/2-1*this.mBounds[0]}getVerticalOffset(t){let n=1*(this.mBounds[3]-this.mBounds[1]);return(0-n)*(1-this.mOutPanY)/2+(t?n/2:-1*this.mBounds[1])}paint(t){let i=(this.mFlags&o.ANCHOR_MONOSPACE_MEASURE)!==0?ee.TEXT_MEASURE_MONOSPACE_WIDTH:0,r=t.getText(this.mTextID);(r!==this.mLastString||(this.mFlags&o.MEASURE_EVERY_TIME)!==0)&&(this.mLastString=r,t.getTextBounds(this.mTextID,0,-1,i,this.mBounds));let n=(this.mFlags&o.BASELINE_RELATIVE)!==0,s=this.mOutX+this.getHorizontalOffset(),a=Number.isNaN(this.mOutPanY)?this.mOutY:this.mOutY+this.getVerticalOffset(n);t.drawTextRun(this.mTextID,0,-1,0,1,s,a,(this.mFlags&o.ANCHOR_TEXT_RTL)===1)}deepToString(t){return`${t}DrawTextAnchored(${this.mTextID})`}static read(t,i){i.push(new o(t.readId(),t.readNanIdBits(),t.readNanIdBits(),t.readNanIdBits(),t.readNanIdBits(),t.readInt()))}};function Wt(o,e,t){O(o)&&e.listensTo(x(o),t)}function kt(o,e){return O(o)?e.getFloat(x(o)):F(o)}var Rn=class o extends D{static{this.OP_CODE=130}write(e){}apply(e){if(e.mMode==="DATA")return;let t=e.getPaintContext();t&&t.matrixSave()}deepToString(e){return`${e}MatrixSave`}static read(e,t){t.push(new o)}},Bn=class o extends D{static{this.OP_CODE=131}write(e){}apply(e){if(e.mMode==="DATA")return;let t=e.getPaintContext();t&&t.matrixRestore()}deepToString(e){return`${e}MatrixRestore`}static read(e,t){t.push(new o)}},Dn=class o extends D{static{this.OP_CODE=127}constructor(e,t){super(),this.mTranslateX=e,this.mTranslateY=t}write(e){}registerListening(e){Wt(this.mTranslateX,e,this),Wt(this.mTranslateY,e,this)}apply(e){e.mMode!=="DATA"&&e.getPaintContext()?.matrixTranslate(kt(this.mTranslateX,e),kt(this.mTranslateY,e))}deepToString(e){return`${e}MatrixTranslate(${this.mTranslateX}, ${this.mTranslateY})`}static read(e,t){t.push(new o(e.readNanIdBits(),e.readNanIdBits()))}},wn=class o extends D{static{this.OP_CODE=126}constructor(e,t,i,r){super(),this.mScaleX=e,this.mScaleY=t,this.mCenterX=i,this.mCenterY=r}write(e){}registerListening(e){Wt(this.mScaleX,e,this),Wt(this.mScaleY,e,this),Wt(this.mCenterX,e,this),Wt(this.mCenterY,e,this)}apply(e){e.mMode!=="DATA"&&e.getPaintContext()?.matrixScale(kt(this.mScaleX,e),kt(this.mScaleY,e),kt(this.mCenterX,e),kt(this.mCenterY,e))}deepToString(e){return`${e}MatrixScale(${this.mScaleX}, ${this.mScaleY})`}static read(e,t){t.push(new o(e.readNanIdBits(),e.readNanIdBits(),e.readNanIdBits(),e.readNanIdBits()))}},Ln=class o extends D{static{this.OP_CODE=129}constructor(e,t,i){super(),this.mAngle=e,this.mPivotX=t,this.mPivotY=i}write(e){}registerListening(e){Wt(this.mAngle,e,this),Wt(this.mPivotX,e,this),Wt(this.mPivotY,e,this)}apply(e){e.mMode!=="DATA"&&e.getPaintContext()?.matrixRotate(kt(this.mAngle,e),kt(this.mPivotX,e),kt(this.mPivotY,e))}deepToString(e){return`${e}MatrixRotate(${this.mAngle})`}static read(e,t){t.push(new o(e.readNanIdBits(),e.readNanIdBits(),e.readNanIdBits()))}},Nn=class o extends D{static{this.OP_CODE=128}constructor(e,t){super(),this.mSkewX=e,this.mSkewY=t}write(e){}registerListening(e){Wt(this.mSkewX,e,this),Wt(this.mSkewY,e,this)}apply(e){e.mMode!=="DATA"&&e.getPaintContext()?.matrixSkew(kt(this.mSkewX,e),kt(this.mSkewY,e))}deepToString(e){return`${e}MatrixSkew`}static read(e,t){t.push(new o(e.readNanIdBits(),e.readNanIdBits()))}},Vn=class o extends D{static{this.OP_CODE=181}constructor(e,t,i,r){super(),this.mPathId=e,this.mFraction=t,this.mVOffset=i,this.mFlags=r}write(e){}registerListening(e){Wt(this.mFraction,e,this),Wt(this.mVOffset,e,this)}apply(e){e.mMode!=="DATA"&&e.getPaintContext()?.matrixFromPath(this.mPathId,kt(this.mFraction,e),kt(this.mVOffset,e),this.mFlags)}deepToString(e){return`${e}MatrixFromPath`}static read(e,t){t.push(new o(e.readId(),e.readNanIdBits(),e.readNanIdBits(),e.readInt()))}},Wn=class o extends D{static{this.OP_CODE=39}constructor(e,t,i,r){super(),this.mLeft=e,this.mTop=t,this.mRight=i,this.mBottom=r}write(e){}registerListening(e){Wt(this.mLeft,e,this),Wt(this.mTop,e,this),Wt(this.mRight,e,this),Wt(this.mBottom,e,this)}apply(e){e.mMode!=="DATA"&&e.getPaintContext()?.clipRect(kt(this.mLeft,e),kt(this.mTop,e),kt(this.mRight,e),kt(this.mBottom,e))}deepToString(e){return`${e}ClipRect`}static read(e,t){t.push(new o(e.readNanIdBits(),e.readNanIdBits(),e.readNanIdBits(),e.readNanIdBits()))}},kn=class o extends D{static{this.OP_CODE=38}constructor(e,t){super(),this.mPathId=e,this.mRegionOp=t}write(e){}apply(e){e.mMode!=="DATA"&&e.getPaintContext()?.clipPath(this.mPathId,this.mRegionOp)}deepToString(e){return`${e}ClipPath`}static read(e,t){let i=e.readInt(),r=e.getRemapContext?.(),n=r?r.resolveId(i&1048575):i&1048575,s=i>>24;t.push(new o(n,s))}};var Hn=class{constructor(e,t){this.mExtrapolate=!0;let i=e.length,r=t[0].length;this.mSlopeTemp=new Float64Array(r);let n=[],s=[];for(let a=0;a<i-1;a++)n.push(new Float64Array(r));for(let a=0;a<i;a++)s.push(new Float64Array(r));for(let a=0;a<r;a++){for(let m=0;m<i-1;m++){let u=e[m+1]-e[m];n[m][a]=(t[m+1][a]-t[m][a])/u,m===0?s[m][a]=n[m][a]:s[m][a]=(n[m-1][a]+n[m][a])*.5}s[i-1][a]=n[i-2][a]}for(let a=0;a<i-1;a++)for(let m=0;m<r;m++)if(n[a][m]===0)s[a][m]=0,s[a+1][m]=0;else{let u=s[a][m]/n[a][m],l=s[a+1][m]/n[a][m],h=Math.hypot(u,l);if(h>9){let c=3/h;s[a][m]=c*u*n[a][m],s[a+1][m]=c*l*n[a][m]}}this.mT=e instanceof Float64Array?e:new Float64Array(e),this.mY=t.map(a=>a instanceof Float64Array?a:new Float64Array(a)),this.mTangent=s}getPos(e,t){let i=this.mT.length,r=this.mY[0].length;if(this.mExtrapolate){if(e<=this.mT[0]){this.getSlope(this.mT[0],this.mSlopeTemp);for(let n=0;n<r;n++)t[n]=this.mY[0][n]+(e-this.mT[0])*this.mSlopeTemp[n];return}if(e>=this.mT[i-1]){this.getSlope(this.mT[i-1],this.mSlopeTemp);for(let n=0;n<r;n++)t[n]=this.mY[i-1][n]+(e-this.mT[i-1])*this.mSlopeTemp[n];return}}else{if(e<=this.mT[0]){for(let n=0;n<r;n++)t[n]=this.mY[0][n];return}if(e>=this.mT[i-1]){for(let n=0;n<r;n++)t[n]=this.mY[i-1][n];return}}for(let n=0;n<i-1;n++){if(e===this.mT[n])for(let s=0;s<r;s++)t[s]=this.mY[n][s];if(e<this.mT[n+1]){let s=this.mT[n+1]-this.mT[n],a=(e-this.mT[n])/s;for(let m=0;m<r;m++)t[m]=Gu(s,a,this.mY[n][m],this.mY[n+1][m],this.mTangent[n][m],this.mTangent[n+1][m]);return}}}getPosAt(e,t){let i=this.mT.length;if(this.mExtrapolate){if(e<=this.mT[0])return this.mY[0][t]+(e-this.mT[0])*this.getSlopeAt(this.mT[0],t);if(e>=this.mT[i-1])return this.mY[i-1][t]+(e-this.mT[i-1])*this.getSlopeAt(this.mT[i-1],t)}else{if(e<=this.mT[0])return this.mY[0][t];if(e>=this.mT[i-1])return this.mY[i-1][t]}for(let r=0;r<i-1;r++){if(e===this.mT[r])return this.mY[r][t];if(e<this.mT[r+1]){let n=this.mT[r+1]-this.mT[r],s=(e-this.mT[r])/n;return Gu(n,s,this.mY[r][t],this.mY[r+1][t],this.mTangent[r][t],this.mTangent[r+1][t])}}return 0}getSlope(e,t){let i=this.mT.length,r=this.mY[0].length;e<=this.mT[0]?e=this.mT[0]:e>=this.mT[i-1]&&(e=this.mT[i-1]);for(let n=0;n<i-1;n++)if(e<=this.mT[n+1]){let s=this.mT[n+1]-this.mT[n],a=(e-this.mT[n])/s;for(let m=0;m<r;m++)t[m]=Yu(s,a,this.mY[n][m],this.mY[n+1][m],this.mTangent[n][m],this.mTangent[n+1][m])/s;break}}getSlopeAt(e,t){let i=this.mT.length;e<=this.mT[0]?e=this.mT[0]:e>=this.mT[i-1]&&(e=this.mT[i-1]);for(let r=0;r<i-1;r++)if(e<=this.mT[r+1]){let n=this.mT[r+1]-this.mT[r],s=(e-this.mT[r])/n;return Yu(n,s,this.mY[r][t],this.mY[r+1][t],this.mTangent[r][t],this.mTangent[r+1][t])/n}return 0}};function Gu(o,e,t,i,r,n){let s=e*e,a=s*e;return-2*a*i+3*s*i+2*a*t-3*s*t+t+o*n*a+o*r*a-o*n*s-2*o*r*s+o*r*e}function Yu(o,e,t,i,r,n){let s=e*e;return-6*s*i+6*e*i+6*s*t-6*e*t+3*o*n*s+3*o*r*s-2*o*n*e-4*o*r*e+o*r}var id=0,rd=1,nd=2,sd=3,od=4,ad=5,md=6,ud=7,ld=8,hd=9,cd=10,dd=11,pd=12,fd=13,gd=14,bd=15,yd=16,Id=17,Cd=18,vd=19,Td=20,Od=21,xd=22,Ad=1,Ed=2,Qu=4,Md=8,Ju=4,Fd=3<<Ju,tl=0;function Sd(o){return(o&Fd)>>Ju}var Te=24,el=14,Za=256,Pd=4,M=Math.fround;function A(o,e){return M(o*e)}function S(o,e){return M(o+e)}function jo(o,e,t){return o<e?e:o>t?t:o}function Ko(o,e,t,i,r,n,s){s[0]=M(A(e,n)-A(t,r)),s[1]=M(A(t,i)-A(o,n)),s[2]=M(A(o,r)-A(e,i))}function Qa(o,e,t){return o<e?e:o>t?t:o}function ja(o,e,t,i,r){let n=A(r,r),s=A(n,r),a=M(S(M(A(2,o)-A(5,e)),A(4,t))-i),m=S(M(S(-o,A(3,e))-A(3,t)),i);return A(.5,S(S(S(A(2,e),A(S(-o,t),r)),A(a,n)),A(m,s)))}function _t(o,e,t){let i=o>0?Math.round(o):e;return Math.max(t,i)}function Xi(o){let e=0,t=0,i=o.length>0;for(let c of o)e+=c.verts.length,t+=c.indices.length,c.uv===null&&(i=!1);let r=new Float32Array(e),n=new Float32Array(e),s=new Int32Array(t),a=i?new Float32Array(e/3*2):null,m=0,u=0,l=0,h=0;for(let c of o){r.set(c.verts,m),n.set(c.normals,m);for(let f=0;f<c.indices.length;f++)s[u+f]=c.indices[f]+h;a!==null&&c.uv!==null&&(a.set(c.uv,l),l+=c.uv.length),h+=c.verts.length/3,m+=c.verts.length,u+=c.indices.length}return{verts:r,normals:n,indices:s,uv:a}}function Yi(o,e,t,i,r){let n=Math.abs(o),s=Math.abs(e),a=Math.abs(t),m,u,l;n<=s&&n<=a?(m=1,u=0,l=0):s<=a?(m=0,u=1,l=0):(m=0,u=0,l=1);let h=M(A(e,l)-A(t,u)),c=M(A(t,m)-A(o,l)),f=M(A(o,u)-A(e,m)),d=M(Math.sqrt(S(S(A(h,h),A(c,c)),A(f,f))));d<1e-6&&(d=1e-6),i[0]=M(h/d),i[1]=M(c/d),i[2]=M(f/d),Ko(o,e,t,i[0],i[1],i[2],r)}function Ja(o,e,t,i,r,n,s,a,m){let u=i+1,l=r+1,h=new Float32Array(u*l*3),c=new Float32Array(u*l*3),f=m!==0?new Float32Array(u*l*2):null,d=0,p=0;for(let C=0;C<=i;C++){let y=S(e,M(A(M(t-e),C)/i)),I=M(Math.sin(y)),T=M(Math.cos(y));for(let v=0;v<=r;v++){let _=2*Math.PI*v/r,P=A(I,M(Math.cos(_))),E=T,L=A(I,M(Math.sin(_)));c[d]=P,c[d+1]=E,c[d+2]=L,h[d]=S(n,A(P,o)),h[d+1]=S(s,A(E,o)),h[d+2]=S(a,A(L,o)),d+=3,f!==null&&(f[p]=M(1-v/r),f[p+1]=M(1-C/i),p+=2)}}let b=new Int32Array(i*r*6),g=0;for(let C=0;C<i;C++)for(let y=0;y<r;y++){let I=C*l+y,T=(C+1)*l+y,v=(C+1)*l+(y+1),_=C*l+(y+1);b[g++]=_,b[g++]=v,b[g++]=T,b[g++]=T,b[g++]=I,b[g++]=_}return{verts:h,normals:c,indices:b,uv:f}}function _d(o,e,t,i,r,n,s){return Ja(o,0,Math.PI,n,r,e,t,i,s)}function Rd(o,e,t,i,r,n,s,a){let m=s+1,u=n+1,l=new Float32Array(u*m*3),h=new Float32Array(u*m*3),c=a!==0?new Float32Array(u*m*2):null,f=0,d=0;for(let g=0;g<=n;g++){let C=2*Math.PI*g/n,y=M(Math.cos(C)),I=M(Math.sin(C));for(let T=0;T<=s;T++){let v=2*Math.PI*T/s,_=M(Math.cos(v)),P=M(Math.sin(v));h[f]=A(_,y),h[f+1]=P,h[f+2]=A(_,I),l[f]=S(t,A(S(o,A(e,_)),y)),l[f+1]=S(i,A(e,P)),l[f+2]=S(r,A(S(o,A(e,_)),I)),f+=3,c!==null&&(c[d]=M(g/n),c[d+1]=M(T/s),d+=2)}}let p=new Int32Array(n*s*6),b=0;for(let g=0;g<n;g++)for(let C=0;C<s;C++){let y=g*m+C,I=(g+1)*m+C,T=(g+1)*m+(C+1),v=g*m+(C+1);p[b++]=v,p[b++]=T,p[b++]=I,p[b++]=I,p[b++]=y,p[b++]=v}return{verts:l,normals:h,indices:p,uv:c}}function Bd(o,e,t,i,r,n){let s=A(o,.5),a=A(e,.5),m=new Float32Array([M(t-s),M(i-a),r,S(t,s),M(i-a),r,S(t,s),S(i,a),r,M(t-s),S(i,a),r]),u=new Float32Array([0,0,1,0,0,1,0,0,1,0,0,1]),l=new Int32Array([0,1,2,2,3,0]),h=n!==0?new Float32Array([0,0,1,0,1,1,0,1]):null;return{verts:m,normals:u,indices:l,uv:h}}var Ka=[[0,0,1],[0,0,-1],[1,0,0],[-1,0,0],[0,1,0],[0,-1,0]],qa=[[[-1,-1,1],[1,-1,1],[1,1,1],[-1,1,1]],[[1,-1,-1],[-1,-1,-1],[-1,1,-1],[1,1,-1]],[[1,-1,1],[1,-1,-1],[1,1,-1],[1,1,1]],[[-1,-1,-1],[-1,-1,1],[-1,1,1],[-1,1,-1]],[[-1,1,1],[1,1,1],[1,1,-1],[-1,1,-1]],[[-1,-1,-1],[1,-1,-1],[1,-1,1],[-1,-1,1]]],Xu=[[0,0],[1,0],[1,1],[0,1]];function Dd(o,e,t,i,r,n,s){let a=A(o,.5),m=A(e,.5),u=A(t,.5),l=new Float32Array(72),h=new Float32Array(72),c=new Int32Array(36),f=s!==0?new Float32Array(48):null,d=0,p=0,b=0;for(let g=0;g<6;g++){let C=g*4;for(let y=0;y<4;y++)l[d]=S(i,A(qa[g][y][0],a)),l[d+1]=S(r,A(qa[g][y][1],m)),l[d+2]=S(n,A(qa[g][y][2],u)),h[d]=Ka[g][0],h[d+1]=Ka[g][1],h[d+2]=Ka[g][2],d+=3,f!==null&&(f[b]=Xu[y][0],f[b+1]=Xu[y][1],b+=2);c[p++]=C,c[p++]=C+1,c[p++]=C+2,c[p++]=C+2,c[p++]=C+3,c[p++]=C}return{verts:l,normals:h,indices:c,uv:f}}function Ir(o,e,t,i,r,n,s,a,m,u,l,h){let c=new Float32Array(3);Ko(i,r,n,s,a,m,c),h&&(c[0]=-c[0],c[1]=-c[1],c[2]=-c[2]);let f=new Float32Array((l+1)*3),d=new Float32Array((l+1)*3);for(let C=0;C<l;C++){let y=2*Math.PI*C/l,I=M(Math.cos(y)),T=M(Math.sin(y)),v=C*3;f[v]=S(o,A(u,S(A(I,i),A(T,s)))),f[v+1]=S(e,A(u,S(A(I,r),A(T,a)))),f[v+2]=S(t,A(u,S(A(I,n),A(T,m)))),d[v]=c[0],d[v+1]=c[1],d[v+2]=c[2]}let p=l;f[p*3]=o,f[p*3+1]=e,f[p*3+2]=t,d[p*3]=c[0],d[p*3+1]=c[1],d[p*3+2]=c[2];let b=new Int32Array(l*3),g=0;for(let C=0;C<l;C++){let y=(C+1)%l;h?(b[g++]=p,b[g++]=y,b[g++]=C):(b[g++]=p,b[g++]=C,b[g++]=y)}return{verts:f,normals:d,indices:b,uv:null}}function wd(o,e,t,i,r,n){let s=M(Math.sqrt(S(A(e,e),A(o,o)))),a=M(o/s),m=M(e/s),u=new Float32Array((n+1)*2*3),l=new Float32Array((n+1)*2*3);for(let p=0;p<=n;p++){let b=2*Math.PI*p/n,g=M(Math.cos(b)),C=M(Math.sin(b)),y=p*3,I=(n+1+p)*3;u[y]=S(t,A(o,g)),u[y+1]=i,u[y+2]=S(r,A(o,C)),l[y]=A(m,g),l[y+1]=a,l[y+2]=A(m,C),u[I]=t,u[I+1]=S(i,e),u[I+2]=r,l[I]=A(m,g),l[I+1]=a,l[I+2]=A(m,C)}let h=new Int32Array(n*3),c=0;for(let p=0;p<n;p++)h[c++]=p,h[c++]=n+1+p,h[c++]=p+1;let f={verts:u,normals:l,indices:h,uv:null},d=Ir(t,i,r,1,0,0,0,0,1,o,n,!1);return Xi([f,d])}function Ld(o,e,t,i,r,n,s,a){let m=M(r-e),u=M(n-t),l=M(s-i),h=M(Math.sqrt(S(S(A(m,m),A(u,u)),A(l,l))));h<1e-6&&(h=1e-6),m=M(m/h),u=M(u/h),l=M(l/h);let c=new Float32Array(3),f=new Float32Array(3);Yi(m,u,l,c,f);let d=new Float32Array((a+1)*2*3),p=new Float32Array((a+1)*2*3);for(let T=0;T<=a;T++){let v=2*Math.PI*T/a,_=M(Math.cos(v)),P=M(Math.sin(v)),E=S(A(_,c[0]),A(P,f[0])),L=S(A(_,c[1]),A(P,f[1])),V=S(A(_,c[2]),A(P,f[2])),B=T*3,U=(a+1+T)*3;d[B]=S(e,A(o,E)),d[B+1]=S(t,A(o,L)),d[B+2]=S(i,A(o,V)),d[U]=S(r,A(o,E)),d[U+1]=S(n,A(o,L)),d[U+2]=S(s,A(o,V)),p[B]=E,p[B+1]=L,p[B+2]=V,p[U]=E,p[U+1]=L,p[U+2]=V}let b=new Int32Array(a*6),g=0;for(let T=0;T<a;T++){let v=T,_=T+1,P=a+1+T,E=a+1+T+1;b[g++]=P,b[g++]=v,b[g++]=_,b[g++]=_,b[g++]=E,b[g++]=P}let C={verts:d,normals:p,indices:b,uv:null},y=Ir(e,t,i,c[0],c[1],c[2],f[0],f[1],f[2],o,a,!0),I=Ir(r,n,s,c[0],c[1],c[2],f[0],f[1],f[2],o,a,!1);return Xi([C,y,I])}function Nd(o,e,t,i,r,n,s,a){let m=Math.max(M(A(o,.5)-s),0),u=Math.max(M(A(e,.5)-s),0),l=Math.max(M(A(t,.5)-s),0),h=S(m,s),c=S(u,s),f=S(l,s),d=[[0,1],[0,-1],[1,1],[1,-1],[2,1],[2,-1]],p=(a+1)*(a+1),b=6*p,g=new Float32Array(b*3),C=new Float32Array(b*3),y=new Int32Array(6*a*a*6),I=0,T=0,v=0;for(let _ of d){let P=_[0],E=_[1],L=[0,0,0],V=[0,0,0],B=[0,0,0];B[P]=E,P===0?E>0?(L[1]=1,V[2]=1):(L[2]=1,V[1]=1):P===1?E>0?(L[2]=1,V[0]=1):(L[0]=1,V[2]=1):E>0?(L[0]=1,V[1]=1):(L[1]=1,V[0]=1);for(let H=0;H<=a;H++){let N=M(M(H/a)*2-1);for(let k=0;k<=a;k++){let Y=M(M(k/a)*2-1),$=S(S(A(B[0],h),A(L[0],A(N,h))),A(V[0],A(Y,h))),w=S(S(A(B[1],c),A(L[1],A(N,c))),A(V[1],A(Y,c))),X=S(S(A(B[2],f),A(L[2],A(N,f))),A(V[2],A(Y,f))),z=jo($,-m,m),j=jo(w,-u,u),rt=jo(X,-l,l),nt=M($-z),ut=M(w-j),It=M(X-rt),Ft=M(Math.sqrt(S(S(A(nt,nt),A(ut,ut)),A(It,It))));Ft<1e-6&&(nt=B[0],ut=B[1],It=B[2],Ft=1);let Tt=M(1/Ft);g[I]=S(S(i,z),A(s,A(nt,Tt))),g[I+1]=S(S(r,j),A(s,A(ut,Tt))),g[I+2]=S(S(n,rt),A(s,A(It,Tt))),C[I]=A(nt,Tt),C[I+1]=A(ut,Tt),C[I+2]=A(It,Tt),I+=3}}let U=a+1;for(let H=0;H<a;H++)for(let N=0;N<a;N++){let k=v+H*U+N,Y=v+(H+1)*U+N,$=v+(H+1)*U+(N+1),w=v+H*U+(N+1);y[T++]=k,y[T++]=Y,y[T++]=$,y[T++]=$,y[T++]=w,y[T++]=k}v+=p}return{verts:g,normals:C,indices:y,uv:null}}function Vd(o,e,t,i,r,n,s){let a=Ja(o,0,e,s,n,t,i,r,tl),m=n,u=M(Math.cos(e)),l=M(Math.sin(e)),h=A(o,u),c=A(o,l),f=new Float32Array((m+1)*2*3),d=new Float32Array((m+1)*2*3);for(let g=0;g<=m;g++){let C=2*Math.PI*g/m,y=M(Math.cos(C)),I=M(Math.sin(C)),T=g*3,v=(m+1+g)*3;f[T]=S(t,A(c,y)),f[T+1]=S(i,h),f[T+2]=S(r,A(c,I)),f[v]=t,f[v+1]=i,f[v+2]=r;let _=A(u,y),P=-l,E=A(u,I);d[T]=_,d[T+1]=P,d[T+2]=E,d[v]=_,d[v+1]=P,d[v+2]=E}let p=new Int32Array(m*3),b=0;for(let g=0;g<m;g++)p[b++]=g,p[b++]=g+1,p[b++]=m+1+g;return Xi([a,{verts:f,normals:d,indices:p,uv:null}])}function Wd(o,e,t,i,r,n,s){let a=Ja(o,0,e,s,n,t,i,r,tl),m=A(o,M(Math.cos(e))),u=A(o,M(Math.sin(e))),l=Ir(t,S(i,m),r,1,0,0,0,0,1,u,n,!1);return Xi([a,l])}var kd=[[0,11,5],[0,5,1],[0,1,7],[0,7,10],[0,10,11],[1,5,9],[5,11,4],[11,10,2],[10,7,6],[7,1,8],[3,9,4],[3,4,2],[3,2,6],[3,6,8],[3,8,9],[4,9,5],[2,4,11],[6,2,10],[8,6,7],[9,8,1]];function Hd(o,e,t,i,r){let n=M((1+Math.sqrt(5))/2),s=[[-1,n,0],[1,n,0],[-1,-n,0],[1,-n,0],[0,-1,n],[0,1,n],[0,-1,-n],[0,1,-n],[n,0,-1],[n,0,1],[-n,0,-1],[-n,0,1]],a=[];for(let b of s){let g=M(Math.sqrt(S(S(A(b[0],b[0]),A(b[1],b[1])),A(b[2],b[2]))));a.push([M(b[0]/g),M(b[1]/g),M(b[2]/g)])}let m=kd.map(b=>[b[0],b[1],b[2]]),u=new Map,l=(b,g)=>{let C=b<g?b*67108864+g:g*67108864+b,y=u.get(C);if(y!==void 0)return y;let I=a[b],T=a[g],v=A(S(I[0],T[0]),.5),_=A(S(I[1],T[1]),.5),P=A(S(I[2],T[2]),.5),E=M(Math.sqrt(S(S(A(v,v),A(_,_)),A(P,P)))),L=a.length;return a.push([M(v/E),M(_/E),M(P/E)]),u.set(C,L),L};for(let b=0;b<r;b++){let g=[];for(let C of m){let y=l(C[0],C[1]),I=l(C[1],C[2]),T=l(C[2],C[0]);g.push([C[0],y,T],[C[1],I,y],[C[2],T,I],[y,I,T])}m=g}let h=a.length,c=new Float32Array(h*3),f=new Float32Array(h*3);for(let b=0;b<h;b++){let g=a[b];c[b*3]=S(e,A(o,g[0])),c[b*3+1]=S(t,A(o,g[1])),c[b*3+2]=S(i,A(o,g[2])),f[b*3]=g[0],f[b*3+1]=g[1],f[b*3+2]=g[2]}let d=new Int32Array(m.length*3),p=0;for(let b of m)d[p++]=b[0],d[p++]=b[1],d[p++]=b[2];return{verts:c,normals:f,indices:d,uv:null}}function Ud(o,e,t,i,r){let n=Math.floor(o.length/2);if(n<2)throw new Error("MeshPrimitive lathe: need >= 2 profile points");let s=r+1,a=n*s,m=new Float32Array(a*3),u=new Float32Array(a*3),l=new Float32Array(n),h=new Float32Array(n);for(let d=0;d<n-1;d++){let p=M(o[(d+1)*2]-o[d*2]),g=M(o[(d+1)*2+1]-o[d*2+1]),C=-p,y=M(Math.sqrt(S(A(g,g),A(C,C))));y>1e-9&&(g=M(g/y),C=M(C/y)),l[d]=S(l[d],g),h[d]=S(h[d],C),l[d+1]=S(l[d+1],g),h[d+1]=S(h[d+1],C)}for(let d=0;d<n;d++){let p=M(Math.sqrt(S(A(l[d],l[d]),A(h[d],h[d]))));p>1e-9?(l[d]=M(l[d]/p),h[d]=M(h[d]/p)):(l[d]=1,h[d]=0)}for(let d=0;d<n;d++){let p=o[d*2],b=o[d*2+1];for(let g=0;g<=r;g++){let C=2*Math.PI*g/r,y=M(Math.cos(C)),I=M(Math.sin(C)),T=(d*s+g)*3;m[T]=S(e,A(p,y)),m[T+1]=S(t,b),m[T+2]=S(i,A(p,I)),u[T]=A(l[d],y),u[T+1]=h[d],u[T+2]=A(l[d],I)}}let c=new Int32Array((n-1)*r*6),f=0;for(let d=0;d<n-1;d++)for(let p=0;p<r;p++){let b=d*s+p,g=d*s+p+1,C=(d+1)*s+p,y=(d+1)*s+p+1;c[f++]=g,c[f++]=b,c[f++]=C,c[f++]=C,c[f++]=y,c[f++]=g}return{verts:m,normals:u,indices:c,uv:null}}function zo(o,e,t,i,r,n,s,a){let m=t*3;o[m]=i,o[m+1]=r,o[m+2]=n,e[m]=s,e[m+1]=a}function Cr(o,e,t,i,r,n,s){let a=o.length/2,m=A(i,.5),u=t.length,l=a*2+u*4,h=new Float32Array(l*3),c=new Float32Array(l*3);for(let b=0;b<a;b++){let g=o[b*2],C=o[b*2+1],y=b*3;h[y]=S(r,g),h[y+1]=S(n,C),h[y+2]=S(s,m),c[y+2]=1;let I=(a+b)*3;h[I]=S(r,g),h[I+1]=S(n,C),h[I+2]=M(s-m),c[I+2]=-1}let f=new Int32Array(e.length*2+u*6),d=0;for(let b=0;b<e.length;b+=3)f[d++]=e[b],f[d++]=e[b+1],f[d++]=e[b+2];for(let b=0;b<e.length;b+=3)f[d++]=a+e[b],f[d++]=a+e[b+2],f[d++]=a+e[b+1];let p=a*2;for(let b=0;b<u;b++){let g=t[b],C=t[(b+1)%u],y=o[g*2],I=o[g*2+1],T=o[C*2],v=o[C*2+1],_=M(T-y),E=M(v-I),L=-_,V=M(Math.sqrt(S(A(E,E),A(L,L))));V>1e-9&&(E=M(E/V),L=M(L/V));let B=p+b*4;zo(h,c,B,S(r,y),S(n,I),S(s,m),E,L),zo(h,c,B+1,S(r,T),S(n,v),S(s,m),E,L),zo(h,c,B+2,S(r,y),S(n,I),M(s-m),E,L),zo(h,c,B+3,S(r,T),S(n,v),M(s-m),E,L),f[d++]=B,f[d++]=B+2,f[d++]=B+3,f[d++]=B,f[d++]=B+3,f[d++]=B+1}return{verts:h,normals:c,indices:f,uv:null}}function Gd(o,e,t,i,r,n){let s=new Float32Array((n+1)*2);for(let h=0;h<n;h++){let c=2*Math.PI*h/n;s[h*2]=A(o,M(Math.cos(c))),s[h*2+1]=A(o,M(Math.sin(c)))}let a=n,m=new Int32Array(n*3),u=new Int32Array(n),l=0;for(let h=0;h<n;h++){let c=(h+1)%n;m[l++]=a,m[l++]=h,m[l++]=c,u[h]=h}return Cr(s,m,u,e,t,i,r)}function Yd(o,e,t,i,r,n,s,a){let m=new Float32Array((a+2)*2);for(let c=0;c<=a;c++){let f=e+t*c/a;m[(1+c)*2]=A(o,M(Math.cos(f))),m[(1+c)*2+1]=A(o,M(Math.sin(f)))}let u=new Int32Array(a*3),l=0;for(let c=0;c<a;c++)u[l++]=0,u[l++]=1+c,u[l++]=2+c;let h=new Int32Array(a+2);h[0]=0;for(let c=0;c<=a;c++)h[1+c]=1+c;return Cr(m,u,h,i,r,n,s)}function Xd(o,e,t,i,r,n,s,a){let m=new Float32Array((a+1)*2);for(let c=0;c<=a;c++){let f=e+t*c/a;m[c*2]=A(o,M(Math.cos(f))),m[c*2+1]=A(o,M(Math.sin(f)))}let u=new Int32Array(Math.max(0,a-1)*3),l=0;for(let c=1;c<a;c++)u[l++]=0,u[l++]=c,u[l++]=c+1;let h=new Int32Array(a+1);for(let c=0;c<=a;c++)h[c]=c;return Cr(m,u,h,i,r,n,s)}function $d(o,e,t,i,r,n,s,a,m){let u=m+1,l=new Float32Array(2*(m+1)*2);for(let p=0;p<=m;p++){let b=t+i*p/m,g=M(Math.cos(b)),C=M(Math.sin(b));l[p*2]=A(e,g),l[p*2+1]=A(e,C);let y=u+p;l[y*2]=A(o,g),l[y*2+1]=A(o,C)}let h=new Int32Array(m*2*3),c=0;for(let p=0;p<m;p++){let b=p,g=p+1,C=u+p,y=u+p+1;h[c++]=b,h[c++]=g,h[c++]=y,h[c++]=b,h[c++]=y,h[c++]=C}let f=new Int32Array(2*(m+1)),d=0;for(let p=0;p<=m;p++)f[d++]=p;for(let p=m;p>=0;p--)f[d++]=u+p;return Cr(l,h,f,r,n,s,a)}function zd(o,e,t,i,r,n,s,a){let m=A(o,.5),u=A(e,.5);t=jo(t,0,Math.min(m,u));let l=M(m-t),h=M(u-t),c=[l,l,-l,-l],f=[-h,h,h,-h],d=[-M(Math.PI/2),0,M(Math.PI/2),M(Math.PI)],b=4*(a+1),g=new Float32Array((b+1)*2),C=0;for(let _=0;_<4;_++)for(let P=0;P<=a;P++){let E=d[_]+Math.PI/2*P/a;g[C*2]=S(c[_],A(t,M(Math.cos(E)))),g[C*2+1]=S(f[_],A(t,M(Math.sin(E)))),C++}let y=b,I=new Int32Array(b*3),T=new Int32Array(b),v=0;for(let _=0;_<b;_++){let P=(_+1)%b;I[v++]=y,I[v++]=_,I[v++]=P,T[_]=_}return Cr(g,I,T,i,r,n,s)}function jd(o,e,t,i,r,n,s){let a=e<=0?4:e,m=M(2/a),u=new Float32Array((s+1)*2);for(let d=0;d<s;d++){let p=2*Math.PI*d/s,b=M(Math.cos(p)),g=M(Math.sin(p));u[d*2]=A(A(o,Math.sign(b)),M(Math.pow(Math.abs(b),m))),u[d*2+1]=A(A(o,Math.sign(g)),M(Math.pow(Math.abs(g),m)))}let l=s,h=new Int32Array(s*3),c=new Int32Array(s),f=0;for(let d=0;d<s;d++){let p=(d+1)%s;h[f++]=l,h[f++]=d,h[f++]=p,c[d]=d}return Cr(u,h,c,t,i,r,n)}function il(o,e,t,i,r,n,s,a,m,u){let l=new Float32Array(3),h=new Float32Array(3);Yi(i[0],r[0],n[0],l,h);let c=new Float32Array(a*(m+1)*3),f=new Float32Array(a*(m+1)*3);for(let P=0;P<a;P++){if(P>0){let E=S(S(A(l[0],i[P]),A(l[1],r[P])),A(l[2],n[P]));l[0]=M(l[0]-A(E,i[P])),l[1]=M(l[1]-A(E,r[P])),l[2]=M(l[2]-A(E,n[P]));let L=M(Math.sqrt(S(S(A(l[0],l[0]),A(l[1],l[1])),A(l[2],l[2]))));L<1e-6?Yi(i[P],r[P],n[P],l,h):(l[0]=M(l[0]/L),l[1]=M(l[1]/L),l[2]=M(l[2]/L),Ko(i[P],r[P],n[P],l[0],l[1],l[2],h))}for(let E=0;E<=m;E++){let L=2*Math.PI*E/m,V=M(Math.cos(L)),B=M(Math.sin(L)),U=S(A(V,l[0]),A(B,h[0])),H=S(A(V,l[1]),A(B,h[1])),N=S(A(V,l[2]),A(B,h[2])),k=(P*(m+1)+E)*3,Y=s[P];c[k]=S(o[P],A(Y,U)),c[k+1]=S(e[P],A(Y,H)),c[k+2]=S(t[P],A(Y,N)),f[k]=U,f[k+1]=H,f[k+2]=N}}let d=m+1,p=new Int32Array((a-1)*m*6),b=0;for(let P=0;P<a-1;P++)for(let E=0;E<m;E++){let L=P*d+E,V=P*d+E+1,B=(P+1)*d+E,U=(P+1)*d+E+1;p[b++]=B,p[b++]=L,p[b++]=V,p[b++]=V,p[b++]=U,p[b++]=B}let g={verts:c,normals:f,indices:p,uv:null};if(!u)return g;let C=new Float32Array(3),y=new Float32Array(3);Yi(i[0],r[0],n[0],C,y);let I=new Float32Array(3),T=new Float32Array(3);Yi(i[a-1],r[a-1],n[a-1],I,T);let v=Ir(o[0],e[0],t[0],C[0],C[1],C[2],y[0],y[1],y[2],s[0],m,!0),_=Ir(o[a-1],e[a-1],t[a-1],I[0],I[1],I[2],T[0],T[1],T[2],s[a-1],m,!1);return Xi([g,v,_])}function rl(o,e,t,i,r){let n=[];for(let s=0;s<i;s++)n.push(new Float64Array(3));n[0][0]=o[0],n[0][1]=e[0],n[0][2]=t[0];for(let s=1;s<i;s++){let a=M(o[s]-o[s-1]),m=M(e[s]-e[s-1]),u=M(t[s]-t[s-1]),l=Math.sqrt(S(S(A(a,a),A(m,m)),A(u,u)));r[s]=r[s-1]+Math.max(l,1e-4),n[s][0]=o[s],n[s][1]=e[s],n[s][2]=t[s]}return new Hn(r,n)}function $u(o,e,t){if(o===null)return t;let i=M(o.getPosAt(e,0));return i<0?0:i}function zu(o,e,t,i,r,n,s,a,m,u,l,h,c,f){o.getPos(e,t),o.getSlope(e,i),r[l]=t[0],n[l]=t[1],s[l]=t[2];let d=M(i[0]),p=M(i[1]),b=M(i[2]),g=M(Math.sqrt(S(S(A(d,d),A(p,p)),A(b,b))));return g<1e-6?(a[l]=h,m[l]=c,u[l]=f):(a[l]=M(d/g),m[l]=M(p/g),u[l]=M(b/g)),l+1}function nl(o,e,t,i,r,n,s,a){let m=n>0,u=m?Qa(Math.round(n),1,Za):0,l=6,h=new Int32Array(t-1),c=1,f=new Float64Array(3),d=new Float64Array(3);for(let H=0;H<t-1;H++){let N;if(m)N=u;else{let k=e[H],Y=e[H+1],$=s!==null?M(s.getPosAt((k+Y)*.5,0)):a,w=Math.max(2*Math.abs($)*Math.sin(Math.PI/i),1e-4),X=0;o.getPos(k,f);for(let z=1;z<=l;z++){o.getPos(k+(Y-k)*z/l,d);let j=d[0]-f[0],rt=d[1]-f[1],nt=d[2]-f[2];X+=Math.sqrt(j*j+rt*rt+nt*nt),f[0]=d[0],f[1]=d[1],f[2]=d[2]}N=Qa(Math.trunc(Math.round(X/w)),1,Za)}h[H]=N,c+=N}let p=c,b=new Float32Array(p),g=new Float32Array(p),C=new Float32Array(p),y=new Float32Array(p),I=new Float32Array(p),T=new Float32Array(p),v=new Float32Array(p),_=new Float32Array(3),P=new Float64Array(3),E=0,L=1,V=0,B=0;for(let H=0;H<t-1;H++){let N=e[H],k=e[H+1],Y=h[H];for(let $=0;$<Y;$++){let w=N+(k-N)*$/Y;B=zu(o,w,_,P,b,g,C,y,I,T,B,E,L,V),v[B-1]=$u(s,w,a),E=y[B-1],L=I[B-1],V=T[B-1]}}let U=e[t-1];return B=zu(o,U,_,P,b,g,C,y,I,T,B,E,L,V),v[B-1]=$u(s,U,a),il(b,g,C,y,I,T,v,p,i,r)}function Kd(o,e,t,i,r,n,s,a,m,u){let l,h,c;if((m&Ad)!==0){let C=u>0?Qa(Math.round(u),1,Za):_t(a,8,1),y=(i-1)*C+1;l=new Float32Array(y),h=new Float32Array(y),c=new Float32Array(y);let I=0;for(let T=0;T<i-1;T++){let v=Math.max(0,T-1),_=T+1,P=Math.min(i-1,T+2);for(let E=0;E<C;E++){let L=M(E/C);l[I]=ja(o[v],o[T],o[_],o[P],L),h[I]=ja(e[v],e[T],e[_],e[P],L),c[I]=ja(t[v],t[T],t[_],t[P],L),I++}}l[I]=o[i-1],h[I]=e[i-1],c[I]=t[i-1]}else l=o,h=e,c=t;let f=l.length,d=new Float32Array(f),p=new Float32Array(f),b=new Float32Array(f);for(let C=0;C<f;C++){let y=0,I=0,T=0;C>0&&(y=S(y,M(l[C]-l[C-1])),I=S(I,M(h[C]-h[C-1])),T=S(T,M(c[C]-c[C-1]))),C<f-1&&(y=S(y,M(l[C+1]-l[C])),I=S(I,M(h[C+1]-h[C])),T=S(T,M(c[C+1]-c[C])));let v=M(Math.sqrt(S(S(A(y,y),A(I,I)),A(T,T))));v<1e-6&&(y=0,I=1,T=0,v=1),d[C]=M(y/v),p[C]=M(I/v),b[C]=M(T/v)}let g=new Float32Array(f).fill(r);return il(l,h,c,d,p,b,g,f,n,s)}function ju(o,e,t,i){let r=o[0],n=(i&Qu)!==0,s=n?2:1,a=n?o[1]:0,m=Math.floor((o.length-s)/3);if(m<2)throw new Error("MeshPrimitive tube: need >= 2 points");let u=new Float32Array(m),l=new Float32Array(m),h=new Float32Array(m);for(let p=0;p<m;p++)u[p]=o[s+p*3],l[p]=o[s+p*3+1],h[p]=o[s+p*3+2];let c=_t(t,el,3);if((i&Ed)!==0)return Kd(u,l,h,m,r,c,e,t,i,a);let f=new Float64Array(m),d=rl(u,l,h,m,f);return nl(d,f,m,c,e,a,null,r)}function qd(o,e,t){let i=Math.round(o[0]),r=(t&Qu)!==0,n=(t&Md)!==0,s=r?2:1,a=r?o[1]:0;if(i<2)throw new Error("MeshPrimitive profile tube: need >= 2 points");let m=s+3*i,u=o.length-m;if(u<1)throw new Error("MeshPrimitive profile tube: need >= 1 radius");let l=new Float32Array(i),h=new Float32Array(i),c=new Float32Array(i);for(let g=0;g<i;g++)l[g]=o[s+g*3],h[g]=o[s+g*3+1],c[g]=o[s+g*3+2];let f=new Float64Array(i),d=rl(l,h,c,i,f),p=f[i-1],b=null;if(u>=2){let g=new Float64Array(u),C=[];for(let y=0;y<u;y++){g[y]=p*y/(u-1);let I=new Float64Array(1);I[0]=o[m+y],C.push(I)}b=new Hn(g,C)}return nl(d,f,i,e,n,a,b,o[m])}function Ku(o,e,t,i,r,n,s,a,m,u,l){let h=0,c=0,f=0;for(let V=0;V<a;V++){let B=(n*s+V)*3;h=S(h,o[B]),c=S(c,o[B+1]),f=S(f,o[B+2])}h=M(h/a),c=M(c/a),f=M(f/a);let d=r;o[d*3]=h,o[d*3+1]=c,o[d*3+2]=f,e[d*3]=m,e[d*3+1]=u,e[d*3+2]=l;for(let V=0;V<a;V++){let B=(n*s+V)*3,U=(r+1+V)*3;o[U]=o[B],o[U+1]=o[B+1],o[U+2]=o[B+2],e[U]=m,e[U+1]=u,e[U+2]=l}let p=r+1,b=r+1+1%a,g=M(o[p*3]-h),C=M(o[p*3+1]-c),y=M(o[p*3+2]-f),I=M(o[b*3]-h),T=M(o[b*3+1]-c),v=M(o[b*3+2]-f),_=M(A(C,v)-A(y,T)),P=M(A(y,I)-A(g,v)),E=M(A(g,T)-A(C,I)),L=S(S(A(_,m),A(P,u)),A(E,l))<0;for(let V=0;V<a;V++){let B=r+1+V,U=r+1+(V+1)%a;t[i++]=d,L?(t[i++]=U,t[i++]=B):(t[i++]=B,t[i++]=U)}return i}function sl(o,e,t,i,r){let n=Math.floor(e.length/2),s=Math.floor(t.length/3);if(n<2||s<2)throw new Error("MeshPrimitive sweep: need >= 2 cross-section points and >= 2 path points");let a=o.length>0&&o[0]!==0,m=o.length>1&&o[1]!==0,u=o.length>2&&o[2]!==0,l=o.length>3?o[3]:0,h=o.length>4?o[4]:0,c=o.length>5?o[5]:0,f=new Float32Array(s),d=new Float32Array(s),p=new Float32Array(s);for(let w=0;w<s;w++)f[w]=S(l,t[w*3]),d[w]=S(h,t[w*3+1]),p[w]=S(c,t[w*3+2]);let b=new Float32Array(s),g=new Float32Array(s),C=new Float32Array(s);for(let w=0;w<s;w++){let X=Math.max(0,w-1),z=Math.min(s-1,w+1),j=M(f[z]-f[X]),rt=M(d[z]-d[X]),nt=M(p[z]-p[X]),ut=M(Math.sqrt(S(S(A(j,j),A(rt,rt)),A(nt,nt))));ut<1e-9&&(ut=1e-9),b[w]=M(j/ut),g[w]=M(rt/ut),C[w]=M(nt/ut)}let y=new Float32Array(n),I=new Float32Array(n),T=a?n:n-1;for(let w=0;w<T;w++){let X=w,z=(w+1)%n,j=M(e[z*2]-e[X*2]),nt=M(e[z*2+1]-e[X*2+1]),ut=-j,It=M(Math.sqrt(S(A(nt,nt),A(ut,ut))));It>1e-9&&(nt=M(nt/It),ut=M(ut/It)),y[X]=S(y[X],nt),I[X]=S(I[X],ut),y[z]=S(y[z],nt),I[z]=S(I[z],ut)}for(let w=0;w<n;w++){let X=M(Math.sqrt(S(A(y[w],y[w]),A(I[w],I[w]))));X>1e-9?(y[w]=M(y[w]/X),I[w]=M(I[w]/X)):(y[w]=1,I[w]=0)}let v=a?n+1:n,_=s*v,P=(m?n+1:0)+(u?n+1:0),E=new Float32Array((_+P)*3),L=new Float32Array((_+P)*3),V=a?n:n-1,B=(s-1)*V*2,U=(m?n:0)+(u?n:0),H=new Int32Array((B+U)*3),N=new Float32Array(3),k=new Float32Array(3);Yi(b[0],g[0],C[0],N,k);for(let w=0;w<s;w++){if(w>0){let nt=S(S(A(N[0],b[w]),A(N[1],g[w])),A(N[2],C[w]));N[0]=M(N[0]-A(nt,b[w])),N[1]=M(N[1]-A(nt,g[w])),N[2]=M(N[2]-A(nt,C[w]));let ut=M(Math.sqrt(S(S(A(N[0],N[0]),A(N[1],N[1])),A(N[2],N[2]))));ut<1e-6?Yi(b[w],g[w],C[w],N,k):(N[0]=M(N[0]/ut),N[1]=M(N[1]/ut),N[2]=M(N[2]/ut),Ko(b[w],g[w],C[w],N[0],N[1],N[2],k))}let X=i!==null&&i.length>w?i[w]:1,z=r!==null&&r.length>w?r[w]:0,j=M(Math.cos(z)),rt=M(Math.sin(z));for(let nt=0;nt<v;nt++){let ut=nt%n,It=e[ut*2],Ft=e[ut*2+1],Tt=M(A(j,It)-A(rt,Ft)),St=S(A(rt,It),A(j,Ft)),Pt=(w*v+nt)*3;E[Pt]=S(f[w],A(X,S(A(Tt,N[0]),A(St,k[0])))),E[Pt+1]=S(d[w],A(X,S(A(Tt,N[1]),A(St,k[1])))),E[Pt+2]=S(p[w],A(X,S(A(Tt,N[2]),A(St,k[2]))));let Zt=M(A(j,y[ut])-A(rt,I[ut])),Dt=S(A(rt,y[ut]),A(j,I[ut])),wt=S(A(Zt,N[0]),A(Dt,k[0])),Lt=S(A(Zt,N[1]),A(Dt,k[1])),Nt=S(A(Zt,N[2]),A(Dt,k[2])),te=M(Math.sqrt(S(S(A(wt,wt),A(Lt,Lt)),A(Nt,Nt))));te>1e-9&&(wt=M(wt/te),Lt=M(Lt/te),Nt=M(Nt/te)),L[Pt]=wt,L[Pt+1]=Lt,L[Pt+2]=Nt}}let Y=0;for(let w=0;w<s-1;w++)for(let X=0;X<V;X++){let z=w*v+X,j=w*v+X+1,rt=(w+1)*v+X,nt=(w+1)*v+X+1;H[Y++]=rt,H[Y++]=z,H[Y++]=j,H[Y++]=j,H[Y++]=nt,H[Y++]=rt}let $=_;return m&&(Y=Ku(E,L,H,Y,$,0,v,n,-b[0],-g[0],-C[0]),$+=n+1),u&&(Y=Ku(E,L,H,Y,$,s-1,v,n,b[s-1],g[s-1],C[s-1])),{verts:E,normals:L,indices:H,uv:null}}function Zd(o,e,t,i,r,n,s,a){let m=Math.max(8,a*2),u=Math.max(2,Math.round(m*Math.abs(i))+1),l=new Float32Array(u*3),h=A(t,i);for(let d=0;d<u;d++){let p=M(d/(u-1)),b=2*Math.PI*i*p;l[d*3]=A(o,M(Math.cos(b))),l[d*3+1]=A(h,M(p-.5)),l[d*3+2]=A(o,M(Math.sin(b)))}let c=new Float32Array(a*2);for(let d=0;d<a;d++){let p=2*Math.PI*d/a;c[d*2]=A(e,M(Math.cos(p))),c[d*2+1]=A(e,M(Math.sin(p)))}let f=new Float32Array([1,1,1,r,n,s]);return sl(f,c,l,null,null)}function ol(o){let e=Math.floor(o.length/2),t=0;for(let i=0;i<e;i++){let r=(i+1)%e;t=S(t,M(A(o[i*2],o[r*2+1])-A(o[r*2],o[i*2+1])))}return A(t,.5)}function Qd(o,e,t){let i=Math.floor(o.length/2),r=!1;for(let n=0,s=i-1;n<i;s=n++){let a=o[n*2],m=o[n*2+1],u=o[s*2],l=o[s*2+1];m>t!=l>t&&e<S(M(A(M(u-a),M(t-m))/M(l-m)),a)&&(r=!r)}return r}function Jd(o,e){let t=o[e];if(t.length<2)return!1;let i=t[0],r=t[1],n=0;for(let s=0;s<o.length;s++)s!==e&&Qd(o[s],i,r)&&n++;return(n&1)===1}function tp(o,e,t){let i=Math.floor(o.length/2),r=new Float32Array(o.length),n=ol(o)>=0?1:-1;for(let s=0;s<i;s++){let a=(s-1+i)%i,m=(s+1)%i,u=M(o[s*2]-o[a*2]),l=M(o[s*2+1]-o[a*2+1]),h=M(o[m*2]-o[s*2]),c=M(o[m*2+1]-o[s*2+1]),f=M(Math.sqrt(S(A(u,u),A(l,l))));f>1e-9&&(u=M(u/f),l=M(l/f));let d=M(Math.sqrt(S(A(h,h),A(c,c))));d>1e-9&&(h=M(h/d),c=M(c/d));let p=A(n,-l),b=A(n,u),g=A(n,-c),C=A(n,h),y=S(p,g),I=S(b,C),T=M(Math.sqrt(S(A(y,y),A(I,I))));if(T<1e-6){r[s*2]=S(o[s*2],A(e,g)),r[s*2+1]=S(o[s*2+1],A(e,C));continue}y=M(y/T),I=M(I/T);let v=S(A(y,p),A(I,b)),_=M(e/Math.max(v,M(1/t)));r[s*2]=S(o[s*2],A(_,y)),r[s*2+1]=S(o[s*2+1],A(_,I))}return r}function qu(o,e,t,i,r){let n=0;for(let E of o)n+=E.length/2;let s=new Float32Array(n),a=new Float32Array(n),m=new Float32Array(n),u=new Float32Array(n),l=new Int32Array(n),h=0,c=new Float32Array(n*2),f=0;for(let E of o){let L=E.length/2;for(let V=0;V<L;V++){let B=E[V*2+1],U=(V+1)%L,H=E[U*2+1];if(c[f++]=B,B===H)continue;let N=E[V*2],k=E[U*2];B<H?(s[h]=B,a[h]=H,m[h]=N):(s[h]=H,a[h]=B,m[h]=k),u[h]=M(M(k-N)/M(H-B)),l[h]=H>B?1:-1,h++}}c.subarray(0,f).sort();let p=0;for(let E=0;E<f;E++)(p===0||c[E]>S(c[p-1],1e-7))&&(c[p++]=c[E]);let b=[],g=new Float32Array(h),C=new Int32Array(h);for(let E=0;E+1<p;E++){let L=c[E],V=c[E+1];if(M(V-L)<1e-7)continue;let B=A(.5,S(L,V)),U=0;for(let N=0;N<h;N++)s[N]<B&&B<a[N]&&(g[U]=S(m[N],A(M(B-s[N]),u[N])),C[U]=N,U++);if(U<2)continue;for(let N=1;N<U;N++){let k=g[N],Y=C[N],$=N-1;for(;$>=0&&g[$]>k;)g[$+1]=g[$],C[$+1]=C[$],$--;g[$+1]=k,C[$+1]=Y}let H=0;for(let N=0;N+1<U;N++){if(H+=l[C[N]],H===0)continue;let k=C[N],Y=C[N+1],$=S(m[k],A(M(V-s[k]),u[k])),w=S(m[k],A(M(L-s[k]),u[k])),X=S(m[Y],A(M(V-s[Y]),u[Y])),z=S(m[Y],A(M(L-s[Y]),u[Y]));b.push(new Float32Array([$,V,X,V,z,L,w,L]))}}let y=b.length,I=new Float32Array(y*8*3),T=new Float32Array(y*8*3),v=new Int32Array(y*12),_=0,P=y*4;for(let E=0;E<y;E++){let L=b[E],V=E*4,B=P+E*4;for(let U=0;U<4;U++){let H=L[U*2],N=L[U*2+1],k=(V+U)*3;I[k]=S(e,H),I[k+1]=S(t,N),I[k+2]=i,T[k+2]=1;let Y=(B+U)*3;I[Y]=S(e,H),I[Y+1]=S(t,N),I[Y+2]=r,T[Y+2]=-1}v[_++]=V,v[_++]=V+2,v[_++]=V+1,v[_++]=V,v[_++]=V+3,v[_++]=V+2,v[_++]=B,v[_++]=B+1,v[_++]=B+2,v[_++]=B,v[_++]=B+2,v[_++]=B+3}return{verts:I,normals:T,indices:v,uv:null}}function Yt(o,e,t,i,r,n,s,a,m){let u=t*3;o[u]=i,o[u+1]=r,o[u+2]=n,e[u]=s,e[u+1]=a,e[u+2]=m}function Zu(o,e,t,i,r,n,s){let a=s>0&&e!==null,m=M(n-s),u=.70710678,l=0;for(let C of o)l+=C.length/2;let h=a?12:4,c=a?6:2,f=new Float32Array(l*h*3),d=new Float32Array(l*h*3),p=new Int32Array(l*c*3),b=0,g=0;for(let C=0;C<o.length;C++){let y=o[C],I=y.length/2;if(I<3){g+=I;continue}let T=a?e[C]:null,v=Jd(o,C),_=ol(y)>0===v;for(let P=0;P<I;P++){let E=_?(I-P)%I:P,L=_?(I-P-1+I)%I:(P+1)%I,V=y[E*2],B=y[E*2+1],U=y[L*2],H=y[L*2+1],N=M(H-B),k=-M(U-V),Y=M(Math.sqrt(S(A(N,N),A(k,k))));if(Y>1e-9&&(N=M(N/Y),k=M(k/Y)),a){let $=T[E*2],w=T[E*2+1],X=T[L*2],z=T[L*2+1],j=g*12,rt=A(N,u),nt=A(k,u);Yt(f,d,j,S(t,$),S(i,w),S(r,n),rt,nt,u),Yt(f,d,j+1,S(t,X),S(i,z),S(r,n),rt,nt,u),Yt(f,d,j+2,S(t,V),S(i,B),S(r,m),rt,nt,u),Yt(f,d,j+3,S(t,U),S(i,H),S(r,m),rt,nt,u),p[b++]=j,p[b++]=j+2,p[b++]=j+3,p[b++]=j,p[b++]=j+3,p[b++]=j+1,Yt(f,d,j+4,S(t,V),S(i,B),S(r,m),N,k,0),Yt(f,d,j+5,S(t,U),S(i,H),S(r,m),N,k,0),Yt(f,d,j+6,S(t,V),S(i,B),M(r-m),N,k,0),Yt(f,d,j+7,S(t,U),S(i,H),M(r-m),N,k,0),p[b++]=j+4,p[b++]=j+6,p[b++]=j+7,p[b++]=j+4,p[b++]=j+7,p[b++]=j+5,Yt(f,d,j+8,S(t,V),S(i,B),M(r-m),rt,nt,-u),Yt(f,d,j+9,S(t,U),S(i,H),M(r-m),rt,nt,-u),Yt(f,d,j+10,S(t,$),S(i,w),M(r-n),rt,nt,-u),Yt(f,d,j+11,S(t,X),S(i,z),M(r-n),rt,nt,-u),p[b++]=j+8,p[b++]=j+10,p[b++]=j+11,p[b++]=j+8,p[b++]=j+11,p[b++]=j+9}else{let $=g*4;Yt(f,d,$,S(t,V),S(i,B),S(r,n),N,k,0),Yt(f,d,$+1,S(t,U),S(i,H),S(r,n),N,k,0),Yt(f,d,$+2,S(t,V),S(i,B),M(r-n),N,k,0),Yt(f,d,$+3,S(t,U),S(i,H),M(r-n),N,k,0),p[b++]=$,p[b++]=$+2,p[b++]=$+3,p[b++]=$,p[b++]=$+3,p[b++]=$+1}g++}}return{verts:f,normals:d,indices:p,uv:null}}function ep(o){let e=o[0],t=o[1],i=o[2],r=o[3],n=o[4],s=Math.round(o[5]),a=[],m=6;for(let d=0;d<s;d++){let p=Math.round(o[m++]),b=new Float32Array(p*2);for(let g=0;g<p*2&&m<o.length;g++)b[g]=o[m++];a.push(b)}let u=A(e,.5);if(n<=0){let d=qu(a,t,i,S(r,u),M(r-u)),p=Zu(a,null,t,i,r,u,0);return Xi([d,p])}let l=Math.min(n,A(u,.9)),h=a.map(d=>tp(d,l,4)),c=qu(h,t,i,S(r,u),M(r-u)),f=Zu(a,h,t,i,r,u,l);return Xi([c,f])}function al(o,e,t,i){let r=i[0],n=Sd(t);switch(o){case id:{let s=_t(e,Te,3),a=Math.max(2,Math.round(s*.5));return _d(r[0],r[1],r[2],r[3],s,a,n)}case rd:return Ld(r[0],r[1],r[2],r[3],r[4],r[5],r[6],_t(e,Te,3));case nd:return wd(r[0],r[1],r[2],r[3],r[4],_t(e,Te,3));case sd:return Dd(r[0],r[1],r[2],r[3],r[4],r[5],n);case od:return Nd(r[0],r[1],r[2],r[3],r[4],r[5],r[6],_t(e,Pd,1));case ad:{let s=_t(e,Te,3),a=Math.max(2,Math.round(s/3));return Vd(r[0],r[1],r[2],r[3],r[4],s,a)}case md:{let s=_t(e,Te,3),a=Math.max(2,Math.round(s/3));return Wd(r[0],r[1],r[2],r[3],r[4],s,a)}case ud:return ju(r,!1,e,t);case ld:return ju(r,!0,e,t);case hd:return qd(r,_t(e,el,3),t);case Cd:return ep(r);case Td:return sl(r,i.length>1?i[1]:new Float32Array(0),i.length>2?i[2]:new Float32Array(0),i.length>3?i[3]:null,i.length>4?i[4]:null);case Od:return Zd(r[0],r[1],r[2],r[3],r.length>4?r[4]:0,r.length>5?r[5]:0,r.length>6?r[6]:0,_t(e,12,3));case cd:{let s=r[0],a=r[1],m=_t(e,Te,3),u=Math.abs(s)>1e-6?Math.abs(a/s):.5,l=Math.max(3,Math.round(m*u));return Rd(s,a,r[2],r[3],r[4],m,l,n)}case dd:return Bd(r[0],r[1],r[2],r[3],r[4],n);case pd:return Gd(r[0],r[1],r[2],r[3],r[4],_t(e,Te,3));case fd:return Yd(r[0],r[1],r[2],r[3],r[4],r[5],r[6],_t(e,Te,1));case gd:return Xd(r[0],r[1],r[2],r[3],r[4],r[5],r[6],_t(e,Te,1));case bd:return $d(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],_t(e,Te,1));case yd:return zd(r[0],r[1],r[2],r[3],r[4],r[5],r[6],_t(e,6,1));case Id:return jd(r[0],r[1],r[2],r[3],r[4],r[5],_t(e,48,8));case vd:return Ud(i.length>1?i[1]:new Float32Array(0),r.length>0?r[0]:0,r.length>1?r[1]:0,r.length>2?r[2]:0,_t(e,Te,3));case xd:return Hd(r[0],r.length>1?r[1]:0,r.length>2?r[2]:0,r.length>3?r[3]:0,Math.max(0,Math.min(4,e>0?Math.round(e):2)));default:throw new Error(`MeshPrimitive: unknown type ${o}`)}}var sp=6e5,op=3*2e5,ml=32,ap=8,mp=2e5;function vr(o,e){o.writeInt(e.length);for(let t of e)o.writeInt(t)}function ul(o,e){if(e===null)o.writeInt(0);else{o.writeInt(e.length);for(let t of e)o.writeFloat(t)}}function Tr(o,e,t){let i=o.readInt();if(i<0||i>e)throw new Error(`${t}: bad length ${i}`);let r=new Int32Array(i);for(let n=0;n<i;n++)r[n]=o.readInt();return r}function Or(o){let e=new Float32Array(o.length);for(let t=0;t<o.length;t++)e[t]=Et(o[t])?0:F(o[t]);return e}function xr(o,e,t){for(let i=0;i<e.length;i++){let r=e[i];t[i]=Et(r)?o.getFloat(x(r)):F(r)}}function Ar(o,e,t){for(let i of e)Et(i)&&o.listensTo(x(i),t)}var Un=class o extends Z{constructor(t,i,r,n,s){super();this.mId=t;this.mIndices=i;this.mVerts=r;this.mNormals=n;this.mUv=s}static{this.OP_CODE=110}paint(t){ge(t)&&t.defineMesh3D(this.mId,this.mIndices,this.mVerts,this.mNormals,this.mUv)}write(t){t.start(o.OP_CODE),t.writeInt(this.mId),t.writeInt(this.mIndices.length);for(let i of this.mIndices)t.writeInt(i);t.writeInt(this.mVerts.length);for(let i of this.mVerts)t.writeFloat(i);ul(t,this.mNormals),ul(t,this.mUv)}deepToString(t){return`${t}DefineMesh3D(id=${this.mId}, tris=${this.mIndices.length/3}, verts=${this.mVerts.length/3}, normals=${this.mNormals!==null})`}static read(t,i){let r=t.readInt(),n=t.readInt();if(n<0||n>sp||n%3!==0)throw new Error(`DefineMesh3D: bad indices length ${n}`);let s=new Int32Array(n);for(let f=0;f<n;f++)s[f]=t.readInt();let a=t.readInt();if(a<0||a>op||a%3!==0)throw new Error(`DefineMesh3D: bad verts length ${a}`);let m=new Float32Array(a);for(let f=0;f<a;f++)m[f]=t.readFloat();let u=t.readInt(),l=null;if(u!==0){if(u!==a)throw new Error(`DefineMesh3D: normals length ${u} != verts ${a}`);l=new Float32Array(u);for(let f=0;f<u;f++)l[f]=t.readFloat()}let h=t.readInt(),c=null;if(h!==0){if(h!==a/3*2)throw new Error(`DefineMesh3D: uv length ${h} != 2/3 verts ${a}`);c=new Float32Array(h);for(let f=0;f<h;f++)c[f]=t.readFloat()}i.push(new o(r,s,m,l,c))}},Gn=class o extends Z{constructor(t,i,r){super();this.mProjection=t;this.mProjParams=i;this.mViewParams=r;this.mOutProj=Or(i),this.mOutView=Or(r)}static{this.OP_CODE=111}updateVariables(t){xr(t,this.mProjParams,this.mOutProj),xr(t,this.mViewParams,this.mOutView)}registerListening(t){Ar(t,this.mProjParams,this),Ar(t,this.mViewParams,this)}paint(t){ge(t)&&t.setCamera3D(this.mProjection,this.mOutProj,this.mOutView)}write(t){t.start(o.OP_CODE),t.writeInt(this.mProjection),vr(t,this.mProjParams),vr(t,this.mViewParams)}deepToString(t){return`${t}SetCamera3D(proj=${this.mProjection})`}static read(t,i){let r=t.readInt(),n=Tr(t,16,"SetCamera3D projParams"),s=Tr(t,16,"SetCamera3D viewParams");i.push(new o(r,n,s))}},Yn=class o extends Z{constructor(t,i){super();this.mSub=t;this.mArgs=i;this.mOut=Or(i)}static{this.OP_CODE=112}updateVariables(t){xr(t,this.mArgs,this.mOut)}registerListening(t){Ar(t,this.mArgs,this)}paint(t){ge(t)&&t.matrix3Op(this.mSub,this.mOut)}write(t){t.start(o.OP_CODE),t.writeInt(this.mSub),vr(t,this.mArgs)}deepToString(t){return`${t}Matrix3DOp(sub=${this.mSub}, args=${this.mOut.length})`}static read(t,i){let r=t.readInt(),n=Tr(t,16,"Matrix3DOp args");i.push(new o(r,n))}},Xn=class o extends Z{constructor(t,i){super();this.mMeshId=t;this.mMode=i}static{this.OP_CODE=113}paint(t){ge(t)&&t.drawMesh3D(this.mMeshId,this.mMode)}write(t){t.start(o.OP_CODE),t.writeInt(this.mMeshId),t.writeInt(this.mMode)}deepToString(t){return`${t}DrawMesh3D(mesh=${this.mMeshId}, mode=${this.mMode})`}static read(t,i){i.push(new o(t.readInt(),t.readInt()))}},$n=class o extends Z{constructor(t,i){super();this.mSub=t;this.mParams=i;this.mOut=Or(i)}static{this.OP_CODE=114}updateVariables(t){xr(t,this.mParams,this.mOut)}registerListening(t){Ar(t,this.mParams,this)}paint(t){if(ge(t))switch(this.mSub){case 0:t.clearDepth3D();break;case 1:this.mOut.length>=2&&t.setMaterial3D(this.mOut[0],this.mOut[1]);break;case 2:this.mOut.length>=2&&t.setDepthBias3D(this.mOut[0],this.mOut[1]);break;default:break}}write(t){t.start(o.OP_CODE),t.writeInt(this.mSub),vr(t,this.mParams)}deepToString(t){return`${t}Paint3DState(sub=${this.mSub})`}static read(t,i){let r=t.readInt(),n=Tr(t,8,"Paint3DState params");i.push(new o(r,n))}},zn=class o extends Z{constructor(t,i,r){super();this.mTypes=t;this.mColors=i;this.mParams=r;this.mOut=Or(r)}static{this.OP_CODE=115}updateVariables(t){xr(t,this.mParams,this.mOut)}registerListening(t){Ar(t,this.mParams,this)}paint(t){ge(t)&&t.setLights3D(this.mTypes,this.mColors,this.mOut)}write(t){t.start(o.OP_CODE),t.writeInt(this.mTypes.length);for(let i=0;i<this.mTypes.length;i++)t.writeInt(this.mTypes[i]),t.writeInt(this.mColors[i]);vr(t,this.mParams)}deepToString(t){return`${t}SetLights3D(n=${this.mTypes.length})`}static read(t,i){let r=t.readInt();if(r<0||r>ml)throw new Error(`SetLights3D: bad light count ${r}`);let n=new Int32Array(r),s=new Int32Array(r);for(let m=0;m<r;m++)n[m]=t.readInt(),s[m]=t.readInt();let a=Tr(t,ml*4,"SetLights3D params");i.push(new o(n,s,a))}},jn=class o extends Z{constructor(t){super();this.mBitmapId=t}static{this.OP_CODE=118}paint(t){ge(t)&&t.setTexture3D(this.mBitmapId)}write(t){t.start(o.OP_CODE),t.writeInt(this.mBitmapId)}deepToString(t){return`${t}SetTexture3D(bitmap=${this.mBitmapId})`}static read(t,i){i.push(new o(t.readInt()))}},Kn=class o extends Z{constructor(t,i,r,n,s){super();this.mId=t;this.mType=i;this.mSegments=r;this.mFlags=n;this.mData=s;this.mMesh=null;this.mFailed=!1;this.mOutSegments=Et(r)?0:F(r),this.mOutData=s.map(a=>Or(a))}static{this.OP_CODE=120}updateVariables(t){this.mOutSegments=Et(this.mSegments)?t.getFloat(x(this.mSegments)):F(this.mSegments);for(let i=0;i<this.mData.length;i++)xr(t,this.mData[i],this.mOutData[i]);this.mMesh=null,this.mFailed=!1}registerListening(t){Et(this.mSegments)&&t.listensTo(x(this.mSegments),this);for(let i of this.mData)Ar(t,i,this)}paint(t){if(!ge(t)||this.mFailed)return;if(this.mMesh===null)try{this.mMesh=al(this.mType,this.mOutSegments,this.mFlags,this.mOutData)}catch(r){this.mFailed=!0,console.warn(`MeshPrimitive(id=${this.mId}): ${r.message}`);return}let i=this.mMesh;t.defineMesh3D(this.mId,i.indices,i.verts,i.normals,i.uv)}write(t){t.start(o.OP_CODE),t.writeInt(this.mId),t.writeInt(this.mType),t.writeInt(this.mSegments),t.writeInt(this.mFlags),t.writeInt(this.mData.length);for(let i of this.mData)vr(t,i)}deepToString(t){return`${t}MeshPrimitive(id=${this.mId}, type=${this.mType}, segments=${this.mOutSegments}, channels=${this.mData.length})`}static read(t,i){let r=t.readInt(),n=t.readInt(),s=t.readInt(),a=t.readInt(),m=t.readInt();if(m<0||m>ap)throw new Error(`MeshPrimitive: bad channel count ${m}`);let u=[];for(let l=0;l<m;l++)u.push(Tr(t,mp,"MeshPrimitive channel"));i.push(new o(r,n,s,a,u))}};var tm=1,em=2,im=3,up=1,lp=4096,hp=8,ll=1024,cp=3<<20,dp=2<<20;function pp(o){return O(o)?(x(o)&cp)===dp:!1}function qo(o){return O(o)?!jt.isMathOperatorBits(o)&&!pp(o):!1}function qn(o,e,t){return Math.fround(o+Math.fround(Math.fround(e-o)*t))}var Zn=class o extends Z{constructor(t,i,r,n,s,a,m){super();this.mId=t;this.mType=i;this.mFlags=r;this.mParams=n;this.mPos=s;this.mNormal=a;this.mUv=m;this.mEval=new jt;this.mVerts=new Float32Array(0);this.mNormalsBuf=new Float32Array(0);this.mUvBuf=new Float32Array(0);this.mIndices=new Int32Array(0);this.mGridU=-1;this.mGridV=-1;this.mLastA=0;this.mLastB=0;this.mOutParams=n.slice(),this.mOutParamsF=new Float32Array(this.mOutParams.buffer,this.mOutParams.byteOffset,this.mOutParams.length),this.mOutPos=s.map(u=>u.slice()),this.mOutNormal=a.map(u=>u.slice()),this.mOutUv=m.map(u=>u.slice())}static{this.OP_CODE=117}updateVariables(t){for(let i=0;i<this.mParams.length;i++){let r=this.mParams[i];this.mOutParams[i]=qo(r)?et(t.getFloat(x(r))):r}o.resolveGroup(t,this.mPos,this.mOutPos),o.resolveGroup(t,this.mNormal,this.mOutNormal),o.resolveGroup(t,this.mUv,this.mOutUv)}static resolveGroup(t,i,r){for(let n=0;n<i.length;n++){let s=i[n],a=r[n];for(let m=0;m<s.length;m++){let u=s[m];a[m]=qo(u)?et(t.getFloat(x(u))):u}}}registerListening(t){for(let i of this.mParams)qo(i)&&t.listensTo(x(i),this);this.listenGroup(t,this.mPos),this.listenGroup(t,this.mNormal),this.listenGroup(t,this.mUv)}listenGroup(t,i){for(let r of i)for(let n of r)qo(n)&&t.listensTo(x(n),this)}paint(t){if(!ge(t))return;let i=t.getContext().getCollectionsAccess(),r=this.gridCount(0),n=this.gridCount(1);if(r<2||n<2||r>ll||n>ll)return;this.ensureBuffers(r,n);let s=this.mOutUv.length>=2;for(let a=0;a<r;a++){let m=Math.fround(a/(r-1));for(let u=0;u<n;u++){let l=Math.fround(u/(n-1)),h=a*n+u;this.position(h*3,m,l,i),s?(this.mUvBuf[h*2]=this.eval(this.mOutUv[0],this.mLastA,this.mLastB,i),this.mUvBuf[h*2+1]=this.eval(this.mOutUv[1],this.mLastA,this.mLastB,i)):(this.mUvBuf[h*2]=m,this.mUvBuf[h*2+1]=l)}}if(this.mOutNormal.length>=3)for(let a=0;a<r;a++){let m=Math.fround(a/(r-1));for(let u=0;u<n;u++){let l=Math.fround(u/(n-1)),h=(a*n+u)*3;this.paramsFor(m,l),this.mNormalsBuf[h]=this.eval(this.mOutNormal[0],this.mLastA,this.mLastB,i),this.mNormalsBuf[h+1]=this.eval(this.mOutNormal[1],this.mLastA,this.mLastB,i),this.mNormalsBuf[h+2]=this.eval(this.mOutNormal[2],this.mLastA,this.mLastB,i)}}else this.computeFiniteDifferenceNormals(r,n);t.defineMesh3D(this.mId,this.mIndices,this.mVerts,this.mNormalsBuf,this.mUvBuf)}gridCount(t){switch(this.mType){case tm:return Math.trunc(this.mOutParamsF[t===0?2:5]);case em:return Math.trunc(this.mOutParamsF[t===0?1:2]);case im:return Math.trunc(this.mOutParamsF[t===0?2:3]);default:return Math.trunc(this.mOutParamsF[t===0?2:5])}}paramsFor(t,i){let r=this.mOutParamsF;switch(this.mType){case tm:this.mLastA=qn(r[0],r[1],t),this.mLastB=qn(r[3],r[4],i);break;case em:this.mLastA=Math.fround(t*Math.fround(2*Math.PI)),this.mLastB=Math.fround(i*Math.fround(Math.PI));break;case im:this.mLastA=Math.fround(t*Math.fround(2*Math.PI)),this.mLastB=qn(Math.fround(-r[1]*.5),Math.fround(r[1]*.5),i);break;default:this.mLastA=qn(r[0],r[1],t),this.mLastB=qn(r[3],r[4],i);break}}position(t,i,r,n){this.paramsFor(i,r);let s=this.mLastA,a=this.mLastB;switch(this.mType){case tm:{let m=this.eval(this.mOutPos[0],s,a,n),u=this.mOutParamsF[6],l=this.mOutParamsF[7];m<u&&(m=u),m>l&&(m=l),this.mVerts[t]=s,this.mVerts[t+1]=m,this.mVerts[t+2]=a;break}case em:{let m=Math.fround(this.mOutParamsF[0]+this.eval(this.mOutPos[0],s,a,n)),u=Math.fround(Math.sin(a));this.mVerts[t]=Math.fround(Math.fround(m*u)*Math.fround(Math.cos(s))),this.mVerts[t+1]=Math.fround(m*Math.fround(Math.cos(a))),this.mVerts[t+2]=Math.fround(Math.fround(m*u)*Math.fround(Math.sin(s)));break}case im:{let m=Math.fround(this.mOutParamsF[0]+this.eval(this.mOutPos[0],s,a,n));this.mVerts[t]=Math.fround(m*Math.fround(Math.cos(s))),this.mVerts[t+1]=a,this.mVerts[t+2]=Math.fround(m*Math.fround(Math.sin(s)));break}default:{this.mVerts[t]=this.eval(this.mOutPos[0],s,a,n),this.mVerts[t+1]=this.eval(this.mOutPos[1],s,a,n),this.mVerts[t+2]=this.eval(this.mOutPos[2],s,a,n);break}}}computeFiniteDifferenceNormals(t,i){let r=Math.fround,n=this.mVerts;for(let s=0;s<t;s++){let a=Math.min(s+1,t-1),m=Math.max(s-1,0);for(let u=0;u<i;u++){let l=Math.min(u+1,i-1),h=Math.max(u-1,0),c=(a*i+u)*3,f=(m*i+u)*3,d=(s*i+l)*3,p=(s*i+h)*3,b=r(n[c]-n[f]),g=r(n[c+1]-n[f+1]),C=r(n[c+2]-n[f+2]),y=r(n[d]-n[p]),I=r(n[d+1]-n[p+1]),T=r(n[d+2]-n[p+2]),v=r(r(g*T)-r(C*I)),_=r(r(C*y)-r(b*T)),P=r(r(b*I)-r(g*y)),E=r(Math.sqrt(r(r(r(v*v)+r(_*_))+r(P*P)))),L=(s*i+u)*3;E>1e-8?(this.mNormalsBuf[L]=r(v/E),this.mNormalsBuf[L+1]=r(_/E),this.mNormalsBuf[L+2]=r(P/E)):(this.mNormalsBuf[L]=0,this.mNormalsBuf[L+1]=1,this.mNormalsBuf[L+2]=0)}}}eval(t,i,r,n){return n?this.mEval.eval(n,t,t.length,i,r):this.mEval.eval(t,t.length,i,r)}ensureBuffers(t,i){let r=t*i;this.mVerts.length!==r*3&&(this.mVerts=new Float32Array(r*3),this.mNormalsBuf=new Float32Array(r*3),this.mUvBuf=new Float32Array(r*2)),(this.mGridU!==t||this.mGridV!==i)&&(this.buildIndices(t,i),this.mGridU=t,this.mGridV=i)}buildIndices(t,i){this.mIndices=new Int32Array((t-1)*(i-1)*6);let r=(this.mFlags&up)!==0,n=0;for(let s=0;s<t-1;s++)for(let a=0;a<i-1;a++){let m=s*i+a,u=s*i+(a+1),l=(s+1)*i+(a+1),h=(s+1)*i+a;r?(this.mIndices[n++]=m,this.mIndices[n++]=l,this.mIndices[n++]=u,this.mIndices[n++]=l,this.mIndices[n++]=m,this.mIndices[n++]=h):(this.mIndices[n++]=m,this.mIndices[n++]=u,this.mIndices[n++]=l,this.mIndices[n++]=l,this.mIndices[n++]=h,this.mIndices[n++]=m)}}write(t){t.start(o.OP_CODE),t.writeInt(this.mId),t.writeInt(this.mType),t.writeInt(this.mFlags),hl(t,this.mParams),rm(t,this.mPos),rm(t,this.mNormal),rm(t,this.mUv)}deepToString(t){return`${t}MeshExpression(id=${this.mId}, type=${this.mType}, params=${this.mParams.length}, pos=${this.mPos.length})`}static read(t,i){let r=t.readInt(),n=t.readInt(),s=t.readInt(),a=cl(t),m=nm(t),u=nm(t),l=nm(t);i.push(new o(r,n,s,a,m,u,l))}};function hl(o,e){o.writeInt(e.length);for(let t of e)o.writeInt(t)}function rm(o,e){o.writeInt(e.length);for(let t of e)hl(o,t)}function cl(o){let e=o.readInt();if(e<0||e>lp)throw new Error(`MeshExpression: bad array length ${e}`);let t=new Int32Array(e);for(let i=0;i<e;i++)t[i]=o.readNanIdBits();return t}function nm(o){let e=o.readInt();if(e<0||e>hp)throw new Error(`MeshExpression: bad group count ${e}`);let t=[];for(let i=0;i<e;i++)t.push(cl(o));return t}var mi=Math.fround;function Rt(o,e){return mi(o*e)}function Xe(o,e){return mi(o+e)}var gt=3211264,fp=gt+1,gp=gt+2,bp=gt+3,yp=gt+4,Ip=gt+5,Cp=gt+6,vp=gt+7,Tp=gt+8,Op=gt+9,xp=gt+10,Ap=gt+14,Ep=gt+17,Mp=gt+18,Fp=gt+19,Sp=gt+31,Pp=gt+45,_p=gt+52,Rp=gt+55,Bp=gt+73,pl=gt+100,Dp=gt+101,wp=gt+102,Lp=gt+103,Np=gt+104,dl=gt+105,Vp=gt+106,fl=gt+107,ce=4,sm=64,om=512,Zo=1e-6,AC=new DataView(new ArrayBuffer(4));function gl(o){if(!O(o))return!1;let e=x(o);return e>=pl&&e<=fl}var Jo=class{constructor(){this.mProgram=new Int32Array(om);this.mStack=new Float32Array(sm*ce);this.mDim=new Int32Array(sm);this.mSoftDomain=!1}apply(e,t,i){if(t>om)throw new Error(`VectorRpn: program length ${t} exceeds ${om}`);if(e instanceof Int32Array)this.mProgram.set(e.subarray(0,t),0);else for(let a=0;a<t;a++)this.mProgram[a]=et(e[a]);let r=this.mStack,n=-1;for(let a=0;a<t;a++){let m=this.mProgram[a];if(O(m))n=this.opEval(n,x(m));else{let u=F(m);if(n++,n>=sm)throw new Error("VectorRpn: stack overflow (malformed program)");let l=n*ce;r[l]=u,r[l+1]=u,r[l+2]=u,r[l+3]=u,this.mDim[n]=1}}if(n<0)throw new Error("VectorRpn: empty program");let s=n*ce;return i[0]=r[s],i[1]=r[s+1],i[2]=r[s+2],i[3]=r[s+3],this.mDim[n]}opEval(e,t){let i=this.mStack,r=this.mDim,n=(e-1)*ce,s=e*ce;switch(t){case fp:return i[n]+=i[s],i[n+1]+=i[s+1],i[n+2]+=i[s+2],i[n+3]+=i[s+3],r[e-1]=Math.max(r[e-1],r[e]),e-1;case gp:return i[n]-=i[s],i[n+1]-=i[s+1],i[n+2]-=i[s+2],i[n+3]-=i[s+3],r[e-1]=Math.max(r[e-1],r[e]),e-1;case bp:return i[n]*=i[s],i[n+1]*=i[s+1],i[n+2]*=i[s+2],i[n+3]*=i[s+3],r[e-1]=Math.max(r[e-1],r[e]),e-1;case yp:return i[n]/=this.softDenom(i[s]),i[n+1]/=this.softDenom(i[s+1]),i[n+2]/=this.softDenom(i[s+2]),i[n+3]/=this.softDenom(i[s+3]),r[e-1]=Math.max(r[e-1],r[e]),e-1;case Ip:return i[n]%=this.softDenom(i[s]),i[n+1]%=this.softDenom(i[s+1]),i[n+2]%=this.softDenom(i[s+2]),i[n+3]%=this.softDenom(i[s+3]),r[e-1]=Math.max(r[e-1],r[e]),e-1;case Cp:return i[n]=Math.min(i[n],i[s]),i[n+1]=Math.min(i[n+1],i[s+1]),i[n+2]=Math.min(i[n+2],i[s+2]),i[n+3]=Math.min(i[n+3],i[s+3]),r[e-1]=Math.max(r[e-1],r[e]),e-1;case vp:return i[n]=Math.max(i[n],i[s]),i[n+1]=Math.max(i[n+1],i[s+1]),i[n+2]=Math.max(i[n+2],i[s+2]),i[n+3]=Math.max(i[n+3],i[s+3]),r[e-1]=Math.max(r[e-1],r[e]),e-1;case Tp:return i[n]=Math.pow(i[n],i[s]),i[n+1]=Math.pow(i[n+1],i[s+1]),i[n+2]=Math.pow(i[n+2],i[s+2]),i[n+3]=Math.pow(i[n+3],i[s+3]),r[e-1]=Math.max(r[e-1],r[e]),e-1;case Op:return i[s]=Math.sqrt(i[s]),i[s+1]=Math.sqrt(i[s+1]),i[s+2]=Math.sqrt(i[s+2]),i[s+3]=Math.sqrt(i[s+3]),e;case xp:return i[s]=Math.abs(i[s]),i[s+1]=Math.abs(i[s+1]),i[s+2]=Math.abs(i[s+2]),i[s+3]=Math.abs(i[s+3]),e;case Pp:return i[s]*=i[s],i[s+1]*=i[s+1],i[s+2]*=i[s+2],i[s+3]*=i[s+3],e;case Mp:return i[s]=Math.sin(i[s]),i[s+1]=Math.sin(i[s+1]),i[s+2]=Math.sin(i[s+2]),i[s+3]=Math.sin(i[s+3]),e;case Fp:return i[s]=Math.cos(i[s]),i[s+1]=Math.cos(i[s+1]),i[s+2]=Math.cos(i[s+2]),i[s+3]=Math.cos(i[s+3]),e;case Ap:return i[s]=Math.floor(i[s]),i[s+1]=Math.floor(i[s+1]),i[s+2]=Math.floor(i[s+2]),i[s+3]=Math.floor(i[s+3]),e;case Sp:return i[s]=Math.ceil(i[s]),i[s+1]=Math.ceil(i[s+1]),i[s+2]=Math.ceil(i[s+2]),i[s+3]=Math.ceil(i[s+3]),e;case Ep:return i[s]=Qo(i[s]),i[s+1]=Qo(i[s+1]),i[s+2]=Qo(i[s+2]),i[s+3]=Qo(i[s+3]),e;case Bp:return i[s]=-i[s],i[s+1]=-i[s+1],i[s+2]=-i[s+2],i[s+3]=-i[s+3],e;case _p:return i[s]=1/this.softDenom(i[s]),i[s+1]=1/this.softDenom(i[s+1]),i[s+2]=1/this.softDenom(i[s+2]),i[s+3]=1/this.softDenom(i[s+3]),e;case pl:return this.build(e,2);case Dp:return this.build(e,3);case wp:return this.build(e,4);case Lp:{let a=Xe(Xe(Xe(Rt(i[n],i[s]),Rt(i[n+1],i[s+1])),Rt(i[n+2],i[s+2])),Rt(i[n+3],i[s+3]));return i[n]=a,i[n+1]=a,i[n+2]=a,i[n+3]=a,r[e-1]=1,e-1}case Np:{let a=i[n],m=i[n+1],u=i[n+2],l=i[s],h=i[s+1],c=i[s+2];return i[n]=mi(Rt(m,c)-Rt(u,h)),i[n+1]=mi(Rt(u,l)-Rt(a,c)),i[n+2]=mi(Rt(a,h)-Rt(m,l)),i[n+3]=0,r[e-1]=3,e-1}case dl:case Vp:{let a=Xe(Xe(Xe(Rt(i[s],i[s]),Rt(i[s+1],i[s+1])),Rt(i[s+2],i[s+2])),Rt(i[s+3],i[s+3])),m=t===dl?mi(Math.sqrt(a)):a;return i[s]=m,i[s+1]=m,i[s+2]=m,i[s+3]=m,r[e]=1,e}case fl:{let a=Xe(Xe(Xe(Rt(i[s],i[s]),Rt(i[s+1],i[s+1])),Rt(i[s+2],i[s+2])),Rt(i[s+3],i[s+3])),m=mi(1/this.softDenom(mi(Math.sqrt(a))));return i[s]*=m,i[s+1]*=m,i[s+2]*=m,i[s+3]*=m,e}case Rp:return e;default:throw new Error(`VectorRpn op not implemented: ${t-gt}`)}}build(e,t){let i=this.mStack,r=e-t+1,n=i[r*ce],s=t>1?i[(r+1)*ce]:0,a=t>2?i[(r+2)*ce]:0,m=t>3?i[(r+3)*ce]:0,u=r*ce;return i[u]=n,i[u+1]=s,i[u+2]=a,i[u+3]=m,this.mDim[r]=t,r}softDenom(e){return this.mSoftDomain&&e<Zo&&e>-Zo?e<0?-Zo:Zo:e}};function Qo(o){if(Number.isNaN(o))return 0;let e=Math.floor(o+.5);return e>=2147483647?2147483647:e<=-2147483648?-2147483648:e}var Wp=3<<20,kp=2<<20;function bl(o){if(!O(o))return!1;let e=(x(o)&Wp)===kp;return!jt.isMathOperatorBits(o)&&!gl(o)&&!e}var Qn=class o extends D{constructor(t,i,r,n){super();this.mId=t;this.mDimension=i;this.mFlags=r;this.mSrcValue=n;this.mRpn=new Jo;this.mOut=new Float32Array(ce);this.mPreCalc=n.slice()}static{this.OP_CODE=116}getDimension(){return this.mDimension}updateVariables(t){for(let i=0;i<this.mSrcValue.length;i++){let r=this.mSrcValue[i];this.mPreCalc[i]=bl(r)?et(t.getFloat(x(r))):r}}registerListening(t){t.putObject(this.mId,this);for(let i of this.mSrcValue)bl(i)&&t.listensTo(x(i),this)}apply(t){let i=this.mRpn.apply(this.mPreCalc,this.mPreCalc.length,this.mOut);if(!this.allFinite(i)){this.mRpn.mSoftDomain=!0;try{i=this.mRpn.apply(this.mPreCalc,this.mPreCalc.length,this.mOut)}finally{this.mRpn.mSoftDomain=!1}}for(let r=0;r<this.mDimension;r++){let n=r<i?this.mOut[r]:0;Number.isFinite(n)||(n=0),t.loadFloat(this.mId+r,n)}}allFinite(t){for(let i=0;i<t;i++)if(!Number.isFinite(this.mOut[i]))return!1;return!0}write(t){t.start(o.OP_CODE),t.writeInt(this.mId),t.writeByte(this.mDimension),t.writeByte(this.mFlags),t.writeShort(this.mSrcValue.length);for(let i of this.mSrcValue)t.writeFloat(i)}deepToString(t){return`${t}VectorExpression[${this.mId}] dim=${this.mDimension}`}static read(t,i){let r=t.declareId(),n=t.readByte(),s=t.readByte(),a=t.readShort(),m=new Int32Array(a);for(let u=0;u<a;u++)m[u]=t.readNanIdBits();i.push(new o(r,n,s,m))}};var Jn=class o extends D{static{this.OP_CODE=134}static{this.COLOR_COLOR_INTERPOLATE=0}static{this.ID_COLOR_INTERPOLATE=1}static{this.COLOR_ID_INTERPOLATE=2}static{this.ID_ID_INTERPOLATE=3}static{this.HSV_MODE=4}static{this.ARGB_MODE=5}static{this.IDARGB_MODE=6}constructor(e,t,i,r,n){super(),this.mId=e,this.mMode=t&255,this.mAlpha=t>>16&255;let s=a=>O(a)?0:F(a);this.mColor1=i,this.mColor2=r,this.mTweenBits=n,this.mOutColor1=i,this.mOutColor2=r,this.mOutTween=s(n),this.mHueBits=0,this.mSatBits=0,this.mValueBits=0,this.mOutHue=0,this.mOutSat=0,this.mOutValue=0,this.mArgbAlphaBits=0,this.mArgbRedBits=0,this.mArgbGreenBits=0,this.mArgbBlueBits=0,this.mOutArgbAlpha=0,this.mOutArgbRed=0,this.mOutArgbGreen=0,this.mOutArgbBlue=0,this.mMode===o.HSV_MODE?(this.mHueBits=i,this.mOutHue=s(i),this.mSatBits=r,this.mOutSat=s(r),this.mValueBits=n,this.mOutValue=s(n)):this.mMode===o.ARGB_MODE?(this.mArgbAlphaBits=et((t>>16)/1024),this.mOutArgbAlpha=(t>>16)/1024,this.mArgbRedBits=i,this.mOutArgbRed=s(i),this.mArgbGreenBits=r,this.mOutArgbGreen=s(r),this.mArgbBlueBits=n,this.mOutArgbBlue=s(n)):this.mMode===o.IDARGB_MODE&&(this.mArgbAlphaBits=t>>16|4286578688|0,this.mOutArgbAlpha=s(this.mArgbAlphaBits),this.mArgbRedBits=i,this.mOutArgbRed=s(i),this.mArgbGreenBits=r,this.mOutArgbGreen=s(r),this.mArgbBlueBits=n,this.mOutArgbBlue=s(n))}write(e){}registerListening(e){O(this.mTweenBits)&&e.listensTo(x(this.mTweenBits),this),this.mMode===o.HSV_MODE&&(O(this.mHueBits)&&e.listensTo(x(this.mHueBits),this),O(this.mSatBits)&&e.listensTo(x(this.mSatBits),this),O(this.mValueBits)&&e.listensTo(x(this.mValueBits),this)),(this.mMode===o.ARGB_MODE||this.mMode===o.IDARGB_MODE)&&(O(this.mArgbAlphaBits)&&e.listensTo(x(this.mArgbAlphaBits),this),O(this.mArgbRedBits)&&e.listensTo(x(this.mArgbRedBits),this),O(this.mArgbGreenBits)&&e.listensTo(x(this.mArgbGreenBits),this),O(this.mArgbBlueBits)&&e.listensTo(x(this.mArgbBlueBits),this))}apply(e){if(this.updateVariables(e),this.mMode===o.HSV_MODE){e.loadColor(this.mId,this.mAlpha<<24|16777215&Xm(this.mOutHue,this.mOutSat,this.mOutValue)|0);return}if(this.mMode===o.ARGB_MODE||this.mMode===o.IDARGB_MODE){e.loadColor(this.mId,$m(this.mOutArgbAlpha,this.mOutArgbRed,this.mOutArgbGreen,this.mOutArgbBlue));return}this.mOutTween===0?((this.mMode&1)===1&&(this.mOutColor1=e.getColor(this.mColor1)),e.loadColor(this.mId,this.mOutColor1)):((this.mMode&1)===1&&(this.mOutColor1=e.getColor(this.mColor1)),(this.mMode&2)===2&&(this.mOutColor2=e.getColor(this.mColor2)),e.loadColor(this.mId,bo(this.mOutColor1,this.mOutColor2,this.mOutTween)))}updateVariables(e){this.mMode===o.HSV_MODE&&(O(this.mHueBits)&&(this.mOutHue=e.getFloat(x(this.mHueBits))),O(this.mSatBits)&&(this.mOutSat=e.getFloat(x(this.mSatBits))),O(this.mValueBits)&&(this.mOutValue=e.getFloat(x(this.mValueBits)))),(this.mMode===o.ARGB_MODE||this.mMode===o.IDARGB_MODE)&&(O(this.mArgbAlphaBits)&&(this.mOutArgbAlpha=e.getFloat(x(this.mArgbAlphaBits))),O(this.mArgbRedBits)&&(this.mOutArgbRed=e.getFloat(x(this.mArgbRedBits))),O(this.mArgbGreenBits)&&(this.mOutArgbGreen=e.getFloat(x(this.mArgbGreenBits))),O(this.mArgbBlueBits)&&(this.mOutArgbBlue=e.getFloat(x(this.mArgbBlueBits)))),O(this.mTweenBits)&&(this.mOutTween=e.getFloat(x(this.mTweenBits))),(this.mMode&1)===1&&(this.mOutColor1=e.getColor(this.mColor1)),(this.mMode&2)===2&&(this.mOutColor2=e.getColor(this.mColor2))}deepToString(e){return`${e}ColorExpression(${this.mId}, mode=${this.mMode})`}static read(e,t){let i=e.declareId(),r=e.readInt(),n=e.readInt(),s=e.readInt(),a=e.readInt(),m=e.getRemapContext?.();if(m){let u=r&255,l=h=>m.resolveNanIdBits(h);u===6?(r=m.resolveId(r>>16)<<16|r&65535,n=l(n),s=l(s),a=l(a)):u===5||u===4?(n=l(n),s=l(s),a=l(a)):u<=3&&(u&1&&(n=m.resolveId(n)),u&2&&(s=m.resolveId(s)),a=l(a))}t.push(new o(i,r,n,s,a))}};var $i=class o extends D{constructor(t,i,r){super();this.mPreCalcValues=null;this.mPreMask=0;this.mVar=[0,0,0];this.mId=t,this.mMask=i,this.mValues=r}static{this.OP_CODE=144}static{this.OFFSET=65536}write(t){}isId(t,i,r){return(1<<i&t)!==0&&r<o.OFFSET}registerListening(t){for(let i=0;i<this.mValues.length;i++)this.isId(this.mMask,i,this.mValues[i])&&t.listensTo(this.mValues[i],this)}updateVariables(t){(!this.mPreCalcValues||this.mPreCalcValues.length!==this.mValues.length)&&(this.mPreCalcValues=new Int32Array(this.mValues.length)),this.mPreMask=this.mMask;for(let i=0;i<this.mValues.length;i++)this.isId(this.mMask,i,this.mValues[i])?(this.mPreMask&=~(1<<i),this.mPreCalcValues[i]=t.getInteger(this.mValues[i])):this.mPreCalcValues[i]=this.mValues[i]}apply(t){this.updateVariables(t);let i=this.mPreCalcValues||this.mValues,r=this.evaluate(this.mPreMask,i);t.loadInteger(this.mId,r)}evaluateNow(t){return this.updateVariables(t),this.evaluate(this.mPreMask,this.mPreCalcValues||this.mValues)}getId(){return this.mId}evaluate(t,i){let r=new Int32Array(128),n=-1,s=o.OFFSET;for(let a=0;a<i.length;a++){let m=i[a];if((1<<a&t)!==0&&this.mValues[a]>=s)switch(this.mValues[a]-s){case 1:r[n-1]=r[n-1]+r[n]|0,n--;break;case 2:r[n-1]=r[n-1]-r[n]|0,n--;break;case 3:r[n-1]=Math.imul(r[n-1],r[n]),n--;break;case 4:r[n-1]=r[n]!==0?r[n-1]/r[n]|0:0,n--;break;case 5:r[n-1]=r[n-1]%r[n]|0,n--;break;case 6:r[n-1]=r[n-1]<<r[n],n--;break;case 7:r[n-1]=r[n-1]>>r[n],n--;break;case 8:r[n-1]=r[n-1]>>>r[n],n--;break;case 9:r[n-1]=r[n-1]|r[n],n--;break;case 10:r[n-1]=r[n-1]&r[n],n--;break;case 11:r[n-1]=r[n-1]^r[n],n--;break;case 12:r[n-1]=(r[n-1]^r[n]>>31)-(r[n]>>31),n--;break;case 13:r[n-1]=Math.min(r[n-1],r[n]),n--;break;case 14:r[n-1]=Math.max(r[n-1],r[n]),n--;break;case 15:r[n]=-r[n];break;case 16:r[n]=Math.abs(r[n]);break;case 17:r[n]=r[n]+1|0;break;case 18:r[n]=r[n]-1|0;break;case 19:r[n]=~r[n];break;case 20:r[n]=r[n]>>31|-r[n]>>>31;break;case 21:r[n-2]=Math.min(Math.max(r[n-2],r[n]),r[n-1]),n-=2;break;case 22:r[n-2]=r[n]>0?r[n-1]:r[n-2],n-=2;break;case 23:r[n-2]=r[n]+Math.imul(r[n-1],r[n-2])|0,n-=2;break;case 24:r[++n]=this.mVar[0];break;case 25:r[++n]=this.mVar[1];break;case 26:r[++n]=this.mVar[2];break;default:break}else r[++n]=m}return n>=0?r[n]:0}deepToString(t){return`${t}IntegerExpression(${this.mId})`}static read(t,i){let r=t.declareId(),n=t.readInt(),s=t.readInt(),a=new Int32Array(s),m=t.getRemapContext?.();for(let u=0;u<s;u++){let l=t.readInt(),h=(1<<u&n)!==0&&l<o.OFFSET;a[u]=h&&m?m.resolveId(l):l}i.push(new o(r,n,a))}};var $e=class o extends D{static{this.OP_CODE=140}constructor(e,t){super(),this.mId=e,this.mValue=t}update(e){this.mValue=e.mValue}write(e){}apply(e){e.loadInteger(this.mId,this.mValue)}deepToString(e){return`${e}IntegerConstant(${this.mId}, ${this.mValue})`}static read(e,t){t.push(new o(e.readInt(),e.readInt()))}};var zi=class o extends D{static{this.OP_CODE=143}constructor(e,t){super(),this.mId=e,this.mValue=t}write(e){}apply(e){}deepToString(e){return`${e}BooleanConstant(${this.mId}, ${this.mValue})`}static read(e,t){t.push(new o(e.readInt(),e.readBoolean()))}};var ze=class o extends D{static{this.OP_CODE=148}constructor(e,t){super(),this.mId=e,this.mValue=t}update(e){this.mValue=e.mValue}getValue(){return this.mValue}write(e){}apply(e){e.putObject(this.mId,this)}deepToString(e){return`${e}LongConstant(${this.mId})`}static read(e,t){t.push(new o(e.readInt(),e.readLong()))}};var ts=class o extends D{constructor(t,i,r,n,s){super();this.mShaderValid=!1;if(this.mShaderId=t,this.mShaderTextId=i,this.mIntMap=n,this.mBitmapMap=s,r){this.mUniformRawFloatMap=new Map,this.mUniformFloatMap=new Map;for(let[a,m]of r){this.mUniformRawFloatMap.set(a,new Int32Array(m));let u=new Float32Array(m.length);for(let l=0;l<m.length;l++)u[l]=F(m[l]);this.mUniformFloatMap.set(a,u)}}else this.mUniformRawFloatMap=null,this.mUniformFloatMap=null}static{this.OP_CODE=45}getShaderTextId(){return this.mShaderTextId}getUniformFloatNames(){return this.mUniformFloatMap?Array.from(this.mUniformFloatMap.keys()):[]}getUniformFloats(t){return this.mUniformFloatMap?.get(t)??new Float32Array(0)}getUniformIntegerNames(){return this.mIntMap?Array.from(this.mIntMap.keys()):[]}getUniformInts(t){return this.mIntMap?.get(t)??new Int32Array(0)}getUniformBitmapNames(){return this.mBitmapMap?Array.from(this.mBitmapMap.keys()):[]}getUniformBitmapId(t){return this.mBitmapMap?.get(t)??-1}write(t){}registerListening(t){if(this.mUniformRawFloatMap)for(let i of this.mUniformRawFloatMap.values())for(let r=0;r<i.length;r++)O(i[r])&&t.listensTo(x(i[r]),this)}updateVariables(t){if(!(!this.mUniformRawFloatMap||!this.mUniformFloatMap))for(let[i,r]of this.mUniformRawFloatMap){let n=new Float32Array(r.length);for(let s=0;s<r.length;s++){let a=r[s];if(O(a)){let m=t.getCollectionsAccess(),u=m?m.getDynamicFloats(x(a)):null;n[s]=u?F(a):t.getFloat(x(a))}else n[s]=F(a)}this.mUniformFloatMap.set(i,n)}}markDirty(){}enable(t){this.mShaderValid=t}apply(t){this.mShaderValid&&t.loadShader(this.mShaderId,this)}deepToString(t){return`${t}ShaderData(${this.mShaderId})`}static read(t,i){let r=t.declareId(),n=t.readId(),s=t.readInt(),a=s&255,m=s>>8&255,u=s>>16&255,l=null;if(a>0){l=new Map;for(let d=0;d<a;d++){let p=t.readUTF8(),b=t.readInt(),g=new Int32Array(b);for(let C=0;C<b;C++)g[C]=t.readNanIdBits();l.set(p,g)}}let h=null;if(m>0){h=new Map;for(let d=0;d<m;d++){let p=t.readUTF8(),b=t.readInt(),g=new Int32Array(b);for(let C=0;C<b;C++)g[C]=t.readInt();h.set(p,g)}}let c=null;if(u>0){c=new Map;for(let d=0;d<u;d++){let p=t.readUTF8(),b=t.readId();c.set(p,b)}}let f=new o(r,n,l,h,c);f.enable(!0),i.push(f)}};var Hp=Math.fround(.1);function am(o){if(Number.isNaN(o))return"NaN";if(!Number.isFinite(o))return o>0?"Infinity":"-Infinity";if(o===0)return Object.is(o,-0)?"-0.0":"0.0";let e=o<0?"-":"",t=Math.abs(o),i="";for(let a=0;a<9&&(i=t.toExponential(a),Math.fround(Number(i))!==t);a++);let r=i.indexOf("e"),n=i.substring(0,r).replace(".",""),s=Number(i.substring(r+1));return t>=Math.fround(.001)&&t<1e7?s>=0?n.length<=s+1?`${e}${n}${"0".repeat(s+1-n.length)}.0`:`${e}${n.substring(0,s+1)}.${n.substring(s+1)}`:`${e}0.${"0".repeat(-s-1)}${n}`:`${e}${n[0]}.${n.length>1?n.substring(1):"0"}E${s}`}function Up(o){return Number.isNaN(o)?0:Math.fround(Math.max(-2147483648,Math.min(2147483647,Math.floor(o+.5))))}function Gp(o){return Number.isNaN(o)?"0":String(Math.max(-2147483648,Math.min(2147483647,Math.trunc(o))))}function Yp(o){return Number.isNaN(o)?0n:o>=9223372036854776e3?9223372036854775807n:o<=-9223372036854776e3?-9223372036854775808n:BigInt(Math.trunc(o))}function Xp(o,e,t,i){if(i){let s=.5;for(let a=0;a<t;a++)s=Math.fround(s/10);o=Math.fround(o+s)}let r=Yp(o).toString(),n=r==="0"?1:r.length;return r.substring(r.length-Math.min(e,n))}function yl(o,e,t,i,r){for(let m=0;m<e;m++)o=Math.fround(o*10);o=Up(o);for(let m=0;m<e;m++)o=Math.fround(o*Hp);let n=am(o),s=n.substring(2,Math.min(n.length,t+2)),a=s.length;for(let m=s.length-1;m>=r&&s[m]==="0";m--)a--;return s=s.substring(0,a),i!==0&&s.length<t&&(s+=String.fromCharCode(i).repeat(t-s.length)),s}function Il(o,e,t){return o.length<e?t!==0?String.fromCharCode(t).repeat(e-o.length)+o:o:o.substring(o.length-e)}function Cl(o,e,t,i,r){let n=o<0;n&&(o=-o);let s=Il(Gp(o),e,i);if(t===0)return(n?"-":"")+s;let a=yl(o%1,t,t,r,0);return(n?"-":"")+s+"."+a}function vl(o,e,t,i,r,n,s,a){let m=",",u=".";switch(n){case 1:m=".",u=",";break;case 2:m=" ",u=",";break;case 3:m="_",u=".";break}let l=(a&1)!==0,h=(a&2)!==0,c=o<0;c&&(o=-o);let f=Xp(o,e,t,h);if(s!==0){let C=f.length,y=s===2?4:3,I=s===2?4:s===3?2:3;for(let T=C-y;T>0;T-=I)f=f.substring(0,T)+m+f.substring(T)}let d=f.length;f=Il(f,e,i);let p=t;d+t>9&&(p=Math.max(1,9-d)),r===0&&(t=p);let b=C=>c?l?`(${C})`:`-${C}`:C;if(t===0)return b(f);let g=yl(o%1,p,t,r,1);return b(f+u+g)}var $p=1,zp=3;var jp=4,Kp=12;var qp=16,Zp=32,Qp=48;var Jp=64,tf=128,ef=192,rf=256,nf=512,sf=1024,ji=class o extends D{static{this.OP_CODE=135}constructor(e,t,i,r,n){switch(super(),this.mTextId=e,this.mValueBits=t,this.mOutValue=O(t)?0:F(t),this.mDigitsBefore=i,this.mDigitsAfter=r,this.mFlags=n,n&3){case $p:this.mAfter=0;break;case zp:this.mAfter=48;break;default:this.mAfter=32;break}switch(n&12){case jp:this.mPre=0;break;case Kp:this.mPre=48;break;default:this.mPre=32;break}switch(this.mGroup=0,n&48){case qp:this.mGroup=1;break;case Zp:this.mGroup=2;break;case Qp:this.mGroup=3;break}switch(this.mSeparator=0,n&192){case Jp:this.mSeparator=1;break;case tf:this.mSeparator=2;break;case ef:this.mSeparator=3;break}this.mOptions=0,(n&nf)!==0&&(this.mOptions|=2),(n&rf)!==0&&(this.mOptions|=1),this.mLegacy=(n&sf)!==0}write(e){}registerListening(e){O(this.mValueBits)&&e.listensTo(x(this.mValueBits),this)}updateVariables(e){O(this.mValueBits)&&(this.mOutValue=e.getFloat(x(this.mValueBits)))}apply(e){this.updateVariables(e);let t=Math.fround(this.mOutValue),i;(this.mFlags&4096)!==0?i=am(t):this.mLegacy?i=Cl(t,this.mDigitsBefore,this.mDigitsAfter,this.mPre,this.mAfter):i=vl(t,this.mDigitsBefore,this.mDigitsAfter,this.mPre,this.mAfter,this.mSeparator,this.mGroup,this.mOptions),e.loadText(this.mTextId,i)}deepToString(e){return`${e}TextFromFloat[${this.mTextId}] = ${O(this.mValueBits)?"ref("+x(this.mValueBits)+")":F(this.mValueBits)} ${this.mDigitsBefore}.${this.mDigitsAfter} ${this.mFlags}`}static read(e,t){let i=e.declareId(),r=e.readNanIdBits(),n=e.readInt(),s=n&65535,a=n>>16&65535,m=e.readInt();t.push(new o(i,r,a,s,m))}};var Ki=class o extends D{static{this.OP_CODE=136}constructor(e,t,i){super(),this.mTextId=e,this.mSrcId1=t,this.mSrcId2=i}write(e){}registerListening(e){e.listensTo(this.mSrcId1,this),e.listensTo(this.mSrcId2,this)}updateVariables(e){this.apply(e)}apply(e){let t=e.getText(this.mSrcId1)??"",i=e.getText(this.mSrcId2)??"";e.loadText(this.mTextId,t+i)}deepToString(e){return`${e}TextMerge(${this.mTextId})`}static read(e,t){t.push(new o(e.declareId(),e.readId(),e.readId()))}};var mm=class{constructor(e,t,i){this.mNames=e,this.mTypes=t,this.mIds=i}getPos(e){return this.mNames.indexOf(e)}},es=class o extends D{static{this.OP_CODE=145}constructor(e,t){super(),this.mId=e,this.mDataMap=t}write(e){}apply(e){e.putDataMap(this.mId,this.mDataMap)}deepToString(e){return`${e}DataMapIds(${this.mId})`}static read(e,t){let i=e.declareId(),r=e.readInt(),n=new Array(r),s=new Int8Array(r),a=new Int32Array(r);for(let m=0;m<r;m++)n[m]=e.readUTF8(),s[m]=e.readByte(),a[m]=e.readId();t.push(new o(i,new mm(n,s,a)))}};var qi=class o extends D{static{this.OP_CODE=146}constructor(e,t){super(),this.mId=e,this.mIds=t}getCollectionId(){return this.mId}getLength(){return this.mIds.length}getId(e){return this.mIds[e]}write(e){}apply(e){e.addCollection(this.mId,{ids:this.mIds,getLength:()=>this.mIds.length,getFloatValue:t=>this.mIds[t],getId:t=>this.mIds[t]})}deepToString(e){return`${e}DataListIds(${this.mId})`}static read(e,t){let i=e.declareId(),r=e.readInt(),n=new Int32Array(r);for(let s=0;s<r;s++)n[s]=e.readId();t.push(new o(i,n))}};var ui=class o extends D{static{this.OP_CODE=147}constructor(e,t){super(),this.mId=e,this.mBits=t,this.mValues=new Float32Array(t.length);for(let i=0;i<t.length;i++)this.mValues[i]=F(t[i])}update(e){this.mBits=e.mBits,this.mValues=e.mValues}write(e){}registerListening(e){e.addCollection(this.mId,{values:this.mValues,getLength:()=>this.mValues.length,getFloatValue:t=>this.mValues[t],getFloats:()=>this.mValues});for(let t of this.mBits)Et(t)&&e.listensTo(x(t),this)}updateVariables(e){}apply(e){e.addCollection(this.mId,{values:this.mValues,getLength:()=>this.mValues.length,getFloatValue:t=>this.mValues[t],getFloats:()=>this.mValues})}deepToString(e){return`${e}DataListFloat(${this.mId})`}static read(e,t){let i=e.declareId(),r=e.readInt(),n=new Int32Array(r);for(let s=0;s<r;s++)n[s]=e.readNanIdBits();t.push(new o(i,n))}};var Zi=class{constructor(e=0,t=0){this.mWidth=e,this.mHeight=t}getWidth(){return this.mWidth}setWidth(e){this.mWidth=e}getHeight(){return this.mHeight}setHeight(e){this.mHeight=e}clear(){this.mWidth=0,this.mHeight=0}};function De(o,e){return Math.max(0,o-e)}var Mt=class extends ct{constructor(){super(...arguments);this.mCachedWrapSize=new Zi;this.mLastMeasurePass=null;this.mLastMinW=-1;this.mLastMaxW=-1;this.mLastMinH=-1;this.mLastMaxH=-1}measure(t,i,r,n,s,a){if(this.mLastMeasurePass===a&&this.mLastMinW===i&&this.mLastMaxW===r&&this.mLastMinH===n&&this.mLastMaxH===s&&!this.mNeedsMeasure)return;this.mLastMeasurePass=a,this.mLastMinW=i,this.mLastMaxW=r,this.mLastMinH=n,this.mLastMaxH=s,this.updatePadding();let m=a.get(this),u=this.mPaddingLeft+this.mPaddingRight,l=this.mPaddingTop+this.mPaddingBottom,h=this.getWidthModifier(),c=this.getHeightModifier();for(let B of[h,c])B&&B.isDirty()&&(B.markNotDirty(),B.updateVariables(t.getContext()));let f=this.getDpScale(t);{let B=this.getWidthInModifier();B&&(B.getMin()>=0&&(i=Math.max(i,B.getMin())),B.getMax()>=0&&(r=Math.min(r,B.getMax())));let U=this.getHeightInModifier();U&&(U.getMin()>=0&&(n=Math.max(n,U.getMin())),U.getMax()>=0&&(s=Math.min(s,U.getMax())))}let d=h?.getType()===ft.EXACT||h?.getType()===ft.EXACT_DP,p=c?.getType()===pt.EXACT||c?.getType()===pt.EXACT_DP,[b,g]=this.weightFill(),C=b&&!d,y=g&&!p,I;if(C&&h?.getType()!==ft.FILL)I=r;else if(h&&(h.getType()===ft.EXACT||h.getType()===ft.EXACT_DP)){let B=h.getType()===ft.EXACT_DP?h.getValue()*f:h.getValue();I=Math.min(B+this.mPadBeforeWidth,r)}else h&&h.getType()===ft.FILL?I=h.hasFraction()?r*h.getValue():r:h&&h.getType()===ft.WEIGHT?I=Math.min(Math.max(this.mPadBeforeWidth,i),r):I=r;let T;if(y&&c?.getType()!==pt.FILL)T=s;else if(c&&(c.getType()===pt.EXACT||c.getType()===pt.EXACT_DP)){let B=c.getType()===pt.EXACT_DP?c.getValue()*f:c.getValue();T=Math.min(B+this.mPadBeforeHeight,s)}else c&&c.getType()===pt.FILL?T=c.hasFraction()?s*c.getValue():s:c&&c.getType()===pt.WEIGHT?T=Math.min(Math.max(this.mPadBeforeHeight,n),s):T=s;m.setW(I),m.setH(T);let v=!C&&h?.getType()===ft.WRAP,_=!y&&c?.getType()===pt.WRAP;if(v||_){this.mCachedWrapSize.clear();let B=h?.getType()===ft.WEIGHT,U=c?.getType()===pt.WEIGHT,H=De(v||B?r:I,u),N=De(_||U?s:T,l);if(this.computeWrapSize(t,i,H,n,N,v,_,a,this.mCachedWrapSize),v){I=this.mCachedWrapSize.getWidth()+u;let k=this.getWidthInModifier();k&&(k.getMin()>=0&&(I=Math.max(I,k.getMin())),k.getMax()>=0&&(I=Math.min(I,k.getMax()))),I=Math.min(I,r)}if(_){T=this.mCachedWrapSize.getHeight()+l;let k=this.getHeightInModifier();k&&(k.getMin()>=0&&(T=Math.max(T,k.getMin())),k.getMax()>=0&&(T=Math.min(T,k.getMax()))),T=Math.min(T,s)}m.setW(I),m.setH(T)}let P=this.getScrollModifier();if(P){let B=P.getDirection()===He.VERTICAL,U=De(Math.min(I,r),u),H=De(Math.min(T,s),l),N=B?U:1e9,k=B?1e9:H;this.mCachedWrapSize.clear(),this.computeWrapSize(t,0,N,0,k,!0,!0,a,this.mCachedWrapSize),B?(this.mScrollHostDimension=H,this.mScrollContentDimension=this.mCachedWrapSize.getHeight(),P.setVerticalScrollDimension(this.mScrollHostDimension,this.mScrollContentDimension)):(this.mScrollHostDimension=U,this.mScrollContentDimension=this.mCachedWrapSize.getWidth(),P.setHorizontalScrollDimension(this.mScrollHostDimension,this.mScrollContentDimension));let Y=B?De(I,u):Math.max(De(I,u),this.mScrollContentDimension),$=B?Math.max(De(T,l),this.mScrollContentDimension):De(T,l);this.computeSize(t,0,Y,0,$,a)}this.updateComponentValues(t.getContext(),I,T);let E=t.getContext();for(let B of this.mContentOps)B instanceof Z||B.isDirty()&&typeof B.updateVariables=="function"&&(B.markNotDirty(),B.updateVariables(E),B.apply(E));!P&&!(v||_)&&this.computeSize(t,0,De(I,u),0,De(T,l),a),I=Math.max(I,i),T=Math.max(T,n),I=Math.min(I,r),T=Math.min(T,s);let L=this.getWidthInModifier();L instanceof Ut&&L.getType()===Ut.REQUIRED_HORIZONTAL&&(I=Math.max(L.getMin(),Math.min(I,L.getMax())));let V=this.getHeightInModifier();V instanceof Ut&&V.getType()===Ut.REQUIRED_VERTICAL&&(T=Math.max(V.getMin(),Math.min(T,V.getMax()))),m.setW(I),m.setH(T),this.internalLayoutMeasure(t,a)}layout(t,i){super.layout(t,i);let r=i.get(this);this.layoutModifiers(r.getW(),r.getH());let n=this.getScrollModifier();if(n){let s=Math.max(0,this.mScrollContentDimension-this.mScrollHostDimension),a=n.getMaxNan(),m=n.getNotchMaxNan();O(a)&&t.loadFloat(x(a),s),O(m)&&t.loadFloat(x(m),this.mScrollContentDimension)}}weightFill(){return[!1,!1]}computeWrapSize(t,i,r,n,s,a,m,u,l){}computeSize(t,i,r,n,s,a){}internalLayoutMeasure(t,i){}getDpScale(t){let i=t.getContext().getDensity();return Number.isNaN(i)||i<=0?1:i}getDpBehaviorScale(t){let i=t.getContext();if(i.getDensityBehavior()!==st.DENSITY_BEHAVIOR_DP)return 1;let r=i.getDensity();return Number.isNaN(r)||r<=0?1:r}spacedByPx(t,i){if(this.mSpacedByBits!==void 0&&O(this.mSpacedByBits)){let n=t.getContext().getFloat(x(this.mSpacedByBits));i=Number.isFinite(n)?n:0}if(t.getDensityBehavior?.()!==st.DENSITY_BEHAVIOR_DP)return i;let r=t.getDensity();return r>0&&!Number.isNaN(r)?i*r:i}};var Qi=class o extends Mt{static{this.OP_CODE=202}static{this.START=1}static{this.CENTER=2}static{this.END=3}static{this.TOP=4}static{this.BOTTOM=5}constructor(e,t,i,r){super(e,t),this.mAnimationId=t,this.mHorizontalPositioning=i,this.mVerticalPositioning=r}computeWrapSize(e,t,i,r,n,s,a,m,u){let l=m.get(this);for(let h of this.mChildrenComponents){h.measure(e,0,i,0,n,m);let c=m.get(h);h.hasComputedLayout()&&h.applyComputedLayout(Ce.TYPE_MEASURE,e,c,l)&&h.measure(e,c.getW(),c.getW(),c.getH(),c.getH(),m),c.isGone()||(u.setWidth(Math.max(u.getWidth(),c.getW())),u.setHeight(Math.max(u.getHeight(),c.getH())))}}computeSize(e,t,i,r,n,s){let a=s.get(this);for(let m of this.mChildrenComponents)if(m.measure(e,t,i,r,n,s),m.hasComputedLayout()){let u=s.get(m);m.applyComputedLayout(Ce.TYPE_MEASURE,e,u,a)&&m.measure(e,u.getW(),u.getW(),u.getH(),u.getH(),s)}}internalLayoutMeasure(e,t){let i=t.get(this),r=i.getW()-this.mPaddingLeft-this.mPaddingRight,n=i.getH()-this.mPaddingTop-this.mPaddingBottom;for(let s of this.mChildrenComponents){let a=t.get(s);if(a.isGone())continue;let m=0,u=0;switch(this.mHorizontalPositioning){case o.START:m=0;break;case o.CENTER:m=(r-a.getW())/2;break;case o.END:m=r-a.getW();break}switch(this.mVerticalPositioning){case o.TOP:u=0;break;case o.CENTER:u=(n-a.getH())/2;break;case o.BOTTOM:u=n-a.getH();break}a.setX(m),a.setY(u),s.hasComputedLayout()&&s.applyComputedLayout(Ce.TYPE_POSITION,e,a,i)}}write(e){e.start(o.OP_CODE),e.writeInt(this.getComponentId()),e.writeInt(this.mAnimationId),e.writeInt(this.mHorizontalPositioning),e.writeInt(this.mVerticalPositioning)}apply(e){super.apply(e)}deepToString(e){return`${e}BoxLayout(${this.getComponentId()}, h=${this.mHorizontalPositioning}, v=${this.mVerticalPositioning})`}static read(e,t){let i=e.declareId(),r=e.declareId(),n=e.readInt(),s=e.readInt();t.push(new o(i,r,n,s))}};var Oe=class o extends Mt{static{this.OP_CODE=203}static{this.START=1}static{this.CENTER=2}static{this.END=3}static{this.TOP=4}static{this.BOTTOM=5}static{this.SPACE_BETWEEN=6}static{this.SPACE_EVENLY=7}static{this.SPACE_AROUND=8}constructor(e,t,i,r,n){super(e,t),this.mAnimationId=t,this.mHorizontalPositioning=i,this.mVerticalPositioning=r,this.mSpacedBy=n}minIntrinsicWidth(){return this.minIntrinsicWidthForComponents(this.mChildrenComponents)}minIntrinsicHeight(){return this.minIntrinsicHeightForComponents(this.mChildrenComponents)}minIntrinsicWidthForComponents(e){let t=this.modifierDefinedWidth(!0),i=0;for(let r of e)i+=r.minIntrinsicWidth();return Math.max(t,i)}minIntrinsicHeightForComponents(e){let t=this.modifierDefinedHeight(!0),i=0;for(let r of e)i=Math.max(i,r.minIntrinsicHeight());return Math.max(t,i)}weightFill(){return[this.mChildrenComponents.some(e=>e instanceof ct&&e.hasWidthWeight()),!1]}computeWrapSize(e,t,i,r,n,s,a,m,u){this.computeWrapSizeForComponents(e,t,i,r,n,s,a,m,u,this.mChildrenComponents)}computeWrapSizeForComponents(e,t,i,r,n,s,a,m,u,l){u.clear();let h=0,c=i,f=0,d=!1;for(let p of l)m.get(p).isGone()||p instanceof ct&&p.hasWidthWeight()&&(d=!0,f+=p.getWidthModValue());if(d){for(let p of l){if(p instanceof ct&&p.hasWidthWeight())continue;p.measure(e,0,c,0,n,m);let b=m.get(p);b.isGone()||(u.setWidth(u.getWidth()+b.getW()),u.setHeight(Math.max(u.getHeight(),b.getH())),h++,c-=b.getW())}for(let p of l){if(!(p instanceof ct&&p.hasWidthWeight()))continue;let g=p.getWidthModValue()*c/f;p.measure(e,g,g,0,n,m);let C=m.get(p);C.isGone()||(u.setWidth(u.getWidth()+C.getW()),u.setHeight(Math.max(u.getHeight(),C.getH())),h++)}}else for(let p of l){p.measure(e,0,c,0,n,m);let b=m.get(p);b.isGone()||(u.setWidth(u.getWidth()+b.getW()),u.setHeight(Math.max(u.getHeight(),b.getH())),h++,c-=b.getW())}h>0&&u.setWidth(u.getWidth()+this.spacedByPx(e,this.mSpacedBy)*(h-1))}computeSize(e,t,i,r,n,s){this.computeSizeForComponents(e,t,i,r,n,s,this.mChildrenComponents)}computeSizeForComponents(e,t,i,r,n,s,a){let m=i;for(let u of a){u.measure(e,0,m,0,n,s);let l=s.get(u);l.isGone()||(m-=l.getW())}}internalLayoutMeasure(e,t){let i=t.get(this),r=i.getW()-this.mPaddingLeft-this.mPaddingRight,n=i.getH()-this.mPaddingTop-this.mPaddingBottom;this.internalLayoutMeasureForComponents(e,t,this.mChildrenComponents,r,n,0,0,null)}internalLayoutMeasureForComponents(e,t,i,r,n,s,a,m){if(i.length===0)return;let u=!1,l=0,h=0;for(let g of i){let C=t.get(g);C.isGone()||(g instanceof ct&&g.hasWidthWeight()?(u=!0,l+=g.getWidthModValue()):h+=C.getW())}if(u){let g=r-h;for(let C of i){if(!(C instanceof ct&&C.hasWidthWeight()))continue;let y=t.get(C);if(y.isGone())continue;let T=C.getWidthModValue()*g/l,v=C.getWidthInModifier();v&&(v.getMin()>=0&&(T=Math.max(v.getMin(),T)),v.getMax()>=0&&(T=Math.min(v.getMax(),T))),y.setW(T),C.measure(e,T,T,y.getH(),y.getH(),t)}}let c=0,f=0,d=0;for(let g of i){let C=t.get(g);C.isGone()||(c+=C.getW(),f=Math.max(f,C.getH()),d++)}c+=this.spacedByPx(e,this.mSpacedBy)*Math.max(0,d-1);let p=0,b=0;switch(this.mHorizontalPositioning){case o.START:p=0;break;case o.END:p=r-c;break;case o.CENTER:p=(r-c)/2;break;case o.SPACE_BETWEEN:{let g=0;for(let C of i){let y=t.get(C);y.isGone()||(g+=y.getW())}d>1?b=(r-g)/(d-1):p=(r-c)/2;break}case o.SPACE_EVENLY:{let g=0;for(let C of i){let y=t.get(C);y.isGone()||(g+=y.getW())}b=(r-g)/(d+1),p=b;break}case o.SPACE_AROUND:{let g=0;for(let C of i){let y=t.get(C);y.isGone()||(g+=y.getW())}b=(r-g)/d,p=b/2;break}}for(let g of i){let C=t.get(g),y=0;switch(this.mVerticalPositioning){case o.TOP:y=0;break;case o.CENTER:y=(n-C.getH())/2;break;case o.BOTTOM:y=n-C.getH();break}C.setX(p+s),C.setY(y+a),!C.isGone()&&(p+=C.getW(),(this.mHorizontalPositioning===o.SPACE_BETWEEN||this.mHorizontalPositioning===o.SPACE_AROUND||this.mHorizontalPositioning===o.SPACE_EVENLY)&&(p+=b),p+=this.spacedByPx(e,this.mSpacedBy))}m!==null&&(m.setWidth(c),m.setHeight(f))}write(e){e.start(o.OP_CODE),e.writeInt(this.getComponentId()),e.writeInt(this.mAnimationId),e.writeInt(this.mHorizontalPositioning),e.writeInt(this.mVerticalPositioning),e.writeFloat(this.mSpacedBy)}apply(e){super.apply(e)}deepToString(e){return`${e}RowLayout(${this.getComponentId()}, spacing=${this.mSpacedBy})`}static read(e,t){let i=e.declareId(),r=e.declareId(),n=e.readInt(),s=e.readInt(),a=e.readNanIdBits(),m=F(a);{let u=new o(i,r,n,s,m);u.mSpacedByBits=a,t.push(u)}}};var Ji=class o extends Mt{static{this.OP_CODE=204}static{this.START=1}static{this.CENTER=2}static{this.END=3}static{this.TOP=4}static{this.BOTTOM=5}static{this.SPACE_BETWEEN=6}static{this.SPACE_EVENLY=7}static{this.SPACE_AROUND=8}constructor(e,t,i,r,n){super(e,t),this.mAnimationId=t,this.mHorizontalPositioning=i,this.mVerticalPositioning=r,this.mSpacedBy=n}minIntrinsicHeight(){let e=this.modifierDefinedHeight(!0),t=0;for(let i of this.mChildrenComponents)t+=i.minIntrinsicHeight();return Math.max(e,t)}weightFill(){return[!1,this.mChildrenComponents.some(e=>e instanceof ct&&e.hasHeightWeight())]}computeWrapSize(e,t,i,r,n,s,a,m,u){u.clear();let l=0,h=n,c=0,f=!1;for(let d of this.mChildrenComponents)m.get(d).isGone()||d instanceof ct&&d.hasHeightWeight()&&(f=!0,c+=d.getHeightModValue());if(f){for(let d of this.mChildrenComponents){if(d instanceof ct&&d.hasHeightWeight())continue;d.measure(e,0,i,0,h,m);let p=m.get(d);p.isGone()||(u.setWidth(Math.max(u.getWidth(),p.getW())),u.setHeight(u.getHeight()+p.getH()),l++,h-=p.getH())}for(let d of this.mChildrenComponents){if(!(d instanceof ct&&d.hasHeightWeight()))continue;let b=d.getHeightModValue()*h/c;d.measure(e,0,i,b,b,m);let g=m.get(d);g.isGone()||(u.setWidth(Math.max(u.getWidth(),g.getW())),u.setHeight(u.getHeight()+g.getH()),l++)}}else for(let d of this.mChildrenComponents){d.measure(e,0,i,0,h,m);let p=m.get(d);p.isGone()||(u.setWidth(Math.max(u.getWidth(),p.getW())),u.setHeight(u.getHeight()+p.getH()),l++,h-=p.getH())}l>0&&u.setHeight(u.getHeight()+this.spacedByPx(e,this.mSpacedBy)*(l-1))}computeSize(e,t,i,r,n,s){let a=0,m=0,u=!1,l=n;for(let h of this.mChildrenComponents)if(!s.get(h).isGone())if(h instanceof ct&&h.hasHeightWeight())u=!0,m+=h.getHeightModValue();else{h.measure(e,t,i,r,l,s);let f=s.get(h);l-=f.getH(),a+=f.getH()}if(u){l=n;for(let h of this.mChildrenComponents){if(h instanceof ct&&h.hasHeightWeight()&&!h.isGone()){let f=h.getHeightModValue(),d=(n-a)*f/m;h.measure(e,t,i,d,d,s)}else h.measure(e,t,i,r,l,s);let c=s.get(h);c.isGone()||(l-=c.getH())}}else{let h=n;for(let c of this.mChildrenComponents){c.measure(e,t,i,r,h,s);let f=s.get(c);f.isGone()||(h-=f.getH())}}}internalLayoutMeasure(e,t){let i=t.get(this),r=i.getW()-this.mPaddingLeft-this.mPaddingRight,n=i.getH()-this.mPaddingTop-this.mPaddingBottom,s=this.mChildrenComponents;if(s.length===0)return;let a=!1,m=0,u=0;for(let p of s){let b=t.get(p);b.isGone()||(p instanceof ct&&p.hasHeightWeight()?(a=!0,m+=p.getHeightModValue()):u+=b.getH())}if(a){let p=n-u;for(let b of s){if(!(b instanceof ct&&b.hasHeightWeight()))continue;let g=t.get(b);if(g.isGone())continue;let y=b.getHeightModValue()*p/m,I=b.getHeightInModifier();I&&(I.getMin()>=0&&(y=Math.max(I.getMin(),y)),I.getMax()>=0&&(y=Math.min(I.getMax(),y))),g.setH(y),b.measure(e,g.getW(),g.getW(),g.getH(),g.getH(),t)}}let l=0,h=0,c=0;for(let p of s){let b=t.get(p);b.isGone()||(l=Math.max(l,b.getW()),h+=b.getH(),c++)}h+=this.spacedByPx(e,this.mSpacedBy)*Math.max(0,c-1);let f=0,d=0;switch(this.mVerticalPositioning){case o.TOP:f=0;break;case o.BOTTOM:f=n-h;break;case o.CENTER:f=(n-h)/2;break;case o.SPACE_BETWEEN:{let p=0;for(let b of s){let g=t.get(b);g.isGone()||(p+=g.getH())}c>1?d=(n-p)/(c-1):f=(n-h)/2;break}case o.SPACE_EVENLY:{let p=0;for(let b of s){let g=t.get(b);g.isGone()||(p+=g.getH())}d=(n-p)/(c+1),f=d;break}case o.SPACE_AROUND:{let p=0;for(let b of s){let g=t.get(b);g.isGone()||(p+=g.getH())}d=(n-p)/c,f=d/2;break}}for(let p of s){let b=t.get(p),g=0;switch(this.mHorizontalPositioning){case o.START:g=0;break;case o.CENTER:g=(r-b.getW())/2;break;case o.END:g=r-b.getW();break}b.setX(g),b.setY(f),!b.isGone()&&(f+=b.getH(),(this.mVerticalPositioning===o.SPACE_BETWEEN||this.mVerticalPositioning===o.SPACE_AROUND||this.mVerticalPositioning===o.SPACE_EVENLY)&&(f+=d),f+=this.spacedByPx(e,this.mSpacedBy))}}write(e){e.start(o.OP_CODE),e.writeInt(this.getComponentId()),e.writeInt(this.mAnimationId),e.writeInt(this.mHorizontalPositioning),e.writeInt(this.mVerticalPositioning),e.writeFloat(this.mSpacedBy)}apply(e){super.apply(e)}deepToString(e){return`${e}ColumnLayout(${this.getComponentId()}, spacing=${this.mSpacedBy})`}static read(e,t){let i=e.declareId(),r=e.declareId(),n=e.readInt(),s=e.readInt(),a=e.readNanIdBits(),m=F(a);{let u=new o(i,r,n,s,m);u.mSpacedByBits=a,t.push(u)}}};var is=class o extends Qi{static{this.OP_CODE=205}constructor(e,t){super(e,t,0,0)}internalLayoutMeasure(e,t){if(this.mHasCanvasLayoutContent){let i=t.get(this),r=i.getW()-this.mPaddingLeft-this.mPaddingRight,n=i.getH()-this.mPaddingTop-this.mPaddingBottom;for(let s of this.mChildrenComponents){let a=t.get(s);a.setX(0),a.setY(0),a.setW(r),a.setH(n)}}else super.internalLayoutMeasure(e,t)}write(e){e.start(o.OP_CODE),e.writeInt(this.getComponentId()),e.writeInt(this.mAnimationId)}apply(e){super.apply(e)}deepToString(e){return`${e}CanvasLayout(${this.getComponentId()})`}static read(e,t){let i=e.declareId(),r=e.declareId();t.push(new o(i,r))}};var ta=7,Tl=0;var rs=class o extends D{static{this.OP_CODE=241}static{this.SKIP_IF_API_LESS_THAN=1}static{this.SKIP_IF_API_GREATER_THAN=2}static{this.SKIP_IF_API_EQUAL_TO=3}static{this.SKIP_IF_API_NOT_EQUAL_TO=4}static{this.SKIP_IF_PROFILE_INCLUDES=5}static{this.SKIP_IF_PROFILE_EXCLUDES=6}constructor(){super()}write(e){}apply(e){}deepToString(e){return`${e}Skip`}static needsToSkip(e,t){switch(e){case o.SKIP_IF_API_LESS_THAN:return ta<t;case o.SKIP_IF_API_GREATER_THAN:return ta>t;case o.SKIP_IF_API_EQUAL_TO:return ta===t;case o.SKIP_IF_API_NOT_EQUAL_TO:return ta!==t;case o.SKIP_IF_PROFILE_INCLUDES:return(Tl&t)!==0;case o.SKIP_IF_PROFILE_EXCLUDES:return(Tl&t)===0;default:return!1}}static read(e,t){let i=e.readInt(),r=e.readInt(),n=e.readInt();o.needsToSkip(i,r)&&e.setIndex(e.getIndex()+n)}};var of=1,af=2,mf=3,uf=4,lf=5,hf=6,cf=7,df=8,pf=9,ff=10,gf=11,bf=12,yf=13,If=14,Cf=15,vf=16,Tf=17,Of=18,xf=19,Af=20,Ef=21,Mf=22,Ff=23,Sf=24,Pf=25,_f=26,ns=class o extends D{constructor(){super();this.id=-1;this.color=null;this.colorId=null;this.fontSize=null;this.minFontSize=null;this.maxFontSize=null;this.fontStyle=null;this.fontWeight=null;this.fontFamilyId=null;this.textAlign=null;this.overflow=null;this.maxLines=null;this.letterSpacing=null;this.lineHeightAdd=null;this.lineHeightMultiplier=null;this.lineBreakStrategy=null;this.hyphenationFrequency=null;this.justificationMode=null;this.underline=null;this.strikethrough=null;this.fontAxis=null;this.fontAxisValues=null;this.autosize=null;this.parentId=null}static{this.OP_CODE=242}write(t){}apply(t){this.id!==-1&&t.putObject?.(this.id,this)}deepToString(t){return`${t}TextStyle(id=${this.id})`}static read(t,i){let r=t.readShort(),n=t.getRemapContext?.(),s=u=>n?n.resolveId(u):u,a=u=>n?n.declareId(u):u,m=new o;for(let u=0;u<r;u++){let l=t.readByte();switch(l){case of:m.id=a(t.readInt());break;case af:t.readInt();break;case mf:m.color=t.readInt();break;case uf:m.colorId=s(t.readInt());break;case lf:m.fontSize=t.readFloat();break;case hf:m.fontStyle=t.readInt();break;case cf:m.fontWeight=t.readFloat();break;case df:m.fontFamilyId=s(t.readInt());break;case pf:m.textAlign=t.readInt();break;case ff:m.overflow=t.readInt();break;case gf:m.maxLines=t.readInt();break;case bf:m.letterSpacing=t.readFloat();break;case yf:m.lineHeightAdd=t.readFloat();break;case If:m.lineHeightMultiplier=t.readFloat();break;case Cf:m.lineBreakStrategy=t.readInt();break;case vf:m.hyphenationFrequency=t.readInt();break;case Tf:m.justificationMode=t.readInt();break;case Of:m.underline=t.readBoolean();break;case xf:m.strikethrough=t.readBoolean();break;case Af:{let h=t.readShort(),c=new Array(h);for(let f=0;f<h;f++)c[f]=t.readInt();m.fontAxis=c;break}case Ef:{let h=t.readShort(),c=new Array(h);for(let f=0;f<h;f++)c[f]=t.readFloat();m.fontAxisValues=c;break}case Mf:m.autosize=t.readBoolean();break;case Ff:t.readInt();break;case Sf:m.parentId=s(t.readInt());break;case Pf:m.minFontSize=t.readFloat();break;case _f:m.maxFontSize=t.readFloat();break;default:console.warn(`TextStyle: unknown parameter tag ${l}`);return}}i.push(m)}};var ss=class o extends Z{constructor(t,i,r){super();this.mList=[];this.mType=t,this.mVarABits=i,this.mVarBBits=r,this.mVarAOut=O(i)?0:F(i),this.mVarBOut=O(r)?0:F(r)}static{this.OP_CODE=178}static{this.TYPE_EQ=0}static{this.TYPE_NEQ=1}static{this.TYPE_LT=2}static{this.TYPE_LTE=3}static{this.TYPE_GT=4}static{this.TYPE_GTE=5}getList(){return this.mList}write(t){}registerListening(t){O(this.mVarABits)&&t.listensTo(x(this.mVarABits),this),O(this.mVarBBits)&&t.listensTo(x(this.mVarBBits),this)}updateVariables(t){this.markNotDirty(),this.mVarAOut=O(this.mVarABits)?t.getFloat(x(this.mVarABits)):F(this.mVarABits),this.mVarBOut=O(this.mVarBBits)?t.getFloat(x(this.mVarBBits)):F(this.mVarBBits);for(let i of this.mList)i.isDirty()&&typeof i.updateVariables=="function"&&i.updateVariables(t)}paint(t){let i=t.getContext();for(let n of this.mList)n.isDirty()&&typeof n.updateVariables=="function"&&(n.markNotDirty(),n.updateVariables(i));let r=!1;switch(this.mType){case o.TYPE_EQ:r=this.mVarAOut===this.mVarBOut;break;case o.TYPE_NEQ:r=this.mVarAOut!==this.mVarBOut;break;case o.TYPE_LT:r=this.mVarAOut<this.mVarBOut;break;case o.TYPE_LTE:r=this.mVarAOut<=this.mVarBOut;break;case o.TYPE_GT:r=this.mVarAOut>this.mVarBOut;break;case o.TYPE_GTE:r=this.mVarAOut>=this.mVarBOut;break}if(r)for(let n of this.mList)i.incrementOpCount(n),n instanceof o?n.paint(t):n.apply(i)}deepToString(t){return`${t}ConditionalOperations(type=${this.mType})`}static read(t,i){let r=t.readByte(),n=t.readNanIdBits(),s=t.readNanIdBits();i.push(new o(r,n,s))}};function Ol(o){if(!O(o))return!1;let e=x(o);return e>=10&&e<=17}var os=class o extends D{static{this.OP_CODE=159}static{this.MOVE_NAN_BITS=-8388598}constructor(e,t,i){super(),this.mId=e,this.mPathBits=new Int32Array([o.MOVE_NAN_BITS,t,i]),this.mOutputPath=Int32Array.from(this.mPathBits)}write(e){}registerListening(e){for(let t of this.mPathBits)O(t)&&!Ol(t)&&e.listensTo(x(t),this)}updateVariables(e){for(let t=0;t<this.mPathBits.length;t++){let i=this.mPathBits[t];Ol(i)?this.mOutputPath[t]=i:O(i)?this.mOutputPath[t]=et(e.getFloat(x(i))):this.mOutputPath[t]=i}}apply(e){e.mMode==="PAINT"&&e.loadPathData(this.mId,0,this.mOutputPath)}deepToString(e){return`${e}PathCreate(${this.mId})`}static read(e,t){let i=e.declareId(),r=e.readNanIdBits(),n=e.readNanIdBits();t.push(new o(i,r,n))}};function xl(o){if(!O(o))return!1;let e=x(o);return e>=10&&e<=17}var as=class o extends D{static{this.OP_CODE=160}constructor(e,t){super(),this.mId=e,this.mPathBits=t,this.mOutputPath=Int32Array.from(t)}write(e){}registerListening(e){for(let t of this.mPathBits)O(t)&&!xl(t)&&e.listensTo(x(t),this)}updateVariables(e){for(let t=0;t<this.mPathBits.length;t++){let i=this.mPathBits[t];xl(i)?this.mOutputPath[t]=i:O(i)?this.mOutputPath[t]=et(e.getFloat(x(i))):this.mOutputPath[t]=i}}apply(e){if(e.mMode!=="PAINT")return;let t=this.mOutputPath;if(t.length>0&&o.isReset(t[0])){e.loadPathData(this.mId,0,new Int32Array(0));return}let i=e.getPathData(this.mId);if(i&&i.length>0){let r=new Int32Array(i.length+t.length);r.set(i,0),r.set(t,i.length),e.loadPathData(this.mId,0,r)}else e.loadPathData(this.mId,0,t)}static isReset(e){return O(e)?x(e)===17:!1}deepToString(e){return`${e}PathAppend(${this.mId})`}static read(e,t){let i=e.readId(),r=e.readInt(),n=new Int32Array(r),s=e.getRemapContext?.();for(let a=0;a<r;a++){let m=e.readInt();n[a]=s&&O(m)&&x(m)>17?s.resolveNanIdBits(m):m}t.push(new o(i,n))}};var Rf=-8388598,Bf=-8388594,Df=-8388593;var wf=2,Lf=4,Ml=6,it=Math.fround,ms=class{constructor(e){this.mSize=0;this.mCx=0;this.mCy=0;this.mPath=new Int32Array(Math.max(10,e))}reset(){this.mSize=0}ensure(e){if(this.mSize+e<=this.mPath.length)return;let t=new Int32Array(Math.max(this.mPath.length*2,this.mSize+e));t.set(this.mPath.subarray(0,this.mSize)),this.mPath=t}moveTo(e,t){this.ensure(3),this.mPath[this.mSize++]=Rf,this.mPath[this.mSize++]=et(it(e)),this.mPath[this.mSize++]=et(it(t)),this.mCx=it(e),this.mCy=it(t)}cubicTo(e,t,i,r,n,s){this.ensure(9),this.mPath[this.mSize++]=Bf,this.mPath[this.mSize++]=et(this.mCx),this.mPath[this.mSize++]=et(this.mCy),this.mPath[this.mSize++]=et(it(e)),this.mPath[this.mSize++]=et(it(t)),this.mPath[this.mSize++]=et(it(i)),this.mPath[this.mSize++]=et(it(r)),this.mPath[this.mSize++]=et(it(n)),this.mPath[this.mSize++]=et(it(s)),this.mCx=it(n),this.mCy=it(s)}closePath(){this.ensure(1),this.mPath[this.mSize++]=Df}copyPoints(){return this.mPath.slice(0,this.mSize)}};function Nf(o,e,t,i,r,n,s){for(let a=0;a<t;a++){let m=(a+1)%i,u=it(o[m]-o[a]),l=it(e[m]-e[a]),h=it(Math.hypot(u,l));h===0&&(h=1e-12),r[a]=h,n[a]=it(u/h),s[a]=it(l/h)}}function Al(o,e,t,i){let r=e.length,n=i?r:r+1;for(let s=0;s<n;s++){let a=((s-1+r)%r+r)%r,m=s%r;if(!i&&s===0)o[s]=e[0];else if(!i&&s===n-1)o[s]=e[r-1];else{let u=e[a],l=e[m];if(u===0||l===0||Math.sign(u)!==Math.sign(l))o[s]=0;else{let h=it(it(2*t[m])+t[a]),c=it(t[m]+it(2*t[a]));o[s]=it(it(h+c)/it(it(h/u)+it(c/l)))}}}for(let s=0;s<r;s++)if(e[s]===0)o[s]=0,o[(s+1)%n]=0;else{let a=it(o[s]/e[s]),m=it(o[(s+1)%n]/e[s]),u=it(it(a*a)+it(m*m));if(u>9){let l=it(3/it(Math.sqrt(u)));o[s]=it(it(l*a)*e[s]),o[(s+1)%n]=it(it(l*m)*e[s])}}}function El(o,e,t,i){let r=e.length,n=i?r:r+1;if(i)for(let s=0;s<n;s++){let a=((s-1+r)%r+r)%r,m=s%r;o[s]=it(it(it(t[a]*e[m])+it(t[m]*e[a]))/it(t[a]+t[m]))}else{o[0]=e[0],o[n-1]=e[r-1];for(let s=1;s<n-1;s++){let a=t[s-1],m=t[s];o[s]=it(it(it(a*e[s])+it(m*e[s-1]))/it(a+m))}}}var ea=class{constructor(){this.h=new Float32Array(0);this.dxSeg=new Float32Array(0);this.dySeg=new Float32Array(0);this.dxTan=new Float32Array(0);this.dyTan=new Float32Array(0);this.path=new ms(10)}fit(e,t,i){if(e!==this.h.length){this.path=new ms(i*10),this.h=new Float32Array(e),this.dxSeg=new Float32Array(e),this.dySeg=new Float32Array(e);let r=t?e:e+1;this.dxTan=new Float32Array(r),this.dyTan=new Float32Array(r)}}},ia=class{constructor(){this.mMonotonic=new ea;this.mSpline=new ea;this.mLinear=new ms(10)}getReturnLength(e,t){let i=3;return i+=t?e*9+1:(e-1)*9,i}getPath(e,t,i,r){switch(i){case Lf:return this.linearPath(e,t,r);case wf:return this.curvePath(e,t,r,this.mMonotonic,!0);default:return this.curvePath(e,t,r,this.mSpline,!1)}}linearPath(e,t,i){let r=e.length;if(this.mLinear.reset(),r===0)return this.mLinear.copyPoints();if(this.mLinear.moveTo(e[0],t[0]),r===1)return this.mLinear.copyPoints();let n=i?r:r-1;for(let s=0;s<n;s++){let a=(s+1)%r;this.mLinear.cubicTo(e[s],t[s],e[a],t[a],e[a],t[a])}return i&&this.mLinear.closePath(),this.mLinear.copyPoints()}curvePath(e,t,i,r,n){let s=e.length,a=i?s:s-1;if(r.fit(a,i,s),r.path.reset(),s===0||(r.path.moveTo(e[0],t[0]),s===1))return r.path.copyPoints();Nf(e,t,a,s,r.h,r.dxSeg,r.dySeg),n?(Al(r.dxTan,r.dxSeg,r.h,i),Al(r.dyTan,r.dySeg,r.h,i)):(El(r.dxTan,r.dxSeg,r.h,i),El(r.dyTan,r.dySeg,r.h,i));for(let m=0;m<a;m++){let u=(m+1)%s,l=r.h[m],h,c,f,d;n?(h=e[m]+r.dxTan[m]*l/3,c=t[m]+r.dyTan[m]*l/3,f=e[u]-r.dxTan[u]*l/3,d=t[u]-r.dyTan[u]*l/3):(h=it(e[m]+it(it(r.dxTan[m]*l)/3)),c=it(t[m]+it(it(r.dyTan[m]*l)/3)),f=it(e[u]-it(it(r.dxTan[u]*l)/3)),d=it(t[u]-it(it(r.dyTan[u]*l)/3))),r.path.cubicTo(h,c,f,d,e[u],t[u])}return i&&r.path.closePath(),r.path.copyPoints()}};var Fl=2**42,us=class o extends D{constructor(t,i,r,n,s,a,m){super();this.mPathGenerator=new ia;this.mId=t,this.mFlags=i,this.mMinBits=r,this.mMaxBits=n,this.mCountBits=s,this.mExprX=a,this.mExprY=m,this.mWinding=(i&o.WINDING_MASK)>>24}static{this.OP_CODE=193}static{this.LOOP=1}static{this.POLAR=8}static{this.WINDING_MASK=50331648}static{this.OFFSET=3211264}static{this.VAR1_ID=3211334}static{this.MOVE_BITS=-8388598}static{this.CUBIC_BITS=-8388594}static{this.CLOSE_BITS=-8388593}write(t){}registerListening(t){let i=s=>{O(s)&&t.listensTo(x(s),this)};i(this.mMinBits),i(this.mMaxBits),i(this.mCountBits);let r=o.OFFSET,n=s=>{if(!O(s))return!1;let a=x(s);return a>r&&a<=r+79||a===o.VAR1_ID||(a&o.ID_REGION_MASK)===o.ID_REGION_ARRAY};for(let s of this.mExprX)O(s)&&!n(s)&&i(s);for(let s of this.mExprY)O(s)&&!n(s)&&i(s)}apply(t){let i=Math.round(this.rv(this.mCountBits,t));if(i<1)return;let r=this.rv(this.mMinBits,t),n=this.rv(this.mMaxBits,t),s=(this.mFlags&o.LOOP)!==0,a=(this.mFlags&o.POLAR)!==0,m=n-r,u=s?m/i:m/(i-1),l=this.resolveExpr(this.mExprX,t),h=this.resolveExpr(this.mExprY,t),c=new Float32Array(i),f=new Float32Array(i),d=t.getCollectionsAccess();if(a){let g=h.length>0?F(h[0]):0,C=h.length>1?F(h[1]):0;for(let y=0;y<i;y++){let I=r+y*u,T=this.evalRPN(l,I,d);c[y]=g+T*Math.cos(I),f[y]=C+T*Math.sin(I)}}else for(let g=0;g<i;g++){let C=r+g*u;c[g]=this.evalRPN(l,C,d),f[g]=this.evalRPN(h,C,d)}let p=this.mFlags&Ml,b=this.mPathGenerator.getPath(c,f,p,s);t.loadPathData(this.mId,this.mWinding,b)}rv(t,i){return O(t)?i.getFloat(x(t)):F(t)}static{this.ID_REGION_MASK=7340032}static{this.ID_REGION_ARRAY=2097152}resolveExpr(t,i){let r=new Int32Array(t.length),n=o.OFFSET;for(let s=0;s<t.length;s++){let a=t[s];if(O(a)){let m=x(a);m>n&&m<=n+79||m===o.VAR1_ID||(m&o.ID_REGION_MASK)===o.ID_REGION_ARRAY?r[s]=a:r[s]=et(i.getFloat(m))}else r[s]=a}return r}evalRPN(t,i,r){let n=[],s=[0,0,0,0],a=-1,m=o.OFFSET,u=l=>l-Fl|0;for(let l=0;l<t.length;l++){let h=t[l];if(O(h)){let c=x(h);if(c===o.VAR1_ID)n[++a]=i;else if((c&o.ID_REGION_MASK)===o.ID_REGION_ARRAY)n[++a]=Fl+c;else if(c>m&&c<=m+79){let f=c-m;switch(f){case 1:a--,n[a]+=n[a+1];break;case 2:a--,n[a]-=n[a+1];break;case 3:a--,n[a]*=n[a+1];break;case 4:a--,n[a]/=n[a+1];break;case 5:a--,n[a]%=n[a+1];break;case 6:a--,n[a]=Math.min(n[a],n[a+1]);break;case 7:a--,n[a]=Math.max(n[a],n[a+1]);break;case 8:a--,n[a]=Math.pow(n[a],n[a+1]);break;case 9:n[a]=Math.sqrt(n[a]);break;case 10:n[a]=Math.abs(n[a]);break;case 11:n[a]=Math.sign(n[a]);break;case 12:a--,n[a]=Math.abs(n[a])*Math.sign(n[a+1]);break;case 13:n[a]=Math.exp(n[a]);break;case 14:n[a]=Math.floor(n[a]);break;case 15:n[a]=Math.log10(n[a]);break;case 16:n[a]=Math.log(n[a]);break;case 17:n[a]=Math.round(n[a]);break;case 18:n[a]=Math.sin(n[a]);break;case 19:n[a]=Math.cos(n[a]);break;case 20:n[a]=Math.tan(n[a]);break;case 21:n[a]=Math.asin(n[a]);break;case 22:n[a]=Math.acos(n[a]);break;case 23:n[a]=Math.atan(n[a]);break;case 24:a--,n[a]=Math.atan2(n[a],n[a+1]);break;case 25:a-=2,n[a]=n[a+2]+n[a+1]*n[a];break;case 26:{let d=n[a];a-=2,n[a]=d>0?n[a+1]:n[a];break}case 27:a-=2,n[a]=Math.min(Math.max(n[a],n[a+2]),n[a+1]);break;case 28:n[a]=Math.pow(n[a],1/3);break;case 29:n[a]=n[a]*(180/Math.PI);break;case 30:n[a]=n[a]*(Math.PI/180);break;case 31:n[a]=Math.ceil(n[a]);break;case 32:{let d=n[a],p=u(n[a-1]);a--,n[a]=r.getFloatValue(p,Math.trunc(d));break}case 33:{let d=u(n[a]),p=r.getFloats(d),b=0;if(p&&p.length>0){b=p[0];for(let g=1;g<p.length;g++)b=Math.max(b,p[g])}n[a]=b;break}case 34:{let d=u(n[a]),p=r.getFloats(d),b=0;if(p&&p.length>0){b=p[0];for(let g=1;g<p.length;g++)b=Math.min(b,p[g])}n[a]=b;break}case 35:{let d=u(n[a]),p=r.getFloats(d),b=0;if(p)for(let g=0;g<p.length;g++)b+=p[g];n[a]=b;break}case 36:{let d=u(n[a]),p=r.getFloats(d),b=0;if(p&&p.length>0){for(let g=0;g<p.length;g++)b+=p[g];n[a]=b/p.length}else n[a]=0;break}case 37:{let d=u(n[a]);n[a]=r.getListLength(d);break}case 38:{let d=n[a],p=u(n[a-1]),b=r.getFloats(p);a--,n[a]=b?yt.splineInterp(b,d):0;break}case 44:a--,n[a]=n[a]>n[a+1]?1:0;break;case 45:n[a]=n[a]*n[a];break;case 46:n[a+1]=n[a],a++;break;case 47:a--,n[a]=Math.hypot(n[a],n[a+1]);break;case 48:{let d=n[a];n[a]=n[a-1],n[a-1]=d;break}case 49:{let d=n[a];a-=2,n[a]=n[a]+(n[a+1]-n[a])*d;break}case 41:{let d=Math.trunc(n[a]);d=d<<13^d,n[a]=1-(d*(d*d*15731+789221)+1376312589&2147483647)/1073741800;break}case 43:a--,n[a]=n[a]*n[a]+n[a+1]*n[a+1];break;case 50:{let d=n[a-2],p=n[a-1],b=n[a];if(a-=2,d<b)n[a]=0;else if(d>p)n[a]=1;else{let g=(d-b)/(p-b);n[a]=g*g*(3-2*g)}break}case 51:n[a]=Math.log(n[a])/Math.log(2);break;case 54:{let d=n[a]*2,p=n[a-1]%d;a--,n[a]=p<n[a+1]?p:d-p;break}case 55:break;case 56:case 57:case 58:case 59:s[f-56]=n[a],a--;break;case 60:case 61:case 62:case 63:n[++a]=s[f-60];break;case 74:{a-=4,n[a]=yt.cubicEasing(n[a],n[a+1],n[a+2],n[a+3],n[a+4]);break}case 75:{let d=u(n[a-1]),p=n[a]-Math.floor(n[a]),b=r?.getFloats(d);a--,n[a]=b?yt.splineInterp(b,p<0?p+1:p):0;break}case 76:{let d=u(n[a-1]),p=Math.trunc(n[a]),b=0;if(r)for(let g=0;g<=p;g++)b+=r.getFloatValue(d,g);a--,n[a]=b;break}case 77:{let d=r?.getFloats(u(n[a-1])),p=r?.getFloats(u(n[a])),b=0;if(d&&p)for(let g=0;g<d.length;g++)b+=d[g]*p[g];a--,n[a]=b;break}case 78:{let d=r?.getFloats(u(n[a])),p=0;if(d)for(let b=0;b<d.length;b++)p+=d[b]*d[b];n[a]=p;break}case 79:{let d=r?.getFloats(u(n[a-1])),p=n[a];if(a--,d&&d.length){let b=p*(d.length-1),g=Math.trunc(b);n[a]=g<0?d[0]:g>=d.length-1?d[d.length-1]:d[g]+(b-g)*(d[g+1]-d[g])}else n[a]=0;break}case 52:n[a]=1/n[a];break;case 53:n[a]=n[a]-Math.floor(n[a]);break;case 73:n[a]=-n[a];break;default:break}}else n[++a]=F(h)}else n[++a]=F(h)}return a>=0?n[a]:0}deepToString(t){return`${t}PathExpression`}static read(t,i){let r=t.readId(),n=t.readInt(),s=t.readNanIdBits(),a=t.readNanIdBits(),m=t.readNanIdBits(),u=t.readInt(),l=new Int32Array(u);for(let f=0;f<u;f++)l[f]=t.readNanIdBits();let h=t.readInt(),c=new Int32Array(h);for(let f=0;f<h;f++)c[f]=t.readNanIdBits();i.push(new o(r,n,s,a,m,l,c))}};var li=class o{constructor(e=4,t=4){this.mDim0=4;this.mDim1=4;this.mDim0=e,this.mDim1=t,this.mMatrix=new Float32Array(e*t),this.setIdentity()}static{this.sTmpMatrix1=new o}static{this.sTmpMatrix2=new o}static{this.sTempOutVec=null}static{this.sTempInVec=null}setDimensions(e,t){this.mDim0=e,this.mDim1=t,this.mMatrix=new Float32Array(e*t)}setIdentity(){this.mMatrix.fill(0);let e=Math.min(this.mDim0,this.mDim1);for(let t=0;t<e;t++)this.mMatrix[t*this.mDim1+t]=1}copyFromMatrix(e){this.setDimensions(e.mDim0,e.mDim1);for(let t=0;t<this.mMatrix.length;t++)this.mMatrix[t]=e.mMatrix[t]}copyFrom(e){if(e.length===16)for(let t=0;t<16;t++)this.mMatrix[t]=e[t];else e.length===9&&(this.mMatrix[0]=e[0],this.mMatrix[1]=e[1],this.mMatrix[3]=e[2],this.mMatrix[4]=e[3],this.mMatrix[5]=e[4],this.mMatrix[6]=e[5],this.mMatrix[8]=e[6],this.mMatrix[9]=e[7],this.mMatrix[10]=e[8],this.mMatrix[11]=0,this.mMatrix[12]=0,this.mMatrix[13]=0,this.mMatrix[14]=0,this.mMatrix[15]=1)}get(e,t){return this.mMatrix[e*this.mDim1+t]}set(e,t,i){this.mMatrix[e*this.mDim1+t]=i}putValues(e){for(let t=0;t<e.length;t++)e[t]=this.mMatrix[t]}static multiply(e,t,i){i.setDimensions(e.mDim0,t.mDim1);for(let r=0;r<i.mDim0;r++)for(let n=0;n<i.mDim1;n++){let s=0;for(let a=0;a<e.mDim1;a++)s+=e.mMatrix[r*e.mDim1+a]*t.mMatrix[a*t.mDim1+n];i.mMatrix[r*i.mDim1+n]=s}}static copy(e,t){t.setDimensions(e.mDim0,e.mDim1);for(let i=0;i<e.mMatrix.length;i++)t.mMatrix[i]=e.mMatrix[i]}rotateX(e){let t=e*Math.PI/180,i=Math.cos(t),r=Math.sin(t),n=o.sTmpMatrix1,s=o.sTmpMatrix2;n.setIdentity(),n.set(1,1,i),n.set(1,2,-r),n.set(2,1,r),n.set(2,2,i),o.multiply(this,n,s),this.copyFromMatrix(s)}rotateY(e){let t=e*Math.PI/180,i=Math.cos(t),r=Math.sin(t),n=o.sTmpMatrix1,s=o.sTmpMatrix2;n.setIdentity(),n.set(0,0,i),n.set(0,2,r),n.set(2,0,-r),n.set(2,2,i),o.multiply(this,n,s),this.copyFromMatrix(s)}rotateZ(e,t,i){if(t!==void 0&&i!==void 0){this.rotateZWithPivot(e,t,i);return}let n=e*Math.PI/180,s=Math.cos(n),a=Math.sin(n),m=o.sTmpMatrix1,u=o.sTmpMatrix2;m.setIdentity(),m.set(0,0,s),m.set(0,1,-a),m.set(1,0,a),m.set(1,1,s),o.multiply(this,m,u),this.copyFromMatrix(u)}rotateZWithPivot(e,t,i){let r=i*Math.PI/180,n=Math.cos(r),s=Math.sin(r),a=1-n,m=e*a+t*s,u=t*a-e*s,l=new Float32Array(16);for(let h=0;h<4;h++)for(let c=0;c<4;c++){let f=0;for(let d=0;d<4;d++){let p;h===0?d===0?p=n:d===1?p=-s:d===3?p=m:p=0:h===1?d===0?p=s:d===1?p=n:d===3?p=u:p=0:h===2?p=d===2?1:0:p=d===3?1:0,f+=p*this.mMatrix[d*4+c]}l[h*4+c]=f}this.mMatrix.set(l)}translate(e,t,i){let r=o.sTmpMatrix1,n=o.sTmpMatrix2;r.setIdentity(),r.set(0,3,e),r.set(1,3,t),r.set(2,3,i),o.multiply(this,r,n),this.copyFromMatrix(n)}setScale(e,t,i){this.mMatrix[0*this.mDim1+0]*=e,this.mMatrix[1*this.mDim1+1]*=t,this.mMatrix[2*this.mDim1+2]*=i}projection(e,t,i,r){let n=o.sTmpMatrix1,s=o.sTmpMatrix2,a=n.mMatrix,m=e*Math.PI/180,u=1/Math.tan(m/2),l=1/(i-r);a[0]=u/t,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=u,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=(r+i)*l,a[11]=-1,a[12]=0,a[13]=0,a[14]=2*r*i*l,a[15]=0,o.multiply(this,n,s),this.copyFromMatrix(s)}rotateAroundAxis(e,t,i,r){let n=r*Math.PI/180,s=e*e+t*t+i*i;if(s===0)return;let a=Math.sqrt(s),m=e/a,u=t/a,l=i/a,h=Math.cos(n),c=Math.sin(n),f=1-h,d=h+m*m*f,p=m*u*f-l*c,b=m*l*f+u*c,g=u*m*f+l*c,C=h+u*u*f,y=u*l*f-m*c,I=l*m*f-u*c,T=l*u*f+m*c,v=h+l*l*f,_=new Float32Array(16);for(let P=0;P<4;P++)for(let E=0;E<4;E++){let L=0;for(let V=0;V<4;V++){let B;P===0?B=V===0?d:V===1?p:V===2?b:0:P===1?B=V===0?g:V===1?C:V===2?y:0:P===2?B=V===0?I:V===1?T:V===2?v:0:B=V===3?1:0,L+=B*this.mMatrix[V*4+E]}_[P*4+E]=L}this.mMatrix.set(_)}multiplyVec(e,t){for(let i=0;i<t.length;i++){let r=0;for(let n=0;n<e.length;n++)r+=this.mMatrix[n+i*4]*e[n];t[i]=r+this.mMatrix[3+i*4]}}evalPerspective(e,t){o.sTempInVec===null&&(o.sTempInVec=new Float32Array(4),o.sTempOutVec=new Float32Array(4),o.sTempInVec[3]=1);let i=o.sTempInVec,r=o.sTempOutVec;for(let n=0;n<e.length;n++)i[n]=e[n];for(let n=0;n<r.length;n++){let s=0;for(let a=0;a<i.length;a++)s+=this.mMatrix[a+n*4]*i[a];r[n]=s}for(let n=0;n<t.length;n++)r[n]/=r[3];for(let n=0;n<t.length;n++)t[n]=r[n]}};var lt=3276800;function Bt(o){return F(o|-8388608)}function um(o){return et(o)&4194303}var Sl=2097152;function Vf(o){return(um(o)&7340032)===Sl}function Wf(o){return(x(o)&7340032)===Sl}var Er=class o{constructor(){this.mMatrices=[];this.mTmpMatrix=new li;this.mMatrixIndex=-1;this.mStack=[];for(let e=0;e<10;e++)this.mMatrices.push(new li(4,4))}static{this.OFFSET=lt}static{this.LAST_OP=lt+54}static{this.IDENTITY=Bt(lt+1)}static{this.ROT_X=Bt(lt+2)}static{this.ROT_Y=Bt(lt+3)}static{this.ROT_Z=Bt(lt+4)}static{this.TRANSLATE_X=Bt(lt+5)}static{this.TRANSLATE_Y=Bt(lt+6)}static{this.TRANSLATE_Z=Bt(lt+7)}static{this.TRANSLATE2=Bt(lt+8)}static{this.TRANSLATE3=Bt(lt+9)}static{this.SCALE_X=Bt(lt+10)}static{this.SCALE_Y=Bt(lt+11)}static{this.SCALE_Z=Bt(lt+12)}static{this.SCALE2=Bt(lt+13)}static{this.SCALE3=Bt(lt+14)}static{this.MUL=Bt(lt+15)}static{this.ROT_PZ=Bt(lt+16)}static{this.ROT_AXIS=Bt(lt+17)}static{this.PROJECTION=Bt(lt+18)}static{this.OP_IDENTITY=lt+1}static{this.OP_ROT_X=lt+2}static{this.OP_ROT_Y=lt+3}static{this.OP_ROT_Z=lt+4}static{this.OP_TRANSLATE_X=lt+5}static{this.OP_TRANSLATE_Y=lt+6}static{this.OP_TRANSLATE_Z=lt+7}static{this.OP_TRANSLATE2=lt+8}static{this.OP_TRANSLATE3=lt+9}static{this.OP_SCALE_X=lt+10}static{this.OP_SCALE_Y=lt+11}static{this.OP_SCALE_Z=lt+12}static{this.OP_SCALE2=lt+13}static{this.OP_SCALE3=lt+14}static{this.OP_MUL=lt+15}static{this.OP_ROT_PZ=lt+16}static{this.OP_ROT_AXIS=lt+17}static{this.OP_PROJECTION=lt+18}static isOperator(e){if(Number.isNaN(e)){if(Vf(e))return!1;let t=um(e);return t>lt&&t<=o.LAST_OP}return!1}static isOperatorBits(e){if(O(e)){if(Wf(e))return!1;let t=x(e);return t>lt&&t<=o.LAST_OP}return!1}eval(e){if(!e)return this.mMatrices[0].setIdentity(),this.mMatrices[0];this.mStack=e,this.mMatrixIndex=0,this.mMatrices[0].setIdentity();for(let t=0;t<e.length;t++){let i=e[t];Number.isNaN(i)&&this.opEval(t,um(i))}return this.mMatrices[0]}evalBits(e){if(!e)return this.mMatrices[0].setIdentity(),this.mMatrices[0];let t=new Float32Array(e.length);for(let i=0;i<e.length;i++)t[i]=F(e[i]);this.mStack=t,this.mMatrixIndex=0,this.mMatrices[0].setIdentity();for(let i=0;i<e.length;i++)O(e[i])&&this.opEval(i,x(e[i]));return this.mMatrices[0]}opEval(e,t){let i=this.mStack,r=this.mMatrices;switch(t){case o.OP_IDENTITY:r[++this.mMatrixIndex].setIdentity();return;case o.OP_ROT_X:r[this.mMatrixIndex].rotateX(i[e-1]);return;case o.OP_ROT_Y:r[this.mMatrixIndex].rotateY(i[e-1]);return;case o.OP_ROT_Z:r[this.mMatrixIndex].rotateZ(i[e-1]);return;case o.OP_TRANSLATE_X:r[this.mMatrixIndex].translate(i[e-1],0,0);return;case o.OP_TRANSLATE_Y:r[this.mMatrixIndex].translate(0,i[e-1],0);return;case o.OP_TRANSLATE_Z:r[this.mMatrixIndex].translate(0,0,i[e-1]);return;case o.OP_TRANSLATE2:r[this.mMatrixIndex].translate(i[e-2],i[e-1],0);return;case o.OP_TRANSLATE3:r[this.mMatrixIndex].translate(i[e-3],i[e-2],i[e-1]);return;case o.OP_SCALE_X:r[this.mMatrixIndex].setScale(i[e-1],1,1);return;case o.OP_SCALE_Y:r[this.mMatrixIndex].setScale(1,i[e-1],1);return;case o.OP_SCALE_Z:r[this.mMatrixIndex].setScale(1,1,i[e-1]);return;case o.OP_SCALE2:r[this.mMatrixIndex].setScale(i[e-2],i[e-1],0);return;case o.OP_SCALE3:r[this.mMatrixIndex].setScale(i[e-3],i[e-2],i[e-1]);return;case o.OP_MUL:li.multiply(r[this.mMatrixIndex-1],r[this.mMatrixIndex],this.mTmpMatrix),r[this.mMatrixIndex-1].copyFromMatrix(this.mTmpMatrix),this.mMatrixIndex--;return;case o.OP_ROT_PZ:r[this.mMatrixIndex].rotateZ(i[e-2],i[e-1],i[e-3]);return;case o.OP_ROT_AXIS:r[this.mMatrixIndex].rotateAroundAxis(i[e-3],i[e-2],i[e-1],i[e-4]);return;case o.OP_PROJECTION:r[this.mMatrixIndex].projection(i[e-4],i[e-3],i[e-2],i[e-1]);return}}};var ls=class o extends D{constructor(t,i,r){super();this.mValues=new Float32Array(16);this.mOutBits=null;this.mMatrixOperations=new Er;this.mMatrixId=t,this.mType=i,this.mBits=r}static{this.OP_CODE=187}write(t){}registerListening(t){for(let i of this.mBits)O(i)&&!Er.isOperatorBits(i)&&t.listensTo(x(i),this)}updateVariables(t){(this.mOutBits===null||this.mOutBits.length!==this.mBits.length)&&(this.mOutBits=new Int32Array(this.mBits.length));for(let i=0;i<this.mBits.length;i++){let r=this.mBits[i];O(r)&&!Er.isOperatorBits(r)?this.mOutBits[i]=et(t.getFloat(x(r))):this.mOutBits[i]=r}}apply(t){this.mMatrixOperations.evalBits(this.mOutBits).putValues(this.mValues),t.putObject(this.mMatrixId,this),t.loadFloat(this.mMatrixId,performance.now()*1e6)}getValues(){return this.mValues}deepToString(t){return`${t}MatrixExpression(${this.mMatrixId})`}static read(t,i){let r=t.getRemapContext?.(),n=t.readId(),s=t.readInt(),a=t.readInt();if(a>32||a<0)throw new Error(`Invalid matrix expression length ${a}`);let m=new Int32Array(a);for(let u=0;u<a;u++){let l=t.readInt();m[u]=r&&Wr(l,!0)?r.resolveNanIdBits(l):l}i.push(new o(n,s,m))}};var hs=class o extends D{static{this.OP_CODE=186}constructor(e,t,i){super(),this.mMatrixId=e,this.mType=t,this.mValues=i}write(e){}apply(e){e.putObject(this.mMatrixId,this)}getValues(){return this.mValues}deepToString(e){return`${e}MatrixConstant(${this.mMatrixId})`}static read(e,t){let i=e.readId(),r=e.readInt(),n=e.readInt();if(n>16||n<0)throw new Error(`Invalid matrix length ${n}`);let s=new Float32Array(n);for(let a=0;a<n;a++)s[a]=F(e.readNanIdBits());t.push(new o(i,r,s))}};var cs=class o extends D{constructor(t,i,r,n){super();this.mMatrix=new li;this.mType=t,this.mMatrixId=r,this.mOutputs=i,this.mOutInputs=new Float32Array(n.length),this.mInputBits=n,this.mTempOut=new Float32Array(i.length)}static{this.OP_CODE=188}write(t){}registerListening(t){t.listensTo(this.mMatrixId,this);for(let i of this.mInputBits)O(i)&&t.listensTo(x(i),this)}updateVariables(t){for(let i=0;i<this.mInputBits.length;i++){let r=this.mInputBits[i];this.mOutInputs[i]=O(r)?t.getFloat(x(r)):F(r)}}apply(t){let i=t.getObject(this.mMatrixId);if(!i)return;let r=i.getValues?i.getValues():i.mValues;if(r){this.mMatrix.copyFrom(r),this.mType===0?this.mMatrix.multiplyVec(this.mOutInputs,this.mTempOut):this.mMatrix.evalPerspective(this.mOutInputs,this.mTempOut);for(let n=0;n<this.mOutputs.length;n++)t.loadFloat(this.mOutputs[n],this.mTempOut[n])}}deepToString(t){return`${t}MatrixVectorMath(matrix=${this.mMatrixId})`}static read(t,i){let r=t.readShort(),n=t.readId(),s=t.readInt();if(s>4||s<1)throw new Error(`Invalid output length ${s}`);let a=new Int32Array(s);for(let l=0;l<s;l++)a[l]=t.readId();let m=t.readInt();if(m>4||m<1)throw new Error(`Invalid input length ${m}`);let u=new Int32Array(m);for(let l=0;l<m;l++)u[l]=t.readNanIdBits();i.push(new o(r,a,n,u))}};var Pl=o=>/\s/.test(o),ds=class o extends D{static{this.OP_CODE=199}static{this.TEXT_TO_LOWERCASE=1}static{this.TEXT_TO_UPPERCASE=2}static{this.TEXT_TRIM=3}static{this.TEXT_CAPITALIZE=4}static{this.TEXT_UPPERCASE_FIRST_CHAR=5}constructor(e,t,i,r,n){super(),this.mTextId=e,this.mSrcId1=t,this.mStartBits=i,this.mLenBits=r,this.mOperation=n,this.mOutStart=O(i)?0:F(i),this.mOutLen=O(r)?-1:F(r)}write(e){e.start(o.OP_CODE),e.writeInt(this.mTextId),e.writeInt(this.mSrcId1),e.writeInt(this.mStartBits),e.writeInt(this.mLenBits),e.writeInt(this.mOperation)}registerListening(e){e.listensTo(this.mSrcId1,this),O(this.mStartBits)&&e.listensTo(x(this.mStartBits),this),O(this.mLenBits)&&e.listensTo(x(this.mLenBits),this)}updateVariables(e){O(this.mStartBits)&&(this.mOutStart=e.getFloat(x(this.mStartBits))),O(this.mLenBits)&&(this.mOutLen=e.getFloat(x(this.mLenBits)))}apply(e){let t=e.getText(this.mSrcId1)||"",i=Math.max(0,Math.min(Math.trunc(this.mOutStart),t.length)),r=this.mOutLen===-1?t.substring(i):t.substring(i,Math.min(t.length,i+Math.trunc(this.mOutLen)));switch(this.mOperation){case o.TEXT_TO_LOWERCASE:r=r.toLowerCase();break;case o.TEXT_TO_UPPERCASE:r=r.toUpperCase();break;case o.TEXT_TRIM:r=r.trim();break;case o.TEXT_CAPITALIZE:r=o.capitalizeWords(r);break;case o.TEXT_UPPERCASE_FIRST_CHAR:r=o.capitalizeFirstWord(r);break}e.loadText(this.mTextId,r)}static capitalizeWords(e){let t="",i=!0;for(let r of e)Pl(r)?(i=!0,t+=r):i?(t+=r.toUpperCase(),i=!1):t+=r;return t}static capitalizeFirstWord(e){for(let t=0;t<e.length;t++)if(!Pl(e[t]))return e.substring(0,t)+e[t].toUpperCase()+e.substring(t+1);return e}deepToString(e){return`${e}TextTransform[${this.mTextId}] = [${this.mSrcId1}] ${this.mOutStart} - ${this.mOutLen} ${this.mOperation}`}static read(e,t){let i=e.declareId(),r=e.readId(),n=e.readNanIdBits(),s=e.readNanIdBits(),a=e.readInt();t.push(new o(i,r,n,s,a))}};var _l=3211264,kf=7340032,Hf=2097152,Uf=80,Gf=32;function Rl(o){if(!O(o))return!1;let e=x(o);return e>_l&&e<=_l+79?!1:(e&kf)!==Hf}function Yf(o){return typeof o.updateVariables=="function"}var tr=class o extends D{constructor(t,i){super();this.mList=[];this.mExecutionDepth=0;this.mId=t,this.mFloatVarId=i}static{this.OP_CODE=168}static{this.MAX_EXECUTION_DEPTH=16}getList(){return this.mList}getArgs(){return this.mFloatVarId}updateVariables(t){}registerListening(t){t.putObject(this.mId,this)}apply(t){}execute(t){if(this.mExecutionDepth>=o.MAX_EXECUTION_DEPTH)throw new Error("Recursion not allowed");this.mExecutionDepth++;try{for(let i of this.mList)Yf(i)&&i.updateVariables(t),t.incrementOpCount(i),i.apply(t)}finally{this.mExecutionDepth--}}write(t){t.start(o.OP_CODE),t.writeInt(this.mId),t.writeInt(this.mFloatVarId.length);for(let i of this.mFloatVarId)t.writeInt(i)}deepToString(t){let i=`${t}FloatFunctionDefine[${this.mId}] (${this.mFloatVarId.map(r=>`[${r}]`).join(" ")})`;for(let r of this.mList)i+=`
|
|
75
|
+
`+r.deepToString(t+" ");return i}static read(t,i){let r=t.readId(),n=t.readInt();if(n>Gf)throw new Error("Too many arguments");let s=[];for(let a=0;a<n;a++)s.push(t.readId());i.push(new o(r,s))}},ps=class o extends Z{constructor(t,i){super();this.mFunction=null;this.mId=t,this.mArgs=i,this.mOutArgs=new Float32Array(i.length);for(let r=0;r<i.length;r++)this.mOutArgs[r]=F(i[r])}static{this.OP_CODE=166}updateVariables(t){for(let i=0;i<this.mArgs.length;i++){let r=this.mArgs[i];this.mOutArgs[i]=Rl(r)?t.getFloat(x(r)):F(r)}}registerListening(t){let i=t.getObject(this.mId);this.mFunction=i instanceof tr?i:null;for(let r of this.mArgs)Rl(r)&&t.listensTo(x(r),this)}paint(t){let i=t.getContext();if(!this.mFunction){let s=i.getObject(this.mId);if(!(s instanceof tr))return;this.mFunction=s}let r=this.mFunction.getArgs();this.updateVariables(i);let n=Math.min(r.length,this.mOutArgs.length);for(let s=0;s<n;s++)i.loadFloat(r[s],this.mOutArgs[s]);this.mFunction.execute(i)}write(t){t.start(o.OP_CODE),t.writeInt(this.mId),t.writeInt(this.mArgs.length);for(let i of this.mArgs)t.writeInt(i)}deepToString(t){return`${t}callFunction[${this.mId}] ${Array.from(this.mOutArgs).join(", ")}`}static read(t,i){let r=t.readId(),n=t.readInt();if(n>Uf)throw new Error(`array too big ${n}`);let s=new Int32Array(n);for(let a=0;a<n;a++)s[a]=t.readNanIdBits();i.push(new o(r,s))}};var fs=class o extends D{static{this.OP_CODE=151}constructor(e,t,i){super(),this.mTextId=e,this.mDataSetId=t,this.mIndexBits=i,this.mOutIndex=O(i)?0:F(i)}write(e){}registerListening(e){O(this.mIndexBits)&&e.listensTo(x(this.mIndexBits),this)}updateVariables(e){O(this.mIndexBits)&&(this.mOutIndex=e.getFloat(x(this.mIndexBits)))}apply(e){O(this.mIndexBits)&&(this.mOutIndex=e.getFloat(x(this.mIndexBits)));let t=e.getCollectionsAccess().getId(this.mDataSetId,Math.trunc(this.mOutIndex));if(t>=0){let i=e.getText(t);i!==null&&e.loadText(this.mTextId,i)}}deepToString(e){return`${e}TextLookup(textId=${this.mTextId}, dataSet=${this.mDataSetId}, index=${this.mOutIndex})`}static read(e,t){let i=e.declareId(),r=e.readId(),n=e.readNanIdBits();t.push(new o(i,r,n))}};var gs=class o extends D{constructor(t,i,r){super();this.mOutIndex=0;this.mTextId=t,this.mDataSetId=i,this.mIndexId=r}static{this.OP_CODE=153}write(t){}registerListening(t){t.listensTo(this.mIndexId,this)}updateVariables(t){this.mOutIndex=t.getInteger(this.mIndexId)}apply(t){this.mOutIndex=t.getInteger(this.mIndexId);let i=t.getCollectionsAccess().getId(this.mDataSetId,Math.trunc(this.mOutIndex));if(i>=0){let r=t.getText(i);r!==null&&t.loadText(this.mTextId,r)}}deepToString(t){return`${t}TextLookupInt(textId=${this.mTextId}, dataSet=${this.mDataSetId}, indexId=${this.mIndexId})`}static read(t,i){let r=t.readInt(),n=t.readInt(),s=t.readInt();i.push(new o(r,n,s))}};var er=class o extends D{constructor(t,i,r,n,s,a){super();this.mCurrentTheme=-1;this.mId=t,this.mColorGroupId=i,this.mLightModeIndex=r,this.mDarkModeIndex=n,this.mLightModeFallback=s,this.mDarkModeFallback=a,this.mDarkMode=a,this.mLightMode=s}static{this.OP_CODE=196}static{this.THEME_LIGHT=-3}static{this.THEME_DARK=-2}write(t){}setTheme(t,i){this.mCurrentTheme=i,i===o.THEME_LIGHT?t.loadColor(this.mId,this.mLightMode):t.loadColor(this.mId,this.mDarkMode)}apply(t){this.setTheme(t,t.getPaintTheme())}deepToString(t){return`${t}ColorTheme(${this.mId}, light=0x${(this.mLightModeFallback>>>0).toString(16)}, dark=0x${(this.mDarkModeFallback>>>0).toString(16)})`}static read(t,i){let r=t.readId(),n=t.readId(),s=t.readShort(),a=t.readShort(),m=t.readInt(),u=t.readInt();i.push(new o(r,n,s,a,m,u))}};var bs=class o extends D{static{this.OP_CODE=180}static{this.COLOR_HUE=0}static{this.COLOR_SATURATION=1}static{this.COLOR_BRIGHTNESS=2}static{this.COLOR_RED=3}static{this.COLOR_GREEN=4}static{this.COLOR_BLUE=5}static{this.COLOR_ALPHA=6}constructor(e,t,i){super(),this.mOutputId=e,this.mColorId=t,this.mType=i}write(e){}registerListening(e){e.listensTo(this.mColorId,this)}apply(e){let t=e.getColor(this.mColorId),i=(t>>24&255)/255,r=(t>>16&255)/255,n=(t>>8&255)/255,s=(t&255)/255,a=0;switch(this.mType){case o.COLOR_RED:a=r;break;case o.COLOR_GREEN:a=n;break;case o.COLOR_BLUE:a=s;break;case o.COLOR_ALPHA:a=i;break;case o.COLOR_HUE:case o.COLOR_SATURATION:case o.COLOR_BRIGHTNESS:{let m=Math.max(r,n,s),u=Math.min(r,n,s),l=m-u;if(this.mType===o.COLOR_BRIGHTNESS){a=m;break}if(this.mType===o.COLOR_SATURATION){a=m===0?0:l/m;break}l===0?a=0:m===r?a=(n-s)/l%6/6:m===n?a=((s-r)/l+2)/6:a=((r-n)/l+4)/6,a<0&&(a+=1);break}}e.loadFloat(this.mOutputId,a)}deepToString(e){return`${e}ColorAttribute(${this.mOutputId})`}static read(e,t){let i=e.readId(),r=e.readId(),n=e.readShort();t.push(new o(i,r,n))}};var ys=class o extends D{constructor(t,i,r,n){super();this.mOutputId=t;this.mImageId=i;this.mType=r;this.mArgs=n}static{this.OP_CODE=171}static{this.IMAGE_WIDTH=0}static{this.IMAGE_HEIGHT=1}write(t){}apply(t){let i=t.getObject(this.mImageId);if(!(i instanceof oe))return;let r;switch(this.mType){case o.IMAGE_WIDTH:r=i.getWidth();break;case o.IMAGE_HEIGHT:r=i.getHeight();break;default:throw new Error(`Unknown image attribute ${this.mType}`)}t.loadFloat(this.mOutputId,r)}deepToString(t){return`${t}ImageAttribute(${this.mOutputId}, ${this.mImageId}, ${this.mType}, [${this.mArgs.join(", ")}])`}static read(t,i){let r=t.readInt(),n=t.readInt(),s=t.readShort(),a=t.readShort()&65535,m=Array.from({length:a},()=>t.readInt());i.push(new o(r,n,s,m))}};var Xf=0,$f=1,zf=2,jf=3,Kf=4,Is=class o extends D{static{this.OP_CODE=154}constructor(e,t,i){super(),this.mId=e,this.mMapId=t,this.mStringId=i}write(e){}apply(e){let t=e.getText(this.mStringId);if(!t)return;let i=e.getDataMap(this.mMapId);if(!i)return;let r=i.getPos(t);if(r<0)return;let n=i.mTypes[r],s=i.mIds[r];switch(n){case Xf:{let a=e.getText(s);a!==null&&e.loadText(this.mId,a);break}case $f:e.loadInteger(this.mId,e.getInteger(s));break;case zf:e.loadFloat(this.mId,e.getFloat(s));break;case jf:e.loadInteger(this.mId,e.getLong(s)|0);break;case Kf:e.loadInteger(this.mId,e.getInteger(s)?1:0);break}}deepToString(e){return`${e}DataMapLookup(${this.mId}, map=${this.mMapId}, key=${this.mStringId})`}static read(e,t){let i=e.readId(),r=e.readId(),n=e.readId();t.push(new o(i,r,n))}};var qf=0,Zf=1,Qf=2,Jf=3,tg=4,eg=5,Cs=class o extends Z{constructor(t,i,r){super();this.mBounds=new Float32Array(4);this.mId=t,this.mTextId=i,this.mType=r}static{this.OP_CODE=155}write(t){}paint(t){let i=this.mType&255,r=this.mType>>8;t.getTextBounds(this.mTextId,0,-1,r,this.mBounds);let n;switch(i){case qf:n=this.mBounds[2]-this.mBounds[0];break;case Zf:n=this.mBounds[3]-this.mBounds[1];break;case Qf:n=this.mBounds[0];break;case Jf:n=this.mBounds[2];break;case tg:n=this.mBounds[1];break;case eg:n=this.mBounds[3];break}n!==void 0&&t.getContext().loadFloat(this.mId,n)}static read(t,i){let r=t.declareId(),n=t.readId(),s=t.readInt();i.push(new o(r,n,s))}};var ig=0,rg=1,ng=2,sg=3,og=4,Bl=5,ag=6,vs=class o extends Z{constructor(t,i,r){super();this.mBounds=new Float32Array(4);this.mId=t,this.mTextId=i,this.mType=r}static{this.OP_CODE=170}write(t){}paint(t){let i=this.mType&255,r=this.mType>>8;i<=Bl&&t.getTextBounds(this.mTextId,0,-1,r,this.mBounds);let n=0;switch(i){case ig:n=this.mBounds[2]-this.mBounds[0];break;case rg:n=this.mBounds[3]-this.mBounds[1];break;case ng:n=this.mBounds[0];break;case sg:n=this.mBounds[2];break;case og:n=this.mBounds[1];break;case Bl:n=this.mBounds[3];break;case ag:{let s=t.getText(this.mTextId);n=s?s.length:0;break}}t.getContext().loadFloat(this.mId,n)}static read(t,i){let r=t.readId(),n=t.readId(),s=t.readShort();t.readShort(),i.push(new o(r,n,s))}};var Ts=class o extends D{static{this.OP_CODE=156}constructor(e,t){super(),this.mLengthId=e,this.mTextId=t}write(e){}apply(e){let t=e.getText(this.mTextId);e.loadFloat(this.mLengthId,t?t.length:0)}deepToString(e){return`${e}TextLength(${this.mLengthId}, ${this.mTextId})`}registerListening(e){e.listensTo(this.mTextId,this)}updateVariables(e){}static read(e,t){let i=e.declareId(),r=e.readId();t.push(new o(i,r))}};var Os=class o extends D{static{this.OP_CODE=182}constructor(e,t,i,r){super(),this.mTextId=e,this.mSrcId=t,this.mStartBits=i,this.mLenBits=r,this.mOutStart=O(i)?0:F(i),this.mOutLen=O(r)?0:F(r)}write(e){}apply(e){let t=e.getText(this.mSrcId);if(!t){e.loadText(this.mTextId,"");return}let i=Math.max(0,Math.min(Math.floor(this.mOutStart),t.length)),r;if(this.mOutLen===-1)r=t.substring(i);else{let n=Math.min(i+Math.floor(this.mOutLen),t.length);r=t.substring(i,n)}e.loadText(this.mTextId,r)}deepToString(e){return`${e}TextSubtext(${this.mTextId}, ${this.mSrcId}, ${this.mOutStart}, ${this.mOutLen})`}registerListening(e){e.listensTo(this.mSrcId,this),O(this.mStartBits)&&e.listensTo(x(this.mStartBits),this),O(this.mLenBits)&&e.listensTo(x(this.mLenBits),this)}updateVariables(e){O(this.mStartBits)&&(this.mOutStart=e.getFloat(x(this.mStartBits))),O(this.mLenBits)&&(this.mOutLen=e.getFloat(x(this.mLenBits)))}static read(e,t){let i=e.declareId(),r=e.readId(),n=e.readNanIdBits(),s=e.readNanIdBits();t.push(new o(i,r,n,s))}};var xs=3211264,mg=7340032,ug=2097152;function hm(o){if(!O(o))return!1;let e=x(o);return e>xs&&e<=xs+79}function cm(o){return O(o)?(x(o)&mg)===ug:!1}var dm=o=>(o|4286578688)>>>0,lg=dm(xs+64)|0,hg=dm(xs+65)|0,Dl=dm(xs+55)|0;function lm(o,e,t,i,r){let n=new Int32Array(o.length);for(let s=0;s<o.length;s++){let a=o[s];if(n[s]=O(a)&&!hm(a)&&!cm(a)?et(e.getFloat(x(a))):a,!(s+1>=o.length))for(let m=0;m<t.length;m++)!O(a)||x(a)!==t[m]||(o[s+1]===lg?(n[s]=et(i[m]),n[s+1]=Dl,s++):o[s+1]===hg&&(n[s]=et(r[m]),n[s+1]=Dl,s++))}return n}function As(o,e){let t=new Int32Array(o.length);for(let i=0;i<o.length;i++){let r=o[i];O(r)&&!hm(r)&&!cm(r)?t[i]=et(e.getFloat(x(r))):t[i]=r}return t}function Mr(o,e,t){for(let i=0;i<o.length;i++){let r=o[i];O(r)&&!hm(r)&&!cm(r)&&e.listensTo(x(r),t)}}var ir=class o extends D{constructor(t,i,r,n){super();this.mInitialized=!1;this.mContext=null;this.mId=t,this.mParticleCount=i,this.mVarId=r,this.mEquations=n,this.mOutEquations=n.map(s=>new Int32Array(s)),this.mParticles=[];for(let s=0;s<i;s++)this.mParticles.push(new Array(r.length).fill(0))}static{this.OP_CODE=161}write(t){}registerListening(t){t.putObject(this.mId,this);for(let i of this.mEquations)Mr(i,t,this)}updateVariables(t){this.mContext=t;for(let i=0;i<this.mEquations.length;i++)this.mOutEquations[i]=As(this.mEquations[i],t)}apply(t){if(t.mMode==="PAINT"&&!this.mInitialized){this.mContext=t;for(let i=0;i<this.mParticleCount;i++)this.initializeParticle(i,t);this.mInitialized=!0}}initializeParticle(t,i){let r=this.mVarId.length;for(let n=0;n<r;n++)this.mParticles[t][n]=yt.evalRPN(i,this.mOutEquations[n],[t,0,0])}getParticles(){return this.mParticles}getVariableIds(){return this.mVarId}deepToString(t){return`${t}ParticlesCreateOp(id=${this.mId}, count=${this.mParticleCount}, vars=${this.mVarId.length})`}static read(t,i){let r=t.getRemapContext?.(),n=h=>r&&Wr(h)?r.resolveNanIdBits(h):h,s=t.readId(),a=t.readInt(),m=t.readInt(),u=[],l=[];for(let h=0;h<m;h++){u.push(t.readId());let c=t.readInt(),f=new Int32Array(c);for(let d=0;d<c;d++)f[d]=n(t.readInt());l.push(f)}i.push(new o(s,a,u,l))}},Es=class o extends Z{constructor(t,i,r){super();this.mList=[];this.mSource=null;this.mId=t,this.mRestart=i,this.mOutRestart=new Int32Array(i),this.mEquations=r,this.mOutEquations=r.map(n=>new Int32Array(n))}static{this.OP_CODE=163}getList(){return this.mList}write(t){}registerListening(t){Mr(this.mRestart,t,this);for(let i of this.mEquations)Mr(i,t,this)}updateVariables(t){this.mOutRestart=As(this.mRestart,t);for(let i=0;i<this.mEquations.length;i++)this.mOutEquations[i]=As(this.mEquations[i],t)}paint(t){let i=t.getContext();if(i.mMode!=="PAINT")return;if(!this.mSource){let m=i.getObject(this.mId);if(m instanceof ir)this.mSource=m;else return}let r=this.mSource,n=r.getParticles(),s=r.getVariableIds(),a=s.length;for(let m=0;m<n.length;m++){for(let l=0;l<a;l++)i.loadFloat(s[l],n[m][l]);this.updateVariables(i);for(let l=0;l<this.mOutEquations.length&&l<a;l++)n[m][l]=yt.evalRPN(i,this.mOutEquations[l]),i.loadFloat(s[l],n[m][l]);if(yt.evalRPN(i,this.mOutRestart)>0){r.initializeParticle(m,i);for(let l=0;l<a;l++)i.loadFloat(s[l],n[m][l]);this.updateVariables(i);for(let l=0;l<this.mOutEquations.length&&l<a;l++)n[m][l]=yt.evalRPN(i,this.mOutEquations[l]),i.loadFloat(s[l],n[m][l])}for(let l of this.mList)l.isDirty()&&typeof l.updateVariables=="function"&&(l.markNotDirty(),l.updateVariables(i)),i.incrementOpCount(l),l.apply(i)}i.needsRepaint()}deepToString(t){return`${t}ParticlesLoopOp(id=${this.mId}, children=${this.mList.length})`}static read(t,i){let r=t.getRemapContext?.(),n=h=>r&&Wr(h)?r.resolveNanIdBits(h):h,s=t.readId(),a=t.readInt(),m=new Int32Array(a);for(let h=0;h<a;h++)m[h]=n(t.readInt());let u=t.readInt(),l=[];for(let h=0;h<u;h++){let c=t.readInt(),f=new Int32Array(c);for(let d=0;d<c;d++)f[d]=n(t.readInt());l.push(f)}i.push(new o(s,m,l))}},Ms=class o extends Z{constructor(t,i,r,n,s,a,m){super();this.mList=[];this.mSource=null;this.mId=t,this.mFlags=i,this.mMin=r,this.mMax=n,this.mCondition=s,this.mOutCondition=new Int32Array(s),this.mEquations1=a,this.mOutEquations1=a.map(u=>new Int32Array(u)),this.mEquations2=m}static{this.OP_CODE=194}getList(){return this.mList}write(t){}registerListening(t){Mr(this.mCondition,t,this);for(let i of this.mEquations1)Mr(i,t,this);for(let i of this.mEquations2)Mr(i,t,this)}updateVariables(t){this.mOutCondition=As(this.mCondition,t);for(let i=0;i<this.mEquations1.length;i++)this.mOutEquations1[i]=As(this.mEquations1[i],t)}paint(t){let i=t.getContext();if(i.mMode!=="PAINT")return;if(!this.mSource){let l=i.getObject(this.mId);if(l instanceof ir)this.mSource=l;else return}let r=this.mSource,n=r.getParticles(),s=r.getVariableIds(),a=s.length,m=this.mMin<0?0:Math.min(this.mMin,n.length),u=this.mMax<0?n.length:Math.min(this.mMax,n.length);if(this.mEquations2&&this.mEquations2.length>0){this.paintPairs(i,n,s,a,m,u),i.needsRepaint();return}for(let l=m;l<u;l++){for(let c=0;c<a;c++)i.loadFloat(s[c],n[l][c]);if(this.updateVariables(i),yt.evalRPN(i,this.mOutCondition)>0){for(let c=0;c<this.mOutEquations1.length&&c<a;c++)n[l][c]=yt.evalRPN(i,this.mOutEquations1[c]),i.loadFloat(s[c],n[l][c]);this.runChildren(i)}}i.needsRepaint()}runChildren(t){for(let i of this.mList)typeof i.updateVariables=="function"&&(i.markNotDirty(),i.updateVariables(t)),t.incrementOpCount(i),i.apply(t)}paintPairs(t,i,r,n,s,a){for(let m=s;m<a;m++){let u=i[m];for(let l=m+1;l<a;l++){let h=i[l];for(let p=0;p<n;p++)t.loadFloat(r[p],h[p]);let c=lm(this.mCondition,t,r,h,u);if(t.incrementOpCount(this),!(yt.evalRPN(t,c)>0))continue;let f=this.mEquations1.map(p=>lm(p,t,r,h,u));for(let p=0;p<n;p++)t.loadFloat(r[p],u[p]);let d=this.mEquations2.map(p=>lm(p,t,r,h,u));for(let p=0;p<f.length&&p<n;p++)h[p]=yt.evalRPN(t,f[p]),t.loadFloat(r[p],h[p]);this.runChildren(t),t.incrementOpCount(this);for(let p=0;p<d.length&&p<n;p++)u[p]=yt.evalRPN(t,d[p]),t.loadFloat(r[p],u[p]);this.runChildren(t),t.incrementOpCount(this)}}}deepToString(t){return`${t}ParticlesCompareOp(id=${this.mId}, flags=${this.mFlags})`}static readEquationBits(t){let i=t.readInt(),r=new Int32Array(i);for(let n=0;n<i;n++)r[n]=t.readInt();return r}static read(t,i){let r=t.readId(),n=t.readShort(),s=F(t.readNanIdBits()),a=F(t.readNanIdBits()),m=o.readEquationBits(t),u=t.readInt(),l=[];for(let f=0;f<u;f++)l.push(o.readEquationBits(t));let h=t.readInt(),c=[];for(let f=0;f<h;f++)c.push(o.readEquationBits(t));i.push(new o(r,n,s,a,m,l,c))}};var Fs=class o extends Oe{constructor(t,i,r,n,s){super(t,i,r,n,s);this.mMaxItemsInEachRow=0;this.mMaxLines=0}static{this.OP_CODE=240}hasWeight(t){return t instanceof ct&&t.hasWidthWeight()}segmentComponents(t,i,r,n){let s=[],a=[];s.push(a);let m=0;for(let u of this.mChildrenComponents){let l=0;if(n.get(u).isGone())l=0;else if(this.hasWeight(u)){let h=u.getWidthInModifier();if(h){let c=h.getMin();c!==-1&&(l=c)}}else u.measure(t,0,i,0,r,n),l=n.get(u).getW();l+m>i&&(a=[],s.push(a),m=0),a.push(u),m+=l+this.spacedByPx(t,this.mSpacedBy)}return s}computeWrapSize(t,i,r,n,s,a,m,u,l){for(let p of this.mChildrenComponents)p.needsMeasure()&&p.measure(t,0,r,0,s,u);let h=this.segmentComponents(t,r,s,u),c=new Zi,f=i,d=0;for(let p of h)this.computeWrapSizeForComponents(t,i,r,n,s,a,m,u,c,p),f=Math.max(f,c.getWidth()),d+=c.getHeight();f=Math.min(Math.max(i,f),r),d=Math.min(Math.max(n,d),s),l.setWidth(f),l.setHeight(d)}computeSize(t,i,r,n,s,a){let m=this.segmentComponents(t,r,s,a);for(let u of m){let l=r;for(let h of u)h.measure(t,i,l,n,s,a)}}internalLayoutMeasure(t,i){if(this.mChildrenComponents.length===0)return;let r=i.get(this),n=r.getW()-this.mPaddingLeft-this.mPaddingRight,s=r.getH()-this.mPaddingTop-this.mPaddingBottom,a=this.segmentComponents(t,n,s,i),m=0,u=0,l=0;for(let f of a)l+=this.minIntrinsicHeightForComponents(f);switch(this.mVerticalPositioning){case Oe.CENTER:u=(s-l)/2;break;case Oe.BOTTOM:u=s-l;break}let h=new Zi,c=n;for(let f of a){let d=this.minIntrinsicHeightForComponents(f);this.internalLayoutMeasureForComponents(t,i,f,c,d,m,u,h),u+=h.getHeight()}}write(t){t.start(o.OP_CODE),t.writeInt(this.getComponentId()),t.writeInt(0),t.writeInt(this.mHorizontalPositioning),t.writeInt(this.mVerticalPositioning),t.writeFloat(this.mSpacedBy),t.writeInt(this.mMaxItemsInEachRow),t.writeInt(this.mMaxLines)}apply(t){super.apply(t)}deepToString(t){return`${t}FlowLayout(${this.getComponentId()}, spacing=${this.mSpacedBy})`}static read(t,i){let r=t.declareId(),n=t.declareId(),s=t.readInt(),a=t.readInt(),m=t.readNanIdBits(),u=F(m),l=t.readInt(),h=t.readInt(),c=new o(r,n,s,a,u);c.mSpacedByBits=m,c.mMaxItemsInEachRow=l,c.mMaxLines=h,i.push(c)}};var Ss=class o extends D{constructor(t,i,r,n){super();this.mList=[];this.mIndexId=t,this.mFromBits=i,this.mStepBits=r,this.mUntilBits=n}static{this.OP_CODE=215}getList(){return this.mList}write(t){}apply(t){if(t.mMode==="DATA"){for(let s of this.mList)t.incrementOpCount(s),s.apply(t);return}let i=this.rv(this.mFromBits,t),r=this.rv(this.mStepBits,t),n=this.rv(this.mUntilBits,t);if(!(r<=0||!isFinite(i)||!isFinite(n)||!isFinite(r)))if(this.mIndexId===0)for(let s=i;s<n;s+=r){t.incrementOpCount(this);for(let a of this.mList)t.incrementOpCount(a),a.apply(t)}else for(let s=i;s<n;s+=r){t.loadFloat(this.mIndexId,s),t.incrementOpCount(this);for(let a of this.mList)a.isDirty()&&typeof a.updateVariables=="function"&&a.updateVariables(t),t.incrementOpCount(a),a.apply(t)}}getIndexId(){return this.mIndexId}getFrom(t){return this.rv(this.mFromBits,t)}getStep(t){return this.rv(this.mStepBits,t)}getUntil(t){return this.rv(this.mUntilBits,t)}rv(t,i){return O(t)?i.getFloat(x(t)):F(t)}deepToString(t){return`${t}LoopOperation(${F(this.mFromBits)}..${F(this.mUntilBits)} step ${F(this.mStepBits)})`}static read(t,i){let r=t.readId(),n=t.readNanIdBits(),s=t.readNanIdBits(),a=t.readNanIdBits();i.push(new o(r,n,s,a))}};var Kt=1,hi=2,cg=3,dg=4,ra=5,Nl=6,Vl=7,pg=8,Wl=1,kl=2,Hl=3,Ul=4,Gl=5,Yl=6,Xl=7,$l=8,zl=9,jl=10,Kl=11,ql=12,Zl=13,Ql=14,Jl=15,th=16,eh=17,ih=18,rh=19,nh=20,sh=21,oh=22,ah=23,mh=24,uh=25,lh=26,fg={[Wl]:Kt,[kl]:Kt,[Hl]:Kt,[Ul]:Kt,[Gl]:hi,[Yl]:Kt,[Xl]:hi,[$l]:Kt,[zl]:Kt,[jl]:Kt,[Kl]:Kt,[ql]:hi,[Zl]:hi,[Ql]:hi,[Jl]:Kt,[th]:Kt,[eh]:Kt,[ih]:ra,[rh]:ra,[nh]:Nl,[sh]:Vl,[oh]:ra,[ah]:Kt,[mh]:Kt,[uh]:hi,[lh]:hi},gg=1,bg=2,yg=3,Ig=5,Cg=6,wl=2,Ll=3,vg=4,Tg=5;function Og(o,e,t){for(let i=0;i<e;i++){let r=o.readByte(),n=fg[r];if(n===void 0)throw new Error(`CoreText: unknown param id ${r}`);switch(n){case Kt:t.intValue(r,o.readInt());break;case hi:t.floatValue(r,o.readInt());break;case cg:o.readShort();break;case dg:o.readByte();break;case ra:t.boolValue(r,o.readBoolean());break;case Nl:{let s=o.readShort(),a=[];for(let m=0;m<s;m++)a.push(o.readInt());t.intArrayValue(r,a);break}case Vl:{let s=o.readShort(),a=[];for(let m=0;m<s;m++)a.push(o.readInt());t.floatArrayValue(r,a);break}case pg:o.readUTF8();break}}}var rr=class o extends Mt{constructor(t,i,r,n,s,a,m,u,l,h,c,f,d,p,b,g,C,y,I,T,v,_,P,E,L,V){super(t,i);this.mType=-1;this.mTextX=0;this.mTextY=0;this.mTextW=-1;this.mTextH=-1;this.mBaseline=0;this.mCachedString=null;this.mNewString=null;this.mComputedTextLayout=null;this.mPaint=new ot;this.mLastMeasurePass=null;this.mLastMaxW=-1;this.mLastMaxH=-1;this.mLastSizeW=0;this.mLastSizeH=0;this.mTextId=r,this.mColor=n,this.mColorId=s,this.mIsDynamicColorEnabled=s!==-1,this.mColorValue=this.mIsDynamicColorEnabled?-1:n,this.mFontSize=a,this.mMinFontSize=m,this.mMaxFontSize=u,this.mFontSizeValue=O(a)?36:F(a),this.mMeasureFontSize=this.mFontSizeValue,this.mFontStyle=l,this.mFontWeight=h,this.mFontWeightValue=O(h)?0:F(h),this.mFontFamilyId=c,this.mTextAlign=f,this.mTextAlignValue=f&65535,this.mOverflow=d,this.mMaxLines=p,this.mLetterSpacing=b,this.mLineHeightAdd=g,this.mLineHeightMultiplier=C,this.mLineBreakStrategy=y,this.mHyphenationFrequency=I,this.mJustificationMode=T,this.mUnderline=v,this.mStrikethrough=_,this.mFontAxis=P,this.mFontAxisValues=E,this.mAutosize=L,this.mFlags=V}static{this.OP_CODE=239}registerListening(t){this.mTextId!==-1&&t.listensTo(this.mTextId,this),O(this.mFontSize)&&t.listensTo(x(this.mFontSize),this),O(this.mFontWeight)&&t.listensTo(x(this.mFontWeight),this),this.mIsDynamicColorEnabled&&t.listensTo(this.mColorId,this)}updateVariables(t){this.mFontSizeValue=O(this.mFontSize)?t.getFloat(x(this.mFontSize)):F(this.mFontSize),this.mFontWeightValue=O(this.mFontWeight)?t.getFloat(x(this.mFontWeight)):F(this.mFontWeight),this.mTextAlignValue=this.mTextAlign&65535,this.mColorValue=this.mIsDynamicColorEnabled?t.getColor(this.mColorId):this.mColor;let i=t.getText(this.mTextId);if(i!==null&&i===this.mCachedString&&this.mType!==-1){this.mMeasureFontSize!==this.mFontSizeValue&&this.invalidateMeasure();return}if(this.mNewString=i,this.mType===-1)if(this.mFontFamilyId!==-1){let r=t.getText(this.mFontFamilyId);r!==null&&(r.toLowerCase()==="default"?this.mType=0:r.toLowerCase()==="sans-serif"?this.mType=1:r.toLowerCase()==="serif"?this.mType=2:r.toLowerCase()==="monospace"?this.mType=3:this.mType=this.mFontFamilyId)}else this.mType=0;this.invalidateMeasure()}minIntrinsicHeight(){return this.mTextH}minIntrinsicWidth(){return this.mTextW}computeWrapSize(t,i,r,n,s,a,m,u,l){if(this.mLastMeasurePass===u&&this.mLastMaxW===r&&this.mLastMaxH===s&&!this.mNeedsMeasure&&this.mNewString===null){l.setWidth(this.mLastSizeW),l.setHeight(this.mLastSizeH);return}if(this.mMeasureFontSize=this.mFontSizeValue,t.savePaint(),this.mPaint.reset(),this.mPaint.setTextSize(this.mMeasureFontSize),this.mPaint.setTextStyle(this.mType===-1?0:this.mType,Math.round(this.mFontWeightValue),this.mFontStyle===1),this.mFontAxis&&this.mFontAxis.length>0){let d=this.mFontAxisValues.map(p=>Et(p)?t.getContext().getFloat(x(p)):F(p));this.mPaint.setTextAxis(this.mFontAxis,d)}this.mPaint.setColor(this.mColorValue),t.replacePaint(this.mPaint);let h=new Float32Array(4);if(this.mNewString!==null&&this.mNewString!==this.mCachedString&&(this.mCachedString=this.mNewString),this.mCachedString===null){t.restorePaint();return}if(this.mAutosize){let p=this.mMinFontSize<=0?4:this.mMinFontSize,b=this.mMaxFontSize<=0?400:this.mMaxFontSize,g=p,C=b,y=(g+C)/2;for(;C-g>=.5;){this.mPaint.setTextSize(y),t.replacePaint(this.mPaint),this.textLayout(t,r,s,h,!0,!0);let I=h[3]-h[1],T=h[2]-h[0];I>=s||T>r?C=y:g=y,y=(g+C)/2}if(y=Math.floor((g-p)/.5)*.5+p,y+.5<b){this.mPaint.setTextSize(y+.5),t.replacePaint(this.mPaint),this.textLayout(t,r,s,h,!0,!0);let I=h[3]-h[1],T=h[2]-h[0];I<s&&T<=r&&(y+=.5)}this.mFontSizeValue=y,this.mMeasureFontSize=y,this.mPaint.setTextSize(this.mFontSizeValue),t.replacePaint(this.mPaint),this.textLayout(t,r,s,h,!0,!1)}else this.textLayout(t,r,s,h);t.restorePaint();let c=h[2]-h[0],f=h[3]-h[1];l.setWidth(Math.min(r,c)),this.mTextX=-h[0],l.setHeight(Math.min(s,f)),this.mTextY=-h[1],this.mTextW=c,this.mTextH=f,this.mLastMeasurePass=u,this.mLastMaxW=r,this.mLastMaxH=s,this.mLastSizeW=l.getWidth(),this.mLastSizeH=l.getHeight()}computeSize(t,i,r,n,s,a){super.computeSize(t,i,r,n,s,a);let m=this.mCachedWrapSize;m.clear(),this.computeWrapSize(t,i,r,n,s,!0,!0,a,m);let u=a.get(this);u.setW(m.getWidth()),u.setH(m.getHeight())}textLayout(t,i,r,n,s=!1,a=!1){if(i<0||r<0)return;let m=ee.TEXT_MEASURE_FONT_HEIGHT|ee.TEXT_MEASURE_SPACES,u=s;if((this.mOverflow===vg||this.mOverflow===Tg||this.mOverflow===Ll)&&(m|=ee.TEXT_COMPLEX,u=!0),(this.mLetterSpacing!==0||this.mLineHeightMultiplier!==1||this.mLineHeightAdd>0||this.mUnderline||this.mStrikethrough||this.mJustificationMode>0||this.mLineBreakStrategy>0||this.mHyphenationFrequency>0)&&(m|=ee.TEXT_COMPLEX,u=!0),!(m&ee.TEXT_COMPLEX)&&this.mCachedString)for(let c=0;c<this.mCachedString.length;c++){let f=this.mCachedString.charAt(c);if(f===`
|
|
76
|
+
`||f===" "){m|=ee.TEXT_COMPLEX,u=!0;break}}u||(t.getTextBounds(this.mTextId,0,this.mCachedString.length,m,n),this.mBaseline=-n[1]);let l=this.mAutosize&&(this.mOverflow===1||this.mOverflow===2)&&i>0;if(u||l||n[2]-n[0]>i&&this.mMaxLines>1&&i>0){a&&(m|=1);let c=this.mAutosize&&(this.mOverflow===1||this.mOverflow===2)?2147483647:this.mMaxLines,f=!1;for(;!f;){this.mComputedTextLayout=t.layoutComplexText(this.mTextId,0,this.mCachedString.length,this.mTextAlign,this.mOverflow,c,i,r,this.mLetterSpacing,this.mLineHeightAdd,this.mLineHeightMultiplier,this.mLineBreakStrategy,this.mHyphenationFrequency,this.mJustificationMode,this.mUnderline,this.mStrikethrough,m);let d=this.mComputedTextLayout,p=d?d.naturalHeight??d.height:0;d&&(n[0]=0,n[1]=0,n[2]=d.width,n[3]=p),d&&!a&&p>r&&this.mOverflow===Ll&&typeof d.visibleLines=="number"?(d.visibleLines!==c?c=d.visibleLines:c--,c<1&&(f=!0)):f=!0}}else i>0?this.mComputedTextLayout=null:this.mComputedTextLayout&&(n[0]=0,n[1]=0,n[2]=this.mComputedTextLayout.width,n[3]=this.mComputedTextLayout.height)}paintingComponent(t){let i=t.getContext();t.save(),t.translate(this.mX,this.mY),this.paintModifiers(t);let r=this.mPaddingLeft,n=this.mPaddingTop;if(t.translate(r,n),t.savePaint(),this.mPaint.reset(),this.mPaint.setStyle(ot.FILL),this.mPaint.setColor(this.mColorValue),this.mPaint.setTextSize(this.mMeasureFontSize),this.mPaint.setTextStyle(this.mType===-1?0:this.mType,Math.round(this.mFontWeightValue),this.mFontStyle===1),this.mFontAxis&&this.mFontAxis.length>0){let u=this.mFontAxisValues.map(l=>Et(l)?i.getFloat(x(l)):F(l));this.mPaint.setTextAxis(this.mFontAxis,u)}if(t.replacePaint(this.mPaint),this.mCachedString===null){t.restorePaint(),t.restore();return}let s=this.mCachedString.length,a=this.mWidth-this.mPaddingLeft-this.mPaddingRight,m=this.mHeight-this.mPaddingTop-this.mPaddingBottom;if(this.mComputedTextLayout)this.mOverflow!==wl?(t.save(),t.clipRect(0,0,a,m),t.drawComplexText(this.mComputedTextLayout,a),t.restore()):t.drawComplexText(this.mComputedTextLayout,a);else{let u=this.mTextX;switch(this.mTextAlignValue){case yg:u=(a-this.mTextW)/2;break;case bg:case Cg:u=a-this.mTextW;break;case gg:case Ig:default:break}this.mOverflow!==wl||this.mTextW>a?(t.save(),t.clipRect(0,0,a,m),t.drawTextRun(this.mTextId,0,s,0,0,u,this.mTextY,!1),t.restore()):t.drawTextRun(this.mTextId,0,s,0,0,u,this.mTextY,!1)}t.restorePaint(),t.restore()}write(t){t.start(o.OP_CODE),t.writeInt(this.mTextId),t.writeShort(0)}apply(t){super.apply(t)}deepToString(t){return`${t}CoreText(${this.getComponentId()}, textId=${this.mTextId})`}static read(t,i){let r=t.readId(),n=t.readShort(),s=-1,a=-1,m=-16777216,u=-1,l=0,h=-1,c=1,f=1,d=2147483647,p=0,b=0,g=0,C=0,y=et(36),I=-1,T=-1,v=et(400),_=0,P=0,E=1,L=!1,V=!1,B=!1,U=null,H=null,N=t.getRemapContext?.(),k=$=>N?N.resolveId($):$,Y=$=>N?N.declareId($):$;Og(t,n,{intValue($,w){switch($){case Wl:s=Y(w);break;case kl:a=Y(w);break;case Hl:m=w;break;case Ul:u=k(w);break;case Yl:l=w;break;case $l:h=k(w);break;case zl:c=w;break;case jl:f=w;break;case Kl:d=w;break;case Jl:p=w;break;case th:b=w;break;case eh:g=w;break;case ah:C=w;break;case mh:break}},floatValue($,w){switch($){case Gl:y=w;break;case Xl:v=w;break;case uh:I=F(w);break;case lh:T=F(w);break;case ql:_=F(w);break;case Zl:P=F(w);break;case Ql:E=F(w);break}},boolValue($,w){switch($){case ih:L=w;break;case rh:V=w;break;case oh:B=w;break}},intArrayValue($,w){$===nh&&(U=w)},floatArrayValue($,w){$===sh&&(H=w)}}),i.push(new o(s,a,r,m,u,y,I,T,l,v,h,c,f,d,_,P,E,p,b,g,L,V,U,H,B,C))}};var xg=1,Ps=class o extends rr{static{this.OP_CODE=208}deepToString(e){return`${e}TEXT_LAYOUT [${this.getComponentId()}]`}static read(e,t){let i=e.declareId(),r=e.declareId(),n=e.readId(),s=e.readInt(),a=e.readNanIdBits(),m=e.readInt(),u=e.readNanIdBits(),l=e.readId(),h=e.readInt(),c=e.readInt(),f=e.readInt(),d=(h>>>16&xg)>0;t.push(new o(i,r,n,d?-16777216:s,d?s:-1,a,-1,-1,m,u,l,h,c,f,0,0,1,0,0,0,!1,!1,null,null,!1,0))}};var _s=class o extends Mt{static{this.OP_CODE=176}static{this.START=1}static{this.CENTER=2}static{this.END=3}static{this.TOP=4}static{this.BOTTOM=5}constructor(e,t,i,r){super(e,t),this.mAnimationId=t,this.mHorizontalPositioning=i,this.mVerticalPositioning=r}usePriorityFix(e){let t=e.getContext().getDocument?.();return t?t.useFeature(Ct.FEATURE_PRIORITY_FIX,1):!0}computeWrapSize(e,t,i,r,n,s,a,m,u){if(this.usePriorityFix(e)){this.measurePriorityFix(e,i,n,m,u);return}let l=!1,h=m.get(this);for(let c of this.mChildrenComponents){let[f,d]=o.minConstraints(c);c.measure(e,0,i,0,n,m);let p=m.get(c);!l&&f<=i&&d<=n?(l=!0,p.addVisibilityOverride(tt.OVERRIDE_VISIBLE),u.setWidth(p.getW()),u.setHeight(p.getH())):p.addVisibilityOverride(tt.OVERRIDE_GONE)}h.setVisibility(l?tt.VISIBLE:tt.GONE)}computeSize(e,t,i,r,n,s){if(this.usePriorityFix(e)){this.measurePriorityFix(e,i,n,s,null);return}let a=!1;for(let m of this.mChildrenComponents){let[u,l]=o.minConstraints(m);m.measure(e,t,i,r,n,s);let h=s.get(m);h.clearVisibilityOverride(),!a&&u<=i&&l<=n?(a=!0,h.addVisibilityOverride(tt.OVERRIDE_VISIBLE)):h.addVisibilityOverride(tt.OVERRIDE_GONE)}}static minConstraints(e){let t=0,i=0;if(e instanceof ct){let r=e.getWidthInModifier();r&&(t=r.getMin());let n=e.getHeightInModifier();n&&(i=n.getMin())}return[t,i]}measurePriorityFix(e,t,i,r,n){let s=!1,a=r.get(this);a.clearVisibilityOverride();for(let m of this.mChildrenComponents){let u=r.get(m);if(u.clearVisibilityOverride(),s)u.addVisibilityOverride(tt.OVERRIDE_GONE);else{let l=m.minIntrinsicWidth(),h=m.minIntrinsicHeight();l<=t&&h<=i?(m.measure(e,l,t,h,i,r),u.getW()<=t&&u.getH()<=i?(s=!0,u.addVisibilityOverride(tt.OVERRIDE_VISIBLE),n&&(n.setWidth(u.getW()),n.setHeight(u.getH()))):u.addVisibilityOverride(tt.OVERRIDE_GONE)):u.addVisibilityOverride(tt.OVERRIDE_GONE)}}a.addVisibilityOverride(s?tt.OVERRIDE_VISIBLE:tt.OVERRIDE_GONE)}internalLayoutMeasure(e,t){let i=t.get(this),r=i.getW()-this.mPaddingLeft-this.mPaddingRight,n=i.getH()-this.mPaddingTop-this.mPaddingBottom;for(let s of this.mChildrenComponents){let a=t.get(s),m=0,u=0;switch(this.mVerticalPositioning){case o.TOP:u=0;break;case o.CENTER:u=(n-a.getH())/2;break;case o.BOTTOM:u=n-a.getH();break}switch(this.mHorizontalPositioning){case o.START:m=0;break;case o.CENTER:m=(r-a.getW())/2;break;case o.END:m=r-a.getW();break}a.setX(m),a.setY(u)}}write(e){e.start(o.OP_CODE),e.writeInt(this.getComponentId()),e.writeInt(this.mAnimationId),e.writeInt(this.mHorizontalPositioning),e.writeInt(this.mVerticalPositioning)}deepToString(e){return`${e}FitBoxLayout(${this.getComponentId()})`}static read(e,t){let i=e.declareId(),r=e.declareId(),n=e.readInt(),s=e.readInt();t.push(new o(i,r,n,s))}};var hh=34028234663852886e22;function Ag(o){return Number.isNaN(o)?0:o>=2147483647?2147483647:o<=-2147483648?-2147483648:Math.trunc(o)}function Eg(o,e){let t=o.length;if(t<2)return;let i=1;if(e(o[i++],o[0])<0){for(;i<t&&e(o[i],o[i-1])<0;)i++;let r=o.slice(0,i).reverse();for(let n=0;n<i;n++)o[n]=r[n]}else for(;i<t&&e(o[i],o[i-1])>=0;)i++;for(let r=i;r<t;r++){let n=o[r],s=0,a=r;for(;s<a;){let m=s+a>>1;e(n,o[m])<0?a=m:s=m+1}for(let m=r;m>s;m--)o[m]=o[m-1];o[s]=n}}var xe=class o{static{this.HORIZONTAL=0}static{this.VERTICAL=1}static getPriority(e,t){if(e instanceof ct){let i=e.selfOrModifier(ti);if(i&&i.getOrientation()===t)return i.getPriority()}return hh}static findLastStanding(e,t){if(e.length===0)return null;let i=e[0],r=o.getPriority(i,t);for(let n=1;n<e.length;n++){let s=o.getPriority(e[n],t);s>r&&(r=s,i=e[n])}return i}static sortWithPriorities(e,t){let i=[...e];return Eg(i,(r,n)=>Ag(Math.fround(o.getPriority(n,t)-o.getPriority(r,t)))),i}};function ci(o,e,t,i,r,n,s,a){n.get(o).addVisibilityOverride(tt.OVERRIDE_VISIBLE);let u=i,l=!1,h=0,c=0,f=0,d=o.mChildrenComponents;for(let I of d){s&&n.contains(I.getComponentId())&&n.get(I).clearVisibilityOverride();let T=I instanceof ct&&(e===0?I.hasWidthWeight():I.hasHeightWeight()),v=a(I)||T?u:hh;e===0?I.measure(t,0,v,0,r,n):I.measure(t,0,r,0,v,n);let _=n.get(I);if(!_.isGone()){h++;let P=e===0?_.getW():_.getH();c+=P,f=Math.max(f,e===0?_.getH():_.getW()),u-=P}I instanceof ct&&I.selfOrModifier(ti)&&(l=!0)}let p=l?xe.sortWithPriorities(d,e):d,b=0,g=0,C=0,y=!1;for(let I of p){let T=n.get(I);if(y||T.isGone()){T.addVisibilityOverride(tt.OVERRIDE_GONE);continue}let v=e===0?T.getW():T.getH();b+v>i?(T.addVisibilityOverride(tt.OVERRIDE_GONE),y=!0):(b+=v,g=Math.max(g,e===0?T.getH():T.getW()),C++)}return{preDropCount:h,preDropMain:c,preDropCross:f,kept:C,keptMain:b,keptCross:g}}var Rs=class o extends Oe{constructor(t,i,r,n,s){super(t,i,r,n,s);this.mSettleCrossMin=null;this.mPriorityFix=!0}static{this.OP_CODE=230}axis(){return xe.HORIZONTAL}minIntrinsicWidth(){let t=this.modifierDefinedWidth(!0),i=this.getWidthModifier();if(i&&(i.getType()===0||i.getType()===6))return t;let r=this.mPriorityFix?xe.findLastStanding(this.mChildrenComponents,this.axis()):this.mChildrenComponents[0];return r&&(t+=r.minIntrinsicWidth()),t}minIntrinsicHeight(){let t=this.modifierDefinedHeight(!0),i=this.getHeightModifier();if(i&&(i.getType()===0||i.getType()===6))return t;let r=this.mPriorityFix?xe.findLastStanding(this.mChildrenComponents,this.axis()):this.mChildrenComponents[0];return r&&(t+=r.minIntrinsicHeight()),t}measure(t,i,r,n,s,a){this.mSettleCrossMin=null;let m=t.getContext().getDocument?.();this.mPriorityFix=m?m.useFeature(Ct.FEATURE_PRIORITY_FIX,1):!0,super.measure(t,i,r,n,s,a)}computeWrapSize(t,i,r,n,s,a,m,u,l){let h=ci(this,this.axis(),t,r,s,u,!0,c=>c instanceof o);l.setHeight(h.preDropCross),l.setWidth(a?Math.min(r,h.keptMain):h.preDropMain+this.spacedByPx(t,this.mSpacedBy)*(h.preDropCount-1)),m&&(this.mSettleCrossMin=n),(h.preDropCount+h.kept===0||(a?Math.min(r,h.keptMain):h.preDropMain)<=0)&&u.get(this).addVisibilityOverride(tt.OVERRIDE_GONE)}computeSize(t,i,r,n,s,a){let m=ci(this,this.axis(),t,r,s,a,!0,u=>u instanceof o);m.preDropCount+m.kept===0&&a.get(this).addVisibilityOverride(tt.OVERRIDE_GONE)}internalLayoutMeasure(t,i){let r=i.get(this),n=ci(this,this.axis(),t,r.getW(),r.getH(),i,!1,s=>s instanceof o);if(n.preDropCount+n.kept===0&&r.addVisibilityOverride(tt.OVERRIDE_GONE),this.mSettleCrossMin!==null){let s=n.keptCross+this.mPaddingTop+this.mPaddingBottom,a=this.getHeightInModifier();a&&(a.getMin()>=0&&(s=Math.max(s,a.getMin())),a.getMax()>=0&&(s=Math.min(s,a.getMax()))),s=Math.max(s,this.mSettleCrossMin),r.setH(Math.min(r.getH(),s))}super.internalLayoutMeasure(t,i)}write(t){t.start(o.OP_CODE),t.writeInt(this.getComponentId()),t.writeInt(this.getAnimationId()),t.writeInt(this.mHorizontalPositioning),t.writeInt(this.mVerticalPositioning),t.writeFloat(this.mSpacedBy)}deepToString(t){return`${t}CollapsibleRowLayout(${this.getComponentId()})`}static read(t,i){let r=t.declareId(),n=t.declareId(),s=t.readInt(),a=t.readInt(),m=t.readNanIdBits(),u=F(m);{let l=new o(r,n,s,a,u);l.mSpacedByBits=m,i.push(l)}}};var Bs=class o extends Ji{constructor(t,i,r,n,s){super(t,i,r,n,s);this.mSettleCrossMin=null;this.mPriorityFix=!0}static{this.OP_CODE=233}axis(){return xe.VERTICAL}minIntrinsicHeight(){let t=this.modifierDefinedHeight(!0),i=this.getHeightModifier();if(i&&(i.getType()===0||i.getType()===6))return t;let r=this.mPriorityFix?xe.findLastStanding(this.mChildrenComponents,this.axis()):this.mChildrenComponents[0];return r&&(t+=r.minIntrinsicHeight()),t}minIntrinsicWidth(){let t=this.modifierDefinedWidth(!0),i=this.getWidthModifier();if(i&&(i.getType()===0||i.getType()===6))return t;let r=this.mPriorityFix?xe.findLastStanding(this.mChildrenComponents,this.axis()):this.mChildrenComponents[0];return r&&(t+=r.minIntrinsicWidth()),t}measure(t,i,r,n,s,a){this.mSettleCrossMin=null;let m=t.getContext().getDocument?.();this.mPriorityFix=m?m.useFeature(Ct.FEATURE_PRIORITY_FIX,1):!0,super.measure(t,i,r,n,s,a)}computeWrapSize(t,i,r,n,s,a,m,u,l){let h=ci(this,this.axis(),t,s,r,u,!0,c=>c instanceof o);l.setWidth(h.preDropCross),l.setHeight(m?Math.min(s,h.keptMain):h.preDropMain+this.spacedByPx(t,this.mSpacedBy)*(h.preDropCount-1)),a&&(this.mSettleCrossMin=i),(h.preDropCount+h.kept===0||(m?Math.min(s,h.keptMain):h.preDropMain)<=0)&&u.get(this).addVisibilityOverride(tt.OVERRIDE_GONE)}computeSize(t,i,r,n,s,a){let m=ci(this,this.axis(),t,s,r,a,!0,u=>u instanceof o);m.preDropCount+m.kept===0&&a.get(this).addVisibilityOverride(tt.OVERRIDE_GONE)}internalLayoutMeasure(t,i){let r=i.get(this),n=ci(this,this.axis(),t,r.getH(),r.getW(),i,!1,s=>s instanceof o);if(n.preDropCount+n.kept===0&&r.addVisibilityOverride(tt.OVERRIDE_GONE),this.mSettleCrossMin!==null){let s=n.keptCross+this.mPaddingLeft+this.mPaddingRight,a=this.getWidthInModifier();a&&(a.getMin()>=0&&(s=Math.max(s,a.getMin())),a.getMax()>=0&&(s=Math.min(s,a.getMax()))),s=Math.max(s,this.mSettleCrossMin),r.setW(Math.min(r.getW(),s))}super.internalLayoutMeasure(t,i)}write(t){t.start(o.OP_CODE),t.writeInt(this.getComponentId()),t.writeInt(this.getAnimationId()),t.writeInt(this.mHorizontalPositioning),t.writeInt(this.mVerticalPositioning),t.writeFloat(this.mSpacedBy)}deepToString(t){return`${t}CollapsibleColumnLayout(${this.getComponentId()})`}static read(t,i){let r=t.declareId(),n=t.declareId(),s=t.readInt(),a=t.readInt(),m=t.readNanIdBits(),u=F(m);{let l=new o(r,n,s,a,u);l.mSpacedByBits=m,i.push(l)}}};var Ds=class o extends D{static{this.OP_CODE=192}constructor(e,t,i){super(),this.mTextId=e,this.mDataSetId=t,this.mIndexBits=i,this.mOutIndex=O(i)?0:F(i)}updateVariables(e){O(this.mIndexBits)&&(this.mOutIndex=e.getFloat(x(this.mIndexBits)))}registerListening(e){O(this.mIndexBits)&&e.listensTo(x(this.mIndexBits),this)}apply(e){let t=e.getCollectionsAccess().getId(this.mDataSetId,Math.floor(this.mOutIndex));e.loadInteger(this.mTextId,t)}write(e){e.start(o.OP_CODE),e.writeInt(this.mTextId),e.writeInt(this.mDataSetId),e.writeInt(this.mIndexBits)}deepToString(e){return`${e}IdLookup(textId=${this.mTextId}, dataSetId=${this.mDataSetId}, index=${this.mOutIndex})`}static read(e,t){let i=e.readId(),r=e.readId(),n=e.readNanIdBits();t.push(new o(i,r,n))}};var ws=class o extends D{static{this.OP_CODE=198}constructor(e,t,i){super(),this.mArrayId=e,this.mIndexBits=t,this.mIndexOut=O(t)?0:F(t),this.mValueBits=i,this.mValueOut=O(i)?0:F(i)}updateVariables(e){this.mIndexOut=O(this.mIndexBits)?e.getFloat(x(this.mIndexBits)):F(this.mIndexBits),this.mValueOut=O(this.mValueBits)?e.getFloat(x(this.mValueBits)):F(this.mValueBits)}registerListening(e){O(this.mIndexBits)&&e.listensTo(x(this.mIndexBits),this),O(this.mValueBits)&&e.listensTo(x(this.mValueBits),this)}apply(e){let t=e.mRemoteComposeState,i=t.getDynamicFloats(this.mArrayId);if(i!==null){let r=Math.floor(this.mIndexOut);r<i.length&&(i[r]=this.mValueOut),t.markVariableDirty(this.mArrayId)}}write(e){e.start(o.OP_CODE),e.writeInt(this.mArrayId),e.writeFloat(this.mIndexOut),e.writeFloat(this.mValueOut)}deepToString(e){return`${e}UpdateDynamicFloatList(arrayId=${this.mArrayId}, index=${this.mIndexOut}, value=${this.mValueOut})`}static read(e,t){let i=e.readId(),r=e.readNanIdBits(),n=e.readNanIdBits();t.push(new o(i,r,n))}};var Ls=class o extends Mt{constructor(t,i,r,n,s){super(t,i);this.mScaling=new yr;this.mPaint=new ot;this.mBitmapId=r,this.mScaleType=n&255,this.mAlphaBits=s,this.mOutAlpha=O(s)?1:F(s)}static{this.OP_CODE=234}registerListening(t){this.mBitmapId!==-1&&t.listensTo(this.mBitmapId,this),O(this.mAlphaBits)&&t.listensTo(x(this.mAlphaBits),this)}updateVariables(t){this.mOutAlpha=O(this.mAlphaBits)?t.getFloat(x(this.mAlphaBits)):F(this.mAlphaBits)}computeWrapSize(t,i,r,n,s,a,m,u,l){let h=t.getContext().getObject(this.mBitmapId);h&&h instanceof oe&&(l.setWidth(h.getWidth()),l.setHeight(h.getHeight()))}computeSize(t,i,r,n,s,a){let m=this.computeModifierDefinedWidth(),u=this.computeModifierDefinedHeight(),l=a.get(this);m>=0&&l.setW(m),u>=0&&l.setH(u)}paintingComponent(t){t.save(),t.translate(this.mX,this.mY),this.paintModifiers(t);let i=t.getContext(),r=this.mPaddingLeft,n=this.mPaddingTop;t.translate(r,n);let s=this.mWidth-this.mPaddingLeft-this.mPaddingRight,a=this.mHeight-this.mPaddingTop-this.mPaddingBottom;t.clipRect(0,0,s,a);let m=i.getObject(this.mBitmapId);m&&m instanceof oe&&(this.mScaling.setup(0,0,m.getWidth(),m.getHeight(),0,0,s,a,this.mScaleType,1),t.savePaint(),this.mOutAlpha!==1&&(this.mPaint.reset(),this.mPaint.setColor(0,0,0,this.mOutAlpha),t.applyPaint(this.mPaint)),t.drawBitmap(this.mBitmapId,0,0,m.getWidth()|0,m.getHeight()|0,this.mScaling.mFinalDstLeft|0,this.mScaling.mFinalDstTop|0,this.mScaling.mFinalDstRight|0,this.mScaling.mFinalDstBottom|0,-1),t.restorePaint()),t.translate(-r,-n),t.restore()}write(t){t.start(o.OP_CODE),t.writeInt(this.getComponentId()),t.writeInt(0),t.writeInt(this.mBitmapId),t.writeInt(this.mScaleType),t.writeInt(this.mAlphaBits)}apply(t){super.apply(t)}deepToString(t){return`${t}ImageLayout(${this.getComponentId()}, bitmap=${this.mBitmapId}, scale=${this.mScaleType})`}static read(t,i){let r=t.declareId(),n=t.declareId(),s=t.readId(),a=t.readInt(),m=t.readNanIdBits();i.push(new o(r,n,s,a,m))}};var Ns=class o extends Mt{constructor(t,i,r){super(t,i);this.measuredLayoutIndex=0;this.currentLayoutIndex=0;this.previousLayoutIndex=0;this.inTransition=!1;this.mIndexInitialized=!1;this.statePaintedComponents=new Map;this.mIndexId=r}static{this.OP_CODE=217}inflate(){super.inflate(),this.hideLayoutsOtherThan(this.currentLayoutIndex)}collectAnimatedComponents(t,i){if(t.getAnimationId()!==-1&&i.push(t),t instanceof ct)for(let r of t.mChildrenComponents)this.collectAnimatedComponents(r,i)}getAnimatedComponentsIn(t){let i=[];return t&&this.collectAnimatedComponents(t,i),i}findAnimatedComponents(){let t=this.mChildrenComponents.length;for(let i=0;i<t;i++){let r=this.mChildrenComponents[i];if(r instanceof ct){r.setX(0),r.setY(0);for(let n of this.getAnimatedComponentsIn(r)){let s=this.statePaintedComponents.get(n.getAnimationId());s||(s=new Array(t).fill(null),this.statePaintedComponents.set(n.getAnimationId(),s)),s[i]=n}}}}getSharedComponent(t,i){let r=this.statePaintedComponents.get(t);return r&&i>=0&&i<r.length?r[i]:null}computeWrapSize(t,i,r,n,s,a,m,u,l){this.getLayout(this.currentLayoutIndex)?.computeWrapSize(t,i,r,n,s,a,m,u,l)}computeSize(t,i,r,n,s,a){this.getLayout(this.currentLayoutIndex)?.computeSize(t,i,r,n,s,a)}internalLayoutMeasure(t,i){this.getLayout(this.currentLayoutIndex)?.internalLayoutMeasure(t,i)}onClick(t,i,r,n){if(r<this.mX||r>this.mX+this.mWidth||n<this.mY||n>this.mY+this.mHeight)return!1;let s=this.getLayout(this.currentLayoutIndex);return!s||typeof s.onClick!="function"?!1:s.onClick(t,i,r-this.mX-this.mPaddingLeft,n-this.mY-this.mPaddingTop)}measure(t,i,r,n,s,a){if(!this.mIndexInitialized&&(this.mIndexInitialized=!0,this.mIndexId!==0)){let u=t.getContext().mRemoteComposeState.getInteger(this.mIndexId);this.currentLayoutIndex=this.previousLayoutIndex=this.measuredLayoutIndex=u,this.hideLayoutsOtherThan(u)}this.statePaintedComponents.size===0&&this.findAnimatedComponents();let m=this.getLayout(this.currentLayoutIndex);if(!m){super.measure(t,i,r,n,s,a);return}if(m.setVisibility(tt.VISIBLE),a.get(m).setVisibility(tt.VISIBLE),m.measure(t,i,r,n,s,a),this.inTransition&&this.currentLayoutIndex!==this.previousLayoutIndex){let u=this.getLayout(this.previousLayoutIndex),l=this.getAnimatedComponentsIn(u);for(let h of this.getAnimatedComponentsIn(m)){let c=h.getAnimationId();if(!l.some(d=>d.getAnimationId()===c))continue;let f=this.statePaintedComponents.get(c)?.[this.previousLayoutIndex]??null;f&&h!==f&&(h.mFirstLayout=!1,h.setX(f.getX()),h.setY(f.getY()),h.setWidth(f.getWidth()),h.setHeight(f.getHeight()))}}for(let u of this.getAnimatedComponentsIn(m)){let l=a.get(u);l.setVisibility(tt.VISIBLE),u.setVisibility(tt.VISIBLE);let h=a.get(u.getAnimationId());h.copyFrom(l),h.setVisibility(tt.VISIBLE);for(let c of this.statePaintedComponents.get(u.getAnimationId())??[]){if(!c)continue;let f=a.get(c.getComponentId());u!==c&&f.copyFrom(l),f.setVisibility(tt.VISIBLE),c.setVisibility(tt.VISIBLE),u!==c&&c.measure(t,l.getW(),l.getW(),l.getH(),l.getH(),a)}}if(this.previousLayoutIndex!==this.currentLayoutIndex){let u=this.getLayout(this.previousLayoutIndex),l=new Set,h=c=>{l.add(c.getComponentId()),c instanceof ct&&c.mChildrenComponents.forEach(h)};h(m);for(let c of u?.mChildrenComponents??[]){if(l.has(c.getComponentId()))continue;let f=!1;if(c.getAnimationId()!==-1){let d=this.statePaintedComponents.get(c.getAnimationId());f=!!d&&this.currentLayoutIndex<d.length&&d[this.currentLayoutIndex]!==null}if(!f){let d=a.get(c.getComponentId());d.setX(c.getX()),d.setY(c.getY()),d.setW(c.getWidth()),d.setH(c.getHeight()),d.setVisibility(tt.GONE)}}}a.get(this).copyFrom(a.get(m)),this.measuredLayoutIndex=this.currentLayoutIndex}layout(t,i){vt.prototype.layout.call(this,t,i),this.updateComponentValues(t,this.mWidth,this.mHeight);let r=i.get(this);this.layoutModifiers(r.getW(),r.getH());let n=this.getLayout(this.currentLayoutIndex);if(n){let s=i.get(n.getComponentId());s.copyFrom(r),s.setX(0),s.setY(0),n.layout(t,i)}if(this.inTransition&&this.previousLayoutIndex!==this.currentLayoutIndex){let s=this.getLayout(this.previousLayoutIndex);for(let a of s?.mChildrenComponents??[]){let m=a.getComponentId();if(a.getAnimationId()!==-1){m=a.getAnimationId();for(let u of this.statePaintedComponents.get(m)??[])u&&u.layout(t,i)}i.contains(m)&&a.layout(t,i)}}this.mNeedsMeasure=!1,this.mFirstLayout=!1}paint(t){if(this.mIndexId!==0){let s=t.getContext().mRemoteComposeState.getInteger(this.mIndexId);s!==this.currentLayoutIndex&&(this.previousLayoutIndex=this.currentLayoutIndex,this.currentLayoutIndex=s,this.inTransition=!0,this.invalidateMeasure(),t.needsRepaint())}let i=0;for(let s of this.mChildrenComponents)s instanceof ct&&(i!==this.currentLayoutIndex&&i!==this.previousLayoutIndex&&(s.mVisibility=tt.GONE),i===this.currentLayoutIndex&&!s.isVisible()&&(s.mVisibility=tt.VISIBLE),i++);let r=this.getLayout(this.measuredLayoutIndex);if(!r)return;let n=this.inTransition&&this.previousLayoutIndex!==this.measuredLayoutIndex;if(t.save(),t.translate(this.mX,this.mY),n){let s=this.getLayout(this.previousLayoutIndex);if(s){let a=l=>l.getAnimationId()!==-1?l.getAnimationId():l.getComponentId(),m=new Set(r.mChildrenComponents.map(a)),u=s.mChildrenComponents.filter(l=>!m.has(a(l)));if(u.length>0){t.save(),t.translate(s.getX(),s.getY());for(let l of u)l.paint(t);t.restore()}}}r.paint(t),t.restore(),n&&this.checkEndOfTransition(t)}isLayoutAnimating(t){if(!t)return!1;if(t.mAnimateMeasure!==null&&!t.mAnimateMeasure.isDone())return!0;for(let i of t.mChildrenComponents)if(i.mAnimateMeasure!==null&&!i.mAnimateMeasure.isDone()||i instanceof Mt&&this.isLayoutAnimating(i))return!0;return!1}checkEndOfTransition(t){let i=this.getLayout(this.measuredLayoutIndex),r=this.getLayout(this.previousLayoutIndex);this.inTransition&&!this.isLayoutAnimating(i)&&!this.isLayoutAnimating(r)?(this.inTransition=!1,r&&r!==i&&!r.isGone()&&(r.mVisibility=tt.GONE)):this.inTransition&&(this.mNeedsRepaint=!0,t?.needsRepaint())}getLayout(t){let i=0;for(let r of this.mChildrenComponents)if(r instanceof ct){if(i===t)return r;i++}return this.mChildrenComponents.length>0&&this.mChildrenComponents[0]instanceof ct?this.mChildrenComponents[0]:null}hideLayoutsOtherThan(t){let i=0;for(let r of this.mChildrenComponents)r instanceof ct&&(r.mVisibility=i===t?tt.VISIBLE:tt.GONE,i++)}write(t){t.start(o.OP_CODE),t.writeInt(this.getComponentId()),t.writeInt(0),t.writeInt(0),t.writeInt(0),t.writeInt(this.mIndexId)}apply(t){super.apply(t)}deepToString(t){return`${t}StateLayout(${this.getComponentId()}, index=${this.mIndexId})`}static read(t,i){let r=t.declareId(),n=t.declareId();t.readInt(),t.readInt();let s=t.readId();i.push(new o(r,n,s))}};var Vs=class o extends D{static{this.OP_CODE=209}constructor(e){super(),this.mActionId=e}write(e){}apply(e){e.runAction(this.mActionId,"")}deepToString(e){return`${e}HostActionOperation(${this.mActionId})`}static read(e,t){t.push(new o(e.readId()))}},Ws=class o extends D{static{this.OP_CODE=210}static{this.FLOAT_TYPE=0}static{this.INT_TYPE=1}static{this.STRING_TYPE=2}static{this.NONE_TYPE=-1}constructor(e,t,i){super(),this.mTextId=e,this.mType=t,this.mValueId=i}write(e){}apply(e){let t;switch(this.mType){case o.FLOAT_TYPE:t=e.getFloat(this.mValueId);break;case o.INT_TYPE:t=e.mRemoteComposeState.getInteger(this.mValueId);break;case o.STRING_TYPE:t=e.mRemoteComposeState.getFromId(this.mValueId);break;case o.NONE_TYPE:default:t="";break}e.runNamedAction(this.mTextId,t)}deepToString(e){return`${e}HostNamedActionOperation(text=${this.mTextId}, type=${this.mType}, value=${this.mValueId})`}static read(e,t){let i=e.readId(),r=e.readInt(),n=e.readId();t.push(new o(i,r,n))}},ks=class o extends D{static{this.OP_CODE=212}constructor(e,t){super(),this.mTargetValueId=e,this.mValue=t}write(e){}apply(e){e.overrideInteger(this.mTargetValueId,this.mValue)}deepToString(e){return`${e}ValueIntegerChangeAction(${this.mTargetValueId}, ${this.mValue})`}static read(e,t){let i=e.readId(),r=e.readInt();t.push(new o(i,r))}},Hs=class o extends D{static{this.OP_CODE=213}constructor(e,t){super(),this.mTargetValueId=e,this.mValueId=t}write(e){}apply(e){e.overrideText(this.mTargetValueId,this.mValueId)}deepToString(e){return`${e}ValueStringChangeAction(${this.mTargetValueId}, ${this.mValueId})`}static read(e,t){let i=e.readId(),r=e.readId();t.push(new o(i,r))}},Us=class o extends D{static{this.OP_CODE=218}constructor(e,t){super(),this.mTargetValueId=e,this.mValueExpressionId=t}write(e){}apply(e){if(e.mMode==="DATA")return;let t=e.getDocument();t?.evaluateIntExpression&&t.evaluateIntExpression(this.mValueExpressionId,Mg(this.mTargetValueId),e)}deepToString(e){return`${e}ValueIntegerExpressionChangeAction(${this.mTargetValueId}, ${this.mValueExpressionId})`}static read(e,t){let i=e.readLongNanId(),r=e.readLongNanId();t.push(new o(i,r))}};function Mg(o){return Number(BigInt.asIntN(32,BigInt(Math.trunc(o))))}var Gs=class o extends D{static{this.OP_CODE=222}constructor(e,t){super(),this.mTargetValueId=e,this.mValue=t}write(e){}apply(e){e.overrideFloat(this.mTargetValueId,this.mValue)}deepToString(e){return`${e}ValueFloatChangeAction(${this.mTargetValueId}, ${this.mValue})`}static read(e,t){let i=e.readId(),r=F(e.readNanIdBits());t.push(new o(i,r))}};var Fr=class o{static{this.SAMPLE_RATE=22050}static synthesizePcm(e,t,i,r){let n=Math.max(1,Math.floor(r*t)),s=new Uint8Array(n*2),a=Math.floor(i);for(let m=0;m<n;m++){let u=m/r,l=2*Math.PI*e*u,h;switch(a){case 1:h=Math.sin(l)>=0?1:-1;break;case 2:h=2*(e*u-Math.floor(e*u+.5));break;case 3:h=2*Math.abs(2*(e*u-Math.floor(e*u+.5)))-1;break;default:h=Math.sin(l);break}let c;m<100?c=m/100:m>n-100?c=(n-m)/100:c=1;let f=Math.round(h*c*32767)<<16>>16;s[2*m]=f&255,s[2*m+1]=f>>8&255}return s}static buildWav(e,t=o.SAMPLE_RATE,i=16,r=1){let n=t*r*i/8,s=r*i/8,a=e.length,m=new Uint8Array(44+a),u=new DataView(m.buffer),l=!0,h=(c,f)=>{for(let d=0;d<f.length;d++)m[c+d]=f.charCodeAt(d)};return h(0,"RIFF"),u.setInt32(4,36+a,l),h(8,"WAVE"),h(12,"fmt "),u.setInt32(16,16,l),u.setInt16(20,1,l),u.setInt16(22,r,l),u.setInt32(24,t,l),u.setInt32(28,n,l),u.setInt16(32,s,l),u.setInt16(34,i,l),h(36,"data"),u.setInt32(40,a,l),m.set(e,44),m}static synthesizeSynthWav(e,t,i,r){let n=o.synthParams(e),s=o.validRate(r),a=o.voiceSamples(n,n[0],n[1],s);return o.toWav(o.echo(a,n,s),t,i)}static synthesizeSequenceWav(e,t,i,r,n){let s=o.synthParams(e),a=o.validRate(n),m=o.SAMPLE_RATE,u=[],l=1;for(let c=0;c+3<t.length;c+=4){let f=Math.max(0,Ys(t[c],0))/a,d=Ys(t[c+1],0),p=Math.max(0,Ys(t[c+2],0)),b=Ys(t[c+3],1);if(!(d>0)||p<=0||b===0)continue;let g=Math.round(f*m);if(g>=o.MAX_SAMPLES)continue;let C=o.voiceSamples(s,d,p,a);u.push([g,C,b]),l=Math.max(l,g+C.length)}let h=new Float32Array(Math.min(l,o.MAX_SAMPLES));for(let[c,f,d]of u){let p=Math.min(f.length,h.length-c);for(let b=0;b<p;b++)h[c+b]+=f[b]*d}return o.toWav(o.echo(h,s,a),i,r)}static{this.SYNTH_DEFAULTS=[440,.2,0,.005,0,1,.05,0,0,0,.5,0,0,0,0,.4]}static{this.MAX_SAMPLES=o.SAMPLE_RATE*30}static synthParams(e){return o.SYNTH_DEFAULTS.map((t,i)=>Ys(i<e.length?e[i]:NaN,t))}static validRate(e){return e>0&&Number.isFinite(e)?e:1}static voiceSamples(e,t,i,r){let n=o.SAMPLE_RATE,s=Math.max(0,t)*r,a=Math.floor(e[2]),m=Math.max(0,e[3])/r,u=Math.max(0,e[4])/r,l=Math.min(1,Math.max(0,e[5])),h=Math.max(0,e[6])/r,c=Math.max(Math.max(0,i)/r,l===0?m+u:0),f=e[7]>0&&e[0]>0?e[7]/e[0]:1,d=Math.max(0,e[8])*r,p=e[9],b=Math.min(.99,Math.max(.01,e[10])),g=Math.max(0,e[11]),C=Math.max(0,e[12]),y=e[13],I=Math.max(1,Math.min(o.MAX_SAMPLES,Math.round((c+h)*n))),T=new Float32Array(I),v=g>0?1-Math.exp(-2*Math.PI*g/n):1,_=0,P=0,E=22222,L=0,V=0,B=-1,U=H=>H<m?H/m:H<m+u?1-(1-l)*(H-m)/u:l;for(let H=0;H<I;H++){let N=H/n,k;N<c?k=U(N):(B<0&&(B=U(c)),k=h>0?B*Math.max(0,1-(N-c)/h):0);let Y=f!==1&&c>0?s*Math.pow(f,Math.min(N,c)/c):s;d>0&&p!==0&&(Y*=Math.pow(2,p/12*Math.sin(2*Math.PI*d*N)));let $=_;_+=Y/n;let w=_-Math.floor(_);C>0&&y!==0&&(P+=Y*C/n,w+=y*k*Math.sin(2*Math.PI*(P-Math.floor(P)))/(2*Math.PI),w-=Math.floor(w));let X;switch(a){case 1:X=w<b?1:-1;break;case 2:X=2*w-1;break;case 3:X=1-4*Math.abs(w-.5);break;case 4:(H===0||Y>=n||Math.floor(_)!==Math.floor($))&&(E=Math.imul(E,1103515245)+12345>>>0,L=(E>>>8)/8388608-1),X=L;break;default:X=Math.sin(2*Math.PI*w);break}V+=v*(X*k-V),T[H]=V}return T}static echo(e,t,i){let r=Math.max(0,t[14])/i,n=Math.min(.95,Math.max(0,t[15])),s=o.SAMPLE_RATE,a=Math.round(r*s);if(a<1||n<=0)return e;let m=Math.ceil(Math.log(.01)/Math.log(n)),u=new Float32Array(Math.min(o.MAX_SAMPLES,e.length+a*m));for(let l=0;l<u.length;l++)u[l]=(l<e.length?e[l]:0)+(l>=a?u[l-a]*n:0);return u}static toWav(e,t,i){let r=Number.isFinite(t)?t:1,n=Number.isFinite(i)?i:1,s=r===n?1:2,a=0;for(let l=0;l<e.length;l++)a=Math.max(a,Math.abs(e[l]));if(a>1)for(let l=0;l<e.length;l++)e[l]/=a;let m=new Uint8Array(e.length*2*s),u=(l,h)=>{let c=Math.max(-32768,Math.min(32767,Math.round(h*32767)));m[l]=c&255,m[l+1]=c>>8&255};for(let l=0;l<e.length;l++)s===1?u(2*l,e[l]*r):(u(4*l,e[l]*r),u(4*l+2,e[l]*n));return o.buildWav(m,o.SAMPLE_RATE,16,s)}static synthesizeWav(e,t,i){return o.buildWav(o.synthesizePcm(e,t,i,o.SAMPLE_RATE))}};function Ys(o,e){return Number.isFinite(o)?o:e}var Xs=class o extends D{static{this.OP_CODE=169}constructor(e,t){super(),this.mSoundId=e,this.mData=t}write(e){}apply(e){e.loadSound(this.mSoundId,this.mData)}deepToString(e){return`${e}SoundData(${this.mSoundId}, ${this.mData.length} bytes)`}static read(e,t){let i=e.readId(),r=e.readBuffer();t.push(new o(i,r))}};function na(o){if(!O(o))return!1;let e=x(o);return e!==0&&(e>40||e<10)}var $s=class o extends D{constructor(t,i,r,n,s){super();this.mLastKey="";this.mGain=[1,1,1];this.mUsers=new Set;this.mId=t,this.mLeftVolume=i,this.mRightVolume=r,this.mRate=n,this.mParams=s,this.mOut=new Float32Array(s.length);for(let a=0;a<s.length;a++)this.mOut[a]=F(s[a])}static{this.OP_CODE=206}static{this.MAX_PARAMS=64}static{this.TYPE_TONE=10}static{this.TYPE_SYNTH=11}static{this.TYPE_SEQUENCE=12}write(t){}registerListening(t){for(let i=1;i<this.mParams.length;i++)na(this.mParams[i])&&t.listensTo(x(this.mParams[i]),this);for(let i of[this.mLeftVolume,this.mRightVolume,this.mRate])na(i)&&t.listensTo(x(i),this)}updateVariables(t){for(let i=1;i<this.mParams.length;i++){let r=this.mParams[i];this.mOut[i]=na(r)?t.getFloat(x(r)):F(r)}[this.mLeftVolume,this.mRightVolume,this.mRate].forEach((i,r)=>{this.mGain[r]=na(i)?t.getFloat(x(i)):F(i)})}apply(t){if(this.mParams.length===0)return;this.updateVariables(t);let i=x(this.mParams[0]);if(i===o.TYPE_TONE&&this.mParams.length>=4){let r=`${this.mOut[1]}|${this.mOut[2]}|${this.mOut[3]}`;if(r===this.mLastKey)return;this.mLastKey=r;let n=Fr.synthesizeWav(this.mOut[1],this.mOut[2],this.mOut[3]);t.loadSound(this.mId,n)}else if(i===o.TYPE_SYNTH){t.putObject(this.mId,this);let r=`${Array.from(this.mOut.subarray(1)).join("|")}|${this.mGain.join("|")}`;if(r===this.mLastKey)return;this.mLastKey=r,t.loadSound(this.mId,Fr.synthesizeSynthWav(this.mOut.subarray(1),this.mGain[0],this.mGain[1],this.mGain[2]));for(let n of this.mUsers)n.markDirty()}else if(i===o.TYPE_SEQUENCE&&this.mParams.length>=2){let r=t.getObject(Math.round(this.mOut[1]));if(!(r instanceof o)||x(r.mParams[0])!==o.TYPE_SYNTH)return;r.mUsers.add(this);let n=r.mOut.subarray(1),s=`${Array.from(n).join("|")}#${Array.from(this.mOut.subarray(2)).join("|")}|${this.mGain.join("|")}`;if(s===this.mLastKey)return;this.mLastKey=s,t.loadSound(this.mId,Fr.synthesizeSequenceWav(n,this.mOut.subarray(2),this.mGain[0],this.mGain[1],this.mGain[2]))}}deepToString(t){return`${t}SoundExpression(${this.mId})`}static read(t,i){let r=t.readId(),n=t.readInt(),s=t.readInt(),a=t.readInt(),m=t.readInt();if(m>o.MAX_PARAMS)throw new Error(`SoundExpression: too many params ${m} > ${o.MAX_PARAMS}`);let u=new Int32Array(m);for(let l=0;l<m;l++)u[l]=t.readInt();i.push(new o(r,n,s,a,u))}},zs=class o extends D{static{this.OP_CODE=141}constructor(e){super(),this.mSoundExpressionId=e}write(e){}apply(e){e.getMode()!=="DATA"&&e.playSound(this.mSoundExpressionId)}deepToString(e){return`${e}PlaySound(${this.mSoundExpressionId})`}static read(e,t){t.push(new o(e.readId()))}};var js=class o extends Mt{static{this.OP_CODE=93}constructor(e,t,i,r){super(e,t),this.mConfigId=i,this.mProperties=r}write(e){e.start(o.OP_CODE),e.writeInt(this.getComponentId()),e.writeInt(this.getAnimationId()),e.writeInt(this.mConfigId),e.writeInt(this.mProperties.length);for(let t of this.mProperties)e.writeShort(t.type),e.writeShort(t.dataType),(t.dataType&1)===0?e.writeInt(t.value):e.writeFloat(t.value)}apply(e){super.apply(e)}paintingComponent(e){let t=e.getContext(),i=t.getCustomHost();if(!i){super.paintingComponent(e);return}if(tt.isGone(this.mVisibility)&&this.mAnimateMeasure===null)return;e.matrixSave(),e.matrixTranslate(this.mX,this.mY),this.paintModifiers(e),e.matrixTranslate(this.mPaddingLeft,this.mPaddingTop);let r=this.mConfigId>=0?t.getText(this.mConfigId)??"":"",n=this.mWidth-this.mPaddingLeft-this.mPaddingRight,s=this.mHeight-this.mPaddingTop-this.mPaddingBottom;i.drawCustom(this.getComponentId(),r,e,n,s,t.getAnimationTime(),this.component(t)),e.matrixRestore()}component(e){let t=i=>this.mProperties.find(r=>r.type===i);return{text:(i,r="")=>{let n=t(i);return n?.dataType===2?e.getText(n.value)??r:r},integer:(i,r=0)=>{let n=t(i);return n?.dataType===0?n.value:r},canReturnText:i=>t(i)?.dataType===4,returnText:(i,r)=>{let n=t(i);return n?.dataType!==4?!1:(e.loadText(n.value,r),e.needsRepaint(),!0)}}}deepToString(e){return`${e}Custom(${this.getComponentId()}, config=${this.mConfigId}, ${this.mProperties.length} props)`}static read(e,t){let i=e.readInt(),r=e.readInt(),n=e.readId(),s=e.readInt(),a=[];for(let m=0;m<s;m++){let u=e.readShort(),l=e.readShort(),h=(l&1)===0?e.readInt():e.readFloat();a.push({type:u,dataType:l,value:h})}t.push(new o(i,r,n,a))}};var Ks=class o extends D{constructor(t,i,r){super();this.mFontId=t;this.mType=i;this.mFontData=r}static{this.OP_CODE=189}write(t){}apply(t){t.loadFont(this.mFontId,this.mFontData)}deepToString(t){return`${t}FontData(${this.mFontId}, ${this.mFontData.length} bytes)`}static read(t,i){let r=t.readId(),n=t.readInt(),s=t.readBuffer();i.push(new o(r,n,s))}};var qt=class extends D{write(e){}apply(e){}deepToString(e){return`${e}${this.opName} (unsupported, parsed only)`}};function sa(o){(o.readInt()&2147483648)!==0&&o.readFloat()}var qs=class o extends qt{constructor(){super(...arguments);this.opName="ComponentStart"}static{this.OP_CODE=2}static read(t,i){t.readInt(),t.readId(),t.readFloat(),t.readFloat(),i.push(new o)}},ch=class o extends qt{constructor(){super(...arguments);this.opName="AnimationSpec"}static{this.OP_CODE=14}static read(t,i){t.readInt(),t.readFloat(),t.readInt(),t.readFloat(),t.readInt(),t.readInt(),t.readInt(),i.push(new o)}},Zs=class o extends qt{constructor(){super(...arguments);this.opName="DrawBitmapFontText"}static{this.OP_CODE=48}static read(t,i){sa(t),t.readInt(),t.readInt(),t.readInt(),t.readFloat(),t.readFloat(),i.push(new o)}},Qs=class o extends qt{constructor(){super(...arguments);this.opName="DrawBitmapFontTextOnPath"}static{this.OP_CODE=49}static read(t,i){sa(t),t.readInt(),t.readInt(),t.readInt(),t.readInt(),t.readFloat(),i.push(new o)}},Js=class o extends qt{constructor(){super(...arguments);this.opName="BitmapTextMeasure"}static{this.OP_CODE=183}static read(t,i){sa(t),t.readInt(),t.readInt(),t.readInt(),i.push(new o)}},to=class o extends qt{constructor(){super(...arguments);this.opName="DrawBitmapTextAnchored"}static{this.OP_CODE=184}static read(t,i){sa(t),t.readInt(),t.readFloat(),t.readFloat(),t.readFloat(),t.readFloat(),t.readFloat(),t.readFloat(),i.push(new o)}},eo=class o extends qt{constructor(){super(...arguments);this.opName="BitmapFontData"}static{this.OP_CODE=167}static{this.VERSION_2=2}static read(t,i){t.readId();let r=t.readInt(),n=r>>>16,s=r&65535;for(let a=0;a<s;a++)t.readUTF8(),t.readId(),t.readShort(),t.readShort(),t.readShort(),t.readShort(),t.readShort(),t.readShort();if(n>=o.VERSION_2){let a=t.readShort();for(let m=0;m<a;m++)t.readUTF8(),t.readShort()}i.push(new o)}},dh=class o extends qt{constructor(){super(...arguments);this.opName="FontData"}static{this.OP_CODE=189}static read(t,i){t.readId(),t.readInt(),t.readBuffer(),i.push(new o)}},io=class o extends qt{constructor(){super(...arguments);this.opName="DrawTextOnCircle"}static{this.OP_CODE=57}static read(t,i){t.readId(),t.readNanIdBits(),t.readNanIdBits(),t.readNanIdBits(),t.readNanIdBits(),t.readNanIdBits(),t.readByte(),t.readByte(),i.push(new o)}},ph=class o extends qt{constructor(){super(...arguments);this.opName="TextLookupInt"}static{this.OP_CODE=153}static read(t,i){t.declareId(),t.readId(),t.readId(),i.push(new o)}},fh=class o extends qt{constructor(){super(...arguments);this.opName="ImageAttribute"}static{this.OP_CODE=171}static read(t,i){t.readId(),t.readId(),t.readShort();let r=t.readShort();for(let n=0;n<r;n++)t.readId();i.push(new o)}},ro=class o extends qt{constructor(){super(...arguments);this.opName="PathCombine"}static{this.OP_CODE=175}static read(t,i){t.readId(),t.readId(),t.readId(),t.readByte(),i.push(new o)}},no=class o extends qt{constructor(t){super();this.opName="Rem";this.mText=t}static{this.OP_CODE=185}static read(t,i){i.push(new o(t.readUTF8()))}deepToString(t){return`${t}Rem("${this.mText}")`}};var oa=class o{static{this.sMap=new Map}static{this.initialized=!1}static init(){if(o.initialized)return;o.initialized=!0;let e=o.sMap;e.set(Ct.OP_CODE,Ct.read),e.set(hn.OP_CODE,hn.read),e.set(cn.OP_CODE,cn.read),e.set(Pn.OP_CODE,Pn.read),e.set(dn.OP_CODE,dn.read),e.set(pn.OP_CODE,pn.read),e.set(fn.OP_CODE,fn.read),e.set(gn.OP_CODE,gn.read),e.set(yn.OP_CODE,yn.read),e.set(In.OP_CODE,In.read),e.set(Cn.OP_CODE,Cn.read),e.set(vn.OP_CODE,vn.read),e.set(Tn.OP_CODE,Tn.read),e.set(On.OP_CODE,On.read),e.set(xn.OP_CODE,xn.read),e.set(An.OP_CODE,An.read),e.set(En.OP_CODE,En.read),e.set(Mn.OP_CODE,Mn.read),e.set(_n.OP_CODE,_n.read),e.set(Fn.OP_CODE,Fn.read),e.set(Sn.OP_CODE,Sn.read),e.set(Rn.OP_CODE,Rn.read),e.set(Bn.OP_CODE,Bn.read),e.set(Dn.OP_CODE,Dn.read),e.set(wn.OP_CODE,wn.read),e.set(Ln.OP_CODE,Ln.read),e.set(Nn.OP_CODE,Nn.read),e.set(Vn.OP_CODE,Vn.read),e.set(Wn.OP_CODE,Wn.read),e.set(kn.OP_CODE,kn.read),e.set(Re.OP_CODE,Re.read),e.set(oe.OP_CODE,oe.read),e.set(Ks.OP_CODE,Ks.read),e.set(Kr.OP_CODE,Kr.read),e.set(qr.OP_CODE,qr.read),e.set(Ye.OP_CODE,Ye.read),e.set(Wi.OP_CODE,Wi.read),e.set(Vt.OP_CODE,Vt.read),e.set(Zr.OP_CODE,Zr.read),e.set(ki.OP_CODE,ki.read),e.set(Qr.OP_CODE,Qr.read),e.set(Ot.OP_CODE,Ot.read),e.set(ts.OP_CODE,ts.read),e.set(yt.OP_CODE,yt.read),e.set(Jn.OP_CODE,Jn.read),e.set($i.OP_CODE,$i.read),e.set($e.OP_CODE,$e.read),e.set(zi.OP_CODE,zi.read),e.set(ze.OP_CODE,ze.read),e.set(ji.OP_CODE,ji.read),e.set(Ki.OP_CODE,Ki.read),e.set(Gt.OP_CODE,Gt.read),e.set(es.OP_CODE,es.read),e.set(Is.OP_CODE,Is.read),e.set(Cs.OP_CODE,Cs.read),e.set(Ts.OP_CODE,Ts.read),e.set(Os.OP_CODE,Os.read),e.set(qi.OP_CODE,qi.read),e.set(ui.OP_CODE,ui.read),e.set(ii.OP_CODE,ii.read),e.set(ei.OP_CODE,ei.read),e.set(Ge.OP_CODE,Ge.read),e.set(Qi.OP_CODE,Qi.read),e.set(Oe.OP_CODE,Oe.read),e.set(Ji.OP_CODE,Ji.read),e.set(is.OP_CODE,is.read),e.set($t.OP_CODE,$t.read),e.set(ft.OP_CODE,ft.read),e.set(pt.OP_CODE,pt.read),e.set(Ai.OP_CODE,Ai.read),e.set(Ei.OP_CODE,Ei.read),e.set(ti.OP_CODE,ti.read),e.set(Se.OP_CODE,Se.read),e.set(Mi.OP_CODE,Mi.read),e.set(Pe.OP_CODE,Pe.read),e.set(Fi.OP_CODE,Fi.read),e.set(Si.OP_CODE,Si.read),e.set(ye.OP_CODE,ye.read),e.set(Ie.OP_CODE,Ie.read),e.set(Ut.OP_CODE,Ut.read),e.set(_e.OP_CODE,_e.read),e.set(le.OP_CODE,le.read),e.set(he.OP_CODE,he.read),e.set(Pi.OP_CODE,Pi.read),e.set(_i.OP_CODE,_i.read),e.set(Ri.OP_CODE,Ri.read),e.set(Bi.OP_CODE,Bi.read),e.set(He.OP_CODE,He.read),e.set(Di.OP_CODE,Di.read),e.set(Ue.OP_CODE,Ue.read),e.set(wi.OP_CODE,wi.read),e.set(zr.OP_CODE,zr.read),e.set(Li.OP_CODE,Li.read),e.set(Ht.OP_CODE,Ht.read),e.set(ss.OP_CODE,ss.read),e.set(os.OP_CODE,os.read),e.set(ds.OP_CODE,ds.read),e.set(ls.OP_CODE,ls.read),e.set(us.OP_CODE,us.read),e.set(fs.OP_CODE,fs.read),e.set(gs.OP_CODE,gs.read),e.set(er.OP_CODE,er.read),e.set(bs.OP_CODE,bs.read),e.set(ys.OP_CODE,ys.read),e.set(Ps.OP_CODE,Ps.read),e.set(as.OP_CODE,as.read),e.set(Jr.OP_CODE,Jr.read),e.set(vs.OP_CODE,vs.read),e.set(Vi.OP_CODE,Vi.read),e.set(ni.OP_CODE,ni.read),e.set(cs.OP_CODE,cs.read),e.set(hs.OP_CODE,hs.read),e.set(ir.OP_CODE,ir.read),e.set(tn.OP_CODE,tn.read),e.set(en.OP_CODE,en.read),e.set(br.OP_CODE,br.read),e.set(Fs.OP_CODE,Fs.read),e.set(rn.OP_CODE,rn.read),e.set(Ms.OP_CODE,Ms.read),e.set(Es.OP_CODE,Es.read),e.set(Un.OP_CODE,Un.read),e.set(Gn.OP_CODE,Gn.read),e.set(Yn.OP_CODE,Yn.read),e.set(Xn.OP_CODE,Xn.read),e.set($n.OP_CODE,$n.read),e.set(zn.OP_CODE,zn.read),e.set(jn.OP_CODE,jn.read),e.set(Kn.OP_CODE,Kn.read),e.set(Zn.OP_CODE,Zn.read),e.set(Qn.OP_CODE,Qn.read),e.set(Ss.OP_CODE,Ss.read),e.set(rr.OP_CODE,rr.read),e.set(_s.OP_CODE,_s.read),e.set(Rs.OP_CODE,Rs.read),e.set(Bs.OP_CODE,Bs.read),e.set(Ds.OP_CODE,Ds.read),e.set(Ni.OP_CODE,Ni.read),e.set(Ce.OP_CODE,Ce.read),e.set(ws.OP_CODE,ws.read),e.set(Ls.OP_CODE,Ls.read),e.set(Ns.OP_CODE,Ns.read),e.set(Vs.OP_CODE,Vs.read),e.set(Ws.OP_CODE,Ws.read),e.set(ks.OP_CODE,ks.read),e.set(Hs.OP_CODE,Hs.read),e.set(Us.OP_CODE,Us.read),e.set(Gs.OP_CODE,Gs.read),e.set(nn.OP_CODE,nn.read),e.set(sn.OP_CODE,sn.read),e.set(on.OP_CODE,on.read),e.set(an.OP_CODE,an.read),e.set(rs.OP_CODE,rs.read),e.set(ns.OP_CODE,ns.read),e.set(Xs.OP_CODE,Xs.read),e.set($s.OP_CODE,$s.read),e.set(zs.OP_CODE,zs.read),e.set(Be.OP_CODE,Be.read),e.set(un.OP_CODE,un.read),e.set(mn.OP_CODE,mn.read),e.set(si.OP_CODE,si.read),e.set(Hi.OP_CODE,Hi.read),e.set(ln.OP_CODE,ln.read),e.set(Ui.OP_CODE,Ui.read),e.set(js.OP_CODE,js.read),e.set(ue.OP_CODE,ue.read),e.set(qs.OP_CODE,qs.read),e.set(Zs.OP_CODE,Zs.read),e.set(Qs.OP_CODE,Qs.read),e.set(Js.OP_CODE,Js.read),e.set(to.OP_CODE,to.read),e.set(eo.OP_CODE,eo.read),e.set(ps.OP_CODE,ps.read),e.set(tr.OP_CODE,tr.read),e.set(io.OP_CODE,io.read),e.set(ro.OP_CODE,ro.read),e.set(no.OP_CODE,no.read)}static getOperations(){return o.init(),o.sMap}static getReader(e){return o.init(),o.sMap.get(e)}static valid(e){return o.init(),o.sMap.has(e)}};var aa=class extends ve{constructor(e,t){super(1),this.mWrapped=e,this.mContext=t}getRemapContext(){return this.mContext}declareId(){return this.mContext.declareId(this.mWrapped.readInt())}readId(){return this.mContext.resolveId(this.mWrapped.readInt())}readNanIdBits(){return this.mContext.resolveNanIdBits(this.mWrapped.readInt())}readLongNanId(){return this.mContext.resolveLongNanId(this.mWrapped.readLong())}getBuffer(){return this.mWrapped.getBuffer()}getMaxSize(){return this.mWrapped.getMaxSize()}getIndex(){return this.mWrapped.getIndex()}setIndex(e){this.mWrapped.setIndex(e)}getSize(){return this.mWrapped.getSize()}size(){return this.mWrapped.size()}available(){return this.mWrapped.available()}start(e){this.mWrapped.start(e)}startWithSize(e){this.mWrapped.startWithSize(e)}endWithSize(){this.mWrapped.endWithSize()}reset(e){this.mWrapped.reset(e)}readOperationType(){return this.mWrapped.readOperationType()}readBoolean(){return this.mWrapped.readBoolean()}readByte(){return this.mWrapped.readByte()}readShort(){return this.mWrapped.readShort()}peekInt(){return this.mWrapped.peekInt()}readInt(){return this.mWrapped.readInt()}readLong(){return this.mWrapped.readLong()}readFloat(){return this.mWrapped.readFloat()}readDouble(){return this.mWrapped.readDouble()}readBuffer(){return this.mWrapped.readBuffer()}readBufferMax(e){return this.mWrapped.readBufferMax(e)}readUTF8(){return this.mWrapped.readUTF8()}readUTF8Max(e){return this.mWrapped.readUTF8Max(e)}writeBoolean(e){this.mWrapped.writeBoolean(e)}writeByte(e){this.mWrapped.writeByte(e)}writeShort(e){this.mWrapped.writeShort(e)}writeInt(e){this.mWrapped.writeInt(e)}writeLong(e){this.mWrapped.writeLong(e)}writeFloat(e){this.mWrapped.writeFloat(e)}writeDouble(e){this.mWrapped.writeDouble(e)}writeBuffer(e){this.mWrapped.writeBuffer(e)}writeUTF8(e){this.mWrapped.writeUTF8(e)}cloneBytes(){return this.mWrapped.cloneBytes()}setVersion(e,t){this.mWrapped.setVersion(e,t)}setValidOperationsFromSet(e){this.mWrapped.setValidOperationsFromSet(e)}moveBlock(e,t){this.mWrapped.moveBlock(e,t)}};var Fg=new Set([45,64,80,81,101,102,123,134,135,136,138,142,144,145,146,147,150,153,156,157,158,159,161,175,180,186,187,193,196,197,242]),di=class o{constructor(e){this.mBuffer=e}static fromArrayBuffer(e){let t=new Uint8Array(e);if(Ya(t)){let i=Xa(t);return new o(ve.fromArrayBuffer(i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength)))}return new o(ve.fromArrayBuffer(e))}getBuffer(){return this.mBuffer}inflateFromBuffer(e,t){this.mBuffer.setIndex(0);let i=t?new aa(this.mBuffer,t):this.mBuffer,r=oa.getOperations();for(;this.mBuffer.available();){let n=this.mBuffer.getIndex(),s=this.mBuffer.readByte(),a=r.get(s);if(!a){console.warn(`Unknown operation opcode: ${s}, skipping rest of buffer`);return}let m=e.length,u=[];this.mBuffer.mIdTrace=u,a(i,e),this.mBuffer.mIdTrace=null;let l=this.mBuffer.getIndex();for(let h=m;h<e.length;h++){let c=e[h];c._byteStart=n,c._byteEnd=l,Fg.has(s)&&u.length&&(c._providerId=s===150?u[u.length-1]:u[0])}}}};function pm(o){return typeof o.getList=="function"&&!(o instanceof $t)}function ma(o,e){for(let t=0;t<o.length;t++){let i=o[t];if(!(i instanceof Ui&&i.isContainerForm()||i instanceof Hi||i instanceof Be)||!pm(i))continue;let n=1,s=t+1;for(;s<o.length;s++){let u=o[s];if(u instanceof $t){if(--n===0)break}else pm(u)&&n++}if(s>=o.length)continue;let a=i._byteEnd,m=o[s]._byteStart;a>=0&&m>=a&&i.setBody(e.slice(a,m))}}function ua(o){let e=[],t=e,i=[];for(let r of o)if(pm(r)){let n=r;t.push(r),i.push(n),t=n.getList()}else if(r instanceof $t){let n=null;i.length>0&&(n=i.pop()),i.length>0?t=i[i.length-1].getList():t=e,n&&typeof n.inflate=="function"&&n.inflate()}else t.push(r);return e}var Sg=64,Sr=class o{constructor(e,t,i,r,n=!1,s=0){this.mLoomManager=e,this.mDocument=t,this.mRemapContext=i,this.mBlocks=r,this.mSafeMode=n,this.mDepth=s}getDepth(){return this.mDepth}isSafeMode(){return this.mSafeMode}getMacroManager(){return this.mLoomManager}getDocument(){return this.mDocument}getRemapContext(){return this.mRemapContext}getBlock(e){return this.mBlocks.get(e)??null}makeContainerEnd(){return new $t}fork(){return new o(this.mLoomManager,this.mDocument,this.mRemapContext.fork(),this.mBlocks,this.mSafeMode,this.mDepth)}expandRecursiveTop(e,t){let i=[];return this.expandRecursive(e,i,t),i}expandRecursive(e,t,i){if(this.mDepth>Sg){if(this.mSafeMode){t.push(new ni);return}throw new Error("Maximum macro expansion depth exceeded")}for(let r of e)try{r.materialize(this,t,i)}catch(n){if(this.mSafeMode)t.push(new ni);else throw n}}recordBlocks(e){for(let t of e.getList())t instanceof si&&this.mBlocks.set(t.getParamIndex(),t.getList())}getBlocksForCall(e){let t=new Map;for(let i of e.getList())i instanceof si&&t.set(i.getParamIndex(),i.getList());return t}inflateBody(e,t){let i=new ArrayBuffer(e.byteLength);new Uint8Array(i).set(e);let r=ve.fromArrayBuffer(i),n=new di(r),s=[];return n.inflateFromBuffer(s,t),ma(s,new Uint8Array(i)),ua(s)}};var nr=class o{constructor(e,t,i){e instanceof Map?(this.mIdMap=e,this.mDocument=t??null,this.mIsInsideMacro=i??!1):(this.mIdMap=new Map,this.mDocument=e??null,this.mIsInsideMacro=!1),this.mIsMapShared=!1}static identity(){return new fm}isInsideMacro(){return this.mIsInsideMacro}withInsideMacro(e){if(this.mIsInsideMacro===e)return this;this.mIsMapShared=!0;let t=new o(this.mIdMap,this.mDocument,e);return t.mIsMapShared=!0,t}fork(){this.mIsMapShared=!0;let e=new o(this.mIdMap,this.mDocument,this.mIsInsideMacro);return e.mIsMapShared=!0,e}ensureMapWritable(){this.mIsMapShared&&(this.mIdMap=new Map(this.mIdMap),this.mIsMapShared=!1)}addMapping(e,t){this.ensureMapWritable(),this.mIdMap.set(e,t)}resolveId(e){let t=this.mIdMap.get(e);return t!==void 0?t:e}resolveNanIdBits(e){if(!O(e))return e;let t=x(e),i=this.resolveId(t);return i===t?e:Hm(i)}resolveLongNanId(e){let t=Um(e),i=t|0;if(i!==t)return e;let r=this.resolveId(i);return r===i?e:r+4294967296}declareId(e){if(e===-1)return-1;let t=this.mIdMap.get(e);return t!==void 0?t:Ym(e)?this.allocateNewId(e):this.mIsInsideMacro&&!Gm(e)?this.allocateNewId(e):e}allocateNewId(e){if(this.mDocument===null)throw new Error("Cannot allocate ID without a document");let t=this.mDocument.getNextId();return this.addMapping(e,t),t}getIdMap(){return this.mIdMap}},fm=class extends nr{constructor(){super(new Map,null,!1)}declareId(e){return e}resolveId(e){return e}resolveNanIdBits(e){return e}resolveLongNanId(e){return e}withInsideMacro(e){return this}};var la=class{constructor(){this.mMacros=new Map;this.mMacroNames=new Map;this.mSafeMode=!1}setSafeMode(e){this.mSafeMode=e}isSafeMode(){return this.mSafeMode}add(e,t){let i=this.mMacros.get(e.getId());if((!i||i.getBody().length===0&&e.getBody().length>0)&&this.mMacros.set(e.getId(),e),t!==null){let r=this.mMacroNames.get(t);(!r||r.getBody().length===0&&e.getBody().length>0)&&this.mMacroNames.set(t,e)}}getNamedMacros(){return this.mMacroNames}expandAll(e,t){return new Sr(this,t,new nr(t),new Map,this.mSafeMode,0).expandRecursiveTop(e,this)}resolve(e,t){let i=this.mMacros.get(e.getId())??null;if(i===null){let r=t.getText(e.getId());r!=null&&(i=this.mMacroNames.get(r)??null)}return i}};var gm=class{constructor(e,t,i){this.mMajorVersion=e,this.mMinorVersion=t,this.mPatchVersion=i}supportsVersion(e,t,i){return this.mMajorVersion!==e?this.mMajorVersion>e:this.mMinorVersion!==t?this.mMinorVersion>t:this.mPatchVersion>=i}},Pg=1,ri=class o{constructor(e=gr){this.mOperations=[];this.mRootLayoutComponent=null;this.mLayoutComputeOps=new Set;this.mRemoteComposeState=new Ve;this.mVersion=null;this.mWidth=256;this.mHeaderSized=!1;this.mHeight=256;this.mAuthorWidth=null;this.mAuthorHeight=null;this.mCapabilities=0;this.mProperties=null;this.mContentDescription="";this.mContentScroll=0;this.mContentAlignment=0;this.mContentSizing=0;this.mContentMode=0;this.mBuffer=null;this.mHeader=null;this.mClickAreas=new Set;this.mIdActionListeners=new Set;this.mActionCallbacks=[];this.mThemeColors=null;this.mTouchListeners=new Set;this.mAppliedTouchOperations=new Set;this.mNeedsRepaintFlag=-1;this.mLastOpCount=0;this.mIsUpdateDoc=!1;this.mLoomManager=new la;this.mCurrentId=0;this.mProfileMask=0;this.mTextData=new Map;this.mReferencedOperations=new Map;this.mArrays=new Map;this.mIntegerExpressions=new Map;this.mFloatExpressions=new Map;this.mModifierTouchTargets=new Set;this.mModifierRan=new Set;this.mClock=e,this.mTimeVariables=new Go(e)}static{this.MAJOR_VERSION=1}static{this.MINOR_VERSION=1}static{this.PATCH_VERSION=0}static{this.DOCUMENT_API_LEVEL=8}getThemedColors(){if(this.mThemeColors===null){let e=[];this.collectColorThemes(this.mOperations,e),this.mThemeColors=e}return this.mThemeColors}collectColorThemes(e,t){for(let i of e)if(i instanceof er&&t.push(i),typeof i.getList=="function"){let r=i.getList();Array.isArray(r)&&this.collectColorThemes(r,t)}}static getDocumentApiLevel(){return o.DOCUMENT_API_LEVEL}getContentDescription(){return this.mContentDescription}setContentDescription(e){this.mContentDescription=e}getRequiredCapabilities(){return this.mCapabilities}setRequiredCapabilities(e){this.mCapabilities=e}setVersion(e,t,i){this.mVersion=new gm(e,t,i)}getWidth(){if(this.mRootLayoutComponent){let e=this.mRootLayoutComponent.getWidth();if(e>0)return e}return this.mWidth}setWidth(e){this.mWidth=e,this.mRemoteComposeState?.setWindowWidth(e)}getHeight(){if(this.mRootLayoutComponent){let e=this.mRootLayoutComponent.getHeight();if(e>0)return e}return this.mHeight}setHeight(e){this.mHeight=e,this.mRemoteComposeState?.setWindowHeight(e)}getAuthorWidth(){return this.mAuthorWidth??this.mHeader?.mWidth??this.mWidth}getAuthorHeight(){return this.mAuthorHeight??this.mHeader?.mHeight??this.mHeight}setAuthorDimensions(e,t){this.mAuthorWidth=e,this.mAuthorHeight=t}setProperties(e){this.mProperties=e}getProperty(e){return this.mProperties?.get(e)??null}getDensityBehavior(){if(this.mHeader)return this.mHeader.getInt(27,0);let e=this.getProperty(27);return typeof e=="number"?e:0}useFeature(e,t=0){return this.mHeader?this.mHeader.getInt(e,t)!==0:t!==0}getBuffer(){return this.mBuffer}setBuffer(e){this.mBuffer=e}getRemoteComposeState(){return this.mRemoteComposeState}getClock(){return this.mClock}getRootLayoutComponent(){return this.mRootLayoutComponent}getComponent(e){return this.mRootLayoutComponent?this.mRootLayoutComponent.getComponent(e):null}invalidateMeasure(){this.mRootLayoutComponent&&this.mRootLayoutComponent.invalidateMeasure()}getOperations(){return this.mOperations}getOpsPerFrame(){return this.mLastOpCount}setRootContentBehavior(e,t,i,r){this.mContentScroll=e,this.mContentAlignment=t,this.mContentSizing=i,this.mContentMode=r}getNextId(){return++this.mCurrentId}getProfileMask(){return this.mProfileMask}getText(e){let t=this.mTextData.get(e);return t===void 0?null:t}getArray(e){let t=this.mArrays.get(e);if(t)return t;let i=this.mRemoteComposeState.getArray?.(e);return i&&typeof i.getLength=="function"&&typeof i.getId=="function"?i:null}getReferencedOperationsObject(e){return this.mReferencedOperations.get(e)??null}initFromBuffer(e){this.mBuffer=e,this.mOperations=[],e.inflateFromBuffer(this.mOperations);let t=43;this.mTextData.clear(),this.mReferencedOperations.clear(),this.mProfileMask=0;for(let i of this.mOperations){let r=i.getComponentId,n=typeof r=="function"?r.call(i):i._providerId;typeof n=="number"&&n<2097152&&n>t&&(t=n),i instanceof Ct&&(this.mHeader=i,i.setVersion(this),this.mProfileMask=i.getProfiles?.()??0),i instanceof Re&&this.mTextData.set(i.mTextId,i.mText),i instanceof Be&&this.mReferencedOperations.set(i.getId(),i),i instanceof qi&&this.mArrays.set(i.getCollectionId(),i)}t+=10,this.mCurrentId=t,this.captureLoomBodies(this.mOperations,e),this.inflateComponents(this.mOperations),this.expandMacros()}captureLoomBodies(e,t){ma(e,t.getBuffer().getBuffer())}expandMacros(){let e=new nr(this),i=new Sr(this.mLoomManager,this,e,new Map,!1,0).expandRecursiveTop(this.mOperations,this.mLoomManager),r=ua(i);this.mOperations.length=0;for(let n of r)this.mOperations.push(n);this.mFloatExpressions.clear(),this.indexFloatExpressions(this.mOperations),this.mIntegerExpressions.clear(),this.indexIntegerExpressions(this.mOperations),this.mRootLayoutComponent=null;for(let n of this.mOperations)if(n instanceof ii){this.mRootLayoutComponent=n;break}}inflateComponents(e){for(let n of e)if(n instanceof Ct){this.mHeader=n,n.setVersion(this);break}let t=[],i=t,r=[];for(let n of e)if(n instanceof ii&&(this.mRootLayoutComponent=n),this.isContainer(n)){let s=n;r.push(s),i=s.getList()}else if(n instanceof $t){let s=null;r.length>0&&(s=r.pop()),r.length>0?i=r[r.length-1].getList():i=t,s&&(typeof s.inflate=="function"&&s.inflate(),i.push(s)),n instanceof Se&&r.length>0&&n.setComponent(r[r.length-1])}else i.push(n),n instanceof Se&&r.length>0&&n.setComponent(r[r.length-1]);e.length=0;for(let n of t)e.push(n);this.mFloatExpressions.clear(),this.indexFloatExpressions(e),this.mIntegerExpressions.clear(),this.indexIntegerExpressions(e)}indexIntegerExpressions(e){for(let t of e)t.constructor?.OP_CODE===144&&typeof t.getId=="function"&&this.mIntegerExpressions.set(t.getId(),t),typeof t.getList=="function"&&this.indexIntegerExpressions(t.getList())}evaluateIntExpression(e,t,i){let r=this.mIntegerExpressions.get(e)??this.mIntegerExpressions.get(e-4294967296)??this.mIntegerExpressions.get(Number(BigInt.asUintN(32,BigInt(Math.trunc(e)))));r&&i.overrideInteger(t,r.evaluateNow(i))}indexFloatExpressions(e){for(let t of e)t.constructor?.OP_CODE===81&&typeof t.mId=="number"&&this.mFloatExpressions.set(t.mId,t),typeof t.getList=="function"&&this.indexFloatExpressions(t.getList())}evaluateFloatExpression(e,t,i){let r=this.mFloatExpressions.get(e);if(r&&typeof r.evaluate=="function")i.overrideFloat(t,r.evaluate(i));else{let n=i.getFloat(e);typeof n=="number"&&!Number.isNaN(n)&&i.overrideFloat(t,n)}}isContainer(e){return typeof e.getList=="function"&&!(e instanceof $t)}initializeContext(e){e.setDocument(this),e.mRemoteComposeState=this.mRemoteComposeState,this.mRemoteComposeState.setContext(e)}seedTouchVersion(e){let t=this.getProperty(Ct.FEATURE_TOUCH_VERSION);e.setTouchVersion(typeof t=="number"?t:1)}seedDensityBehavior(e){let t=this.getProperty(Ct.DOC_DENSITY_BEHAVIOR);e.setDensityBehavior(typeof t=="number"?t:st.DENSITY_BEHAVIOR_LEGACY)}seedPlatformTextSize(e){let t=e.getDensity();t>0||(t=this.getProperty(7)||1),e.loadFloat(27,t),e.loadFloat(33,14*t*Pg)}applyDataOperations(e){e.setMode("DATA"),this.seedDensityBehavior(e),this.seedTouchVersion(e),this.seedPlatformTextSize(e),this.mTimeVariables.updateTime(e),this.registerVariables(e,this.mOperations),this.applyOperations(e,this.mOperations),e.setMode("UNSET")}applyOperations(e,t){for(let i of t){if(typeof i.updateVariables=="function"&&i.updateVariables(e),i.markNotDirty(),e.incrementOpCount(i),o.isEventModifier(i)){for(let r of i.getList?.()??[])o.isDefinition(r)&&(e.incrementOpCount(r),r.apply(e));continue}this.isContainer(i)?this.applyOperations(e,i.getList()):i.apply(e)}}static isDefinition(e){return e instanceof Re||e instanceof Ye||e instanceof Wi||e instanceof $e||e instanceof ze||e instanceof zi||e instanceof ki||e instanceof yt||e instanceof $i||e instanceof ji||e instanceof Ki}static isEventModifier(e){return e instanceof ye||e instanceof Ie||e instanceof _e||e instanceof le||e instanceof he}registerVariables(e,t){for(let i of t)typeof i.registerListening=="function"&&i.registerListening(e),typeof i.evaluateInLayout=="function"&&this.mLayoutComputeOps.add(i),typeof i.getList=="function"&&!(i instanceof $t)&&this.registerVariables(e,i.getList())}paint(e,t){e.mRemoteComposeState=this.mRemoteComposeState,this.mRemoteComposeState.setContext(e),this.mClickAreas.clear(),this.mTimeVariables.updateTime(e);for(let a of this.mOperations)if(a.isDirty()&&typeof a.updateVariables=="function"&&(a.markNotDirty(),a.updateVariables(e),a.apply(e)),a===this.mRootLayoutComponent)break;if(this.mRootLayoutComponent&&this.mLayoutComputeOps.size>0){let a=!0;for(let m=0;a&&m<2;m++){a=!1;for(let u of this.mLayoutComputeOps)u.evaluateInLayout(e)&&(a=!0)}}this.mRootLayoutComponent&&this.mRootLayoutComponent.needsMeasure()&&this.mRootLayoutComponent.layoutTree(e),this.mRootLayoutComponent&&this.mRootLayoutComponent.needsBoundsAnimation()&&(this.mNeedsRepaintFlag=1,this.mRootLayoutComponent.clearNeedsBoundsAnimation(),this.mRootLayoutComponent.animatingBounds(e)),e.setMode("PAINT"),e.clearLastOpCount(),e.beginMeasuredFrame();let i=this.getThemedColors();if(i.length>0&&t!==e.getPaintTheme())for(let a of i)a.setTheme(e,t);e.setPaintTheme(t),e.setTheme(Vt.UNSPECIFIED);let r=e.getDensity();(Number.isNaN(r)||r<=0)&&(r=this.getProperty(7)||1,e.setDensity(r)),e.loadFloat(27,r),this.seedDensityBehavior(e),this.seedTouchVersion(e),this.seedPlatformTextSize(e);let n=e.getPaintContext();n&&n.save();{let a=e.mRemoteComposeState??this.mRemoteComposeState;a?.setWindowWidth?.(e.mWidth),a?.setWindowHeight?.(e.mHeight)}if(this.mContentSizing===Ot.SIZING_SCALE){let a=[1,1];this.computeScale(e.mWidth,e.mHeight,a);let m=a[0],u=a[1],l=[0,0];this.computeTranslate(e.mWidth,e.mHeight,m,u,l),n&&(n.translate(l[0],l[1]),n.scale(m,u))}else this.setWidth(e.mWidth),this.setHeight(e.mHeight);for(let a of this.mOperations){let m=!0;if(t!==Vt.UNSPECIFIED){let u=e.getTheme();m=u===t||u===Vt.UNSPECIFIED||a instanceof Vt}m&&(a.isDirty()&&typeof a.updateVariables=="function"&&(a.markNotDirty(),a.updateVariables(e)),e.incrementOpCount(a),a.apply(e))}this.mLastOpCount=e.getLastOpCount(),e.emitMeasuredFrame(),n&&n.restore(),e.setMode("UNSET");let s=e.getPaintContext();s&&s.doesNeedsRepaint()||this.mRootLayoutComponent&&(this.mRootLayoutComponent.needsRepaint()||this.mRootLayoutComponent.needsBoundsAnimation())?this.mNeedsRepaintFlag=1:this.mNeedsRepaintFlag=this.mRemoteComposeState.getOpsToUpdate(e,this.mClock.millis())}needsRepaint(){return this.mNeedsRepaintFlag}needsMeasure(){return this.mRootLayoutComponent?.needsMeasure()??!1}measure(e,t,i,r,n){this.mRootLayoutComponent&&this.mRootLayoutComponent.measureDoc(e,t,i,r,n)}addClickArea(e,t,i,r,n,s,a){this.mClickAreas.add({id:e,contentDescription:t,left:i,top:r,right:n,bottom:s,metadata:a})}getClickAreas(){return this.mClickAreas}onClick(e,t,i){for(let r of this.mClickAreas)if(t>=r.left&&t<=r.right&&i>=r.top&&i<=r.bottom)return this.runAction(r.id,r.metadata),!0;return this.mRootLayoutComponent?this.mRootLayoutComponent.onClick(e,this,t,i):!1}addIdActionListener(e){this.mIdActionListeners.add(e)}getIdActionListeners(){return this.mIdActionListeners}addActionCallback(e){this.mActionCallbacks.push(e)}clearActionCallbacks(){this.mActionCallbacks=[]}runAction(e,t){for(let i of this.mIdActionListeners)i.onAction(e,t)}runNamedAction(e,t){for(let i of this.mActionCallbacks)i.onAction(e,t)}addTouchListener(e){this.mTouchListeners.add(e)}appliedTouchOperation(e){this.mAppliedTouchOperations.add(e)}modifierTouchTarget(e){this.mModifierTouchTargets.add(e)}touchModifierRan(e){this.mModifierRan.add(e)}runModifierTouchTargets(e,t){let i=!1;for(let r of this.mModifierTouchTargets)this.mModifierRan.has(r)||(r.runOwnTouchModifiers?.(e,t),i=!0);return this.mModifierTouchTargets.clear(),this.mModifierRan.clear(),i}hasTouchListener(){return this.mTouchListeners.size>0?!0:this.mRootLayoutComponent?.getHasTouchListeners()??!1}touchDown(e,t,i){this.mModifierTouchTargets.clear(),this.mModifierRan.clear(),e.loadFloat(st.ID_TOUCH_POS_X,t),e.loadFloat(st.ID_TOUCH_POS_Y,i);for(let n of this.mTouchListeners)n.touchDown(e,t,i);let r=this.mTouchListeners.size>0;return this.mRootLayoutComponent&&(r=this.mRootLayoutComponent.onTouchDown(e,this,t,i)||r),this.mNeedsRepaintFlag=1,r}touchDrag(e,t,i){e.loadFloat(st.ID_TOUCH_POS_X,t),e.loadFloat(st.ID_TOUCH_POS_Y,i);for(let n of this.mTouchListeners)n.touchDrag(e,t,i);let r=this.mTouchListeners.size>0;if(this.mRootLayoutComponent)for(let n of this.mAppliedTouchOperations)n.onTouchDrag(e,this,t,i,!0)&&(r=!0);return r}touchUp(e,t,i,r,n){e.loadFloat(st.ID_TOUCH_POS_X,t),e.loadFloat(st.ID_TOUCH_POS_Y,i);for(let a of this.mTouchListeners)a.touchUp(e,t,i,r,n);let s=this.mTouchListeners.size>0;if(this.mRootLayoutComponent){for(let a of this.mAppliedTouchOperations)a.onTouchUp(e,this,t,i,r,n,!0)&&(s=!0);this.runModifierTouchTargets(e,"up")&&(s=!0),this.mAppliedTouchOperations.clear()}return this.mNeedsRepaintFlag=1,s}touchCancel(e,t,i,r,n){if(this.mRootLayoutComponent){let s=!1;for(let a of this.mAppliedTouchOperations)a.onTouchCancel(e,this,t,i,!0)&&(s=!0);return this.runModifierTouchTargets(e,"cancel")&&(s=!0),this.mAppliedTouchOperations.clear(),this.mNeedsRepaintFlag=1,s}return this.mNeedsRepaintFlag=1,!1}performClick(e,t,i){for(let n of this.mClickAreas)if(n.id===t)return this.runAction(n.id,n.metadata),!0;this.runAction(t,i);let r=this.getComponent(t);return r?r.onClick?.(e,this,-1,-1)??!1:!1}computeScale(e,t,i){let r=1,n=1;if(this.mContentSizing===Ot.SIZING_SCALE){let s,a,m;switch(this.mContentMode){case Ot.SCALE_INSIDE:s=e/this.mWidth,a=t/this.mHeight,m=Math.min(1,Math.min(s,a)),r=m,n=m;break;case Ot.SCALE_FIT:s=e/this.mWidth,a=t/this.mHeight,m=Math.min(s,a),r=m,n=m;break;case Ot.SCALE_FILL_WIDTH:m=e/this.mWidth,r=m,n=m;break;case Ot.SCALE_FILL_HEIGHT:m=t/this.mHeight,r=m,n=m;break;case Ot.SCALE_CROP:s=e/this.mWidth,a=t/this.mHeight,m=Math.max(s,a),r=m,n=m;break;case Ot.SCALE_FILL_BOUNDS:r=e/this.mWidth,n=t/this.mHeight;break}}i[0]=r,i[1]=n}computeTranslate(e,t,i,r,n){let s=this.mContentAlignment&240,a=this.mContentAlignment&15,m=0,u=0,l=this.mWidth*i,h=this.mHeight*r;switch(s){case Ot.ALIGNMENT_START:break;case Ot.ALIGNMENT_HORIZONTAL_CENTER:m=(e-l)/2;break;case Ot.ALIGNMENT_END:m=e-l;break}switch(a){case Ot.ALIGNMENT_TOP:break;case Ot.ALIGNMENT_VERTICAL_CENTER:u=(t-h)/2;break;case Ot.ALIGNMENT_BOTTOM:u=t-h;break}n[0]=m,n[1]=u}setUpdateDoc(e){this.mIsUpdateDoc=e}isUpdateDoc(){return this.mIsUpdateDoc}applyUpdate(e){let t=new Map,i=new Map,r=new Map,n=new Map,s=new Map,a=new Map;this.recursiveTraverse(this.mOperations,m=>{m instanceof Re?t.set(m.mTextId,m):m instanceof oe?i.set(m.mImageId,m):m instanceof Ye?r.set(m.mId,m):m instanceof $e?n.set(m.mId,m):m instanceof ze?s.set(m.mId,m):m instanceof ui&&a.set(m.mId,m)}),this.recursiveTraverse(e.mOperations,m=>{if(m instanceof Re){let u=t.get(m.mTextId);u&&(u.update(m),u.markDirty())}else if(m instanceof oe){let u=i.get(m.mImageId);u&&(u.update(m),u.markDirty())}else if(m instanceof Ye){let u=r.get(m.mId);u&&(u.update(m),u.markDirty())}else if(m instanceof $e){let u=n.get(m.mId);u&&(u.update(m),u.markDirty())}else if(m instanceof ze){let u=s.get(m.mId);u&&(u.update(m),u.markDirty())}else if(m instanceof ui){let u=a.get(m.mId);u&&(u.update(m),u.markDirty())}})}recursiveTraverse(e,t){for(let i of e)typeof i.getList=="function"&&this.recursiveTraverse(i.getList(),t),t(i)}getNumberOfOps(){return this.mOperations.length}toNestedString(){return this.mOperations.map(e=>e.deepToString(" ")).join(`
|
|
77
|
+
`)}toString(){return`CoreDocument(${this.mOperations.length} ops, ${this.mWidth}x${this.mHeight})`}displayHierarchy(){return this.mRootLayoutComponent?this.mRootLayoutComponent.displayHierarchy():this.toString()}};function R(o){return o|0}var _g={system_accent1_0:R(4294967295),system_accent1_10:R(4294900735),system_accent1_50:R(4293849343),system_accent1_100:R(4292469503),system_accent1_200:R(4289775359),system_accent1_300:R(4287933156),system_accent1_400:R(4286222536),system_accent1_500:R(4284511916),system_accent1_600:R(4282867090),system_accent1_700:R(4281288056),system_accent1_800:R(4279578208),system_accent1_900:R(4278196549),system_accent1_1000:R(4278190080),system_accent2_0:R(4294967295),system_accent2_10:R(4294900735),system_accent2_50:R(4293849343),system_accent2_100:R(4292666105),system_accent2_200:R(4290823900),system_accent2_300:R(4288981953),system_accent2_400:R(4287271077),system_accent2_500:R(4285560715),system_accent2_600:R(4283915889),system_accent2_700:R(4282402393),system_accent2_800:R(4280954946),system_accent2_900:R(4279573292),system_accent2_1000:R(4278190080),system_accent3_0:R(4294967295),system_accent3_10:R(4294966271),system_accent3_50:R(4294962170),system_accent3_100:R(4294825978),system_accent3_200:R(4292918237),system_accent3_300:R(4291010753),system_accent3_400:R(4289234598),system_accent3_500:R(4287393164),system_accent3_600:R(4285683058),system_accent3_700:R(4284038489),system_accent3_800:R(4282459970),system_accent3_900:R(4280947244),system_accent3_1000:R(4278190080),system_neutral1_0:R(4294967295),system_neutral1_10:R(4294900735),system_neutral1_50:R(4294045943),system_neutral1_100:R(4293059305),system_neutral1_200:R(4291217101),system_neutral1_300:R(4289440689),system_neutral1_400:R(4287664279),system_neutral1_500:R(4285953917),system_neutral1_600:R(4284309092),system_neutral1_700:R(4282730060),system_neutral1_800:R(4281282614),system_neutral1_900:R(4279900960),system_neutral1_1000:R(4278190080),system_neutral2_0:R(4294967295),system_neutral2_10:R(4294900735),system_neutral2_50:R(4293980410),system_neutral2_100:R(4292993772),system_neutral2_200:R(4291151568),system_neutral2_300:R(4289309620),system_neutral2_400:R(4287598745),system_neutral2_500:R(4285888384),system_neutral2_600:R(4284243559),system_neutral2_700:R(4282664527),system_neutral2_800:R(4281217080),system_neutral2_900:R(4279835427),system_neutral2_1000:R(4278190080),system_error_0:R(4294967295),system_error_10:R(4294966271),system_error_50:R(4294962666),system_error_100:R(4294957782),system_error_200:R(4294948011),system_error_300:R(4294936957),system_error_400:R(4294923337),system_error_500:R(4292753200),system_error_600:R(4290386458),system_error_700:R(4287823882),system_error_800:R(4285071365),system_error_900:R(4282449922),system_error_1000:R(4278190080),system_on_surface_light:R(4279900960),system_on_surface_dark:R(4293059305),system_on_surface_variant_light:R(4282664527),system_on_surface_variant_dark:R(4291151568),system_on_surface_disabled:R(1629101086),system_surface_light:R(4294637823),system_surface_dark:R(4279374616),system_surface_disabled:R(521804830),system_surface_variant_light:R(4292993772),system_surface_variant_dark:R(4282664527),system_surface_bright_light:R(4294637823),system_surface_bright_dark:R(4281874751),system_surface_dim_light:R(4292532704),system_surface_dim_dark:R(4279374616),system_surface_container_lowest_light:R(4294967295),system_surface_container_lowest_dark:R(4278980115),system_surface_container_low_light:R(4294243322),system_surface_container_low_dark:R(4279900960),system_surface_container_light:R(4293848564),system_surface_container_dark:R(4280164133),system_surface_container_high_light:R(4293453807),system_surface_container_high_dark:R(4280822319),system_surface_container_highest_light:R(4293059305),system_surface_container_highest_dark:R(4281545786),system_background_light:R(4294637823),system_background_dark:R(4279374616),system_on_background_light:R(4279900960),system_on_background_dark:R(4293059305),system_primary_light:R(4282867090),system_primary_dark:R(4289775359),system_primary_container_light:R(4292469503),system_primary_container_dark:R(4281288056),system_on_primary_light:R(4294967295),system_on_primary_dark:R(4279578208),system_on_primary_container_light:R(4281288056),system_on_primary_container_dark:R(4292469503),system_on_primary_fixed:R(4278196549),system_on_primary_fixed_variant:R(4281288056),system_primary_fixed:R(4292469503),system_primary_fixed_dim:R(4289775359),system_secondary_light:R(4283915889),system_secondary_dark:R(4290823900),system_secondary_container_light:R(4292666105),system_secondary_container_dark:R(4282402393),system_on_secondary_light:R(4294967295),system_on_secondary_dark:R(4280954946),system_on_secondary_container_light:R(4282402393),system_on_secondary_container_dark:R(4292666105),system_on_secondary_fixed:R(4279573292),system_on_secondary_fixed_variant:R(4282402393),system_secondary_fixed:R(4292666105),system_secondary_fixed_dim:R(4290823900),system_tertiary_light:R(4285683058),system_tertiary_dark:R(4292918237),system_tertiary_container_light:R(4294825978),system_tertiary_container_dark:R(4284038489),system_on_tertiary_light:R(4294967295),system_on_tertiary_dark:R(4282459970),system_on_tertiary_container_light:R(4284038489),system_on_tertiary_container_dark:R(4294825978),system_on_tertiary_fixed:R(4280947244),system_on_tertiary_fixed_variant:R(4284038489),system_tertiary_fixed:R(4294825978),system_tertiary_fixed_dim:R(4292918237),system_error_light:R(4290386458),system_error_dark:R(4294948011),system_error_container_light:R(4294957782),system_error_container_dark:R(4287823882),system_on_error_light:R(4294967295),system_on_error_dark:R(4285071365),system_on_error_container_light:R(4287823882),system_on_error_container_dark:R(4294957782),system_outline_light:R(4285888384),system_outline_dark:R(4287598745),system_outline_variant_light:R(4291151568),system_outline_variant_dark:R(4282664527),system_outline_disabled:R(521804830),system_control_activated_light:R(4292469503),system_control_activated_dark:R(4281288056),system_control_normal_light:R(4282664527),system_control_normal_dark:R(4291151568),system_control_highlight_light:R(4278190080),system_control_highlight_dark:R(4294967295),system_palette_key_color_primary_light:R(4284511916),system_palette_key_color_primary_dark:R(4284511916),system_palette_key_color_secondary_light:R(4285560715),system_palette_key_color_secondary_dark:R(4285560715),system_palette_key_color_tertiary_light:R(4287393164),system_palette_key_color_tertiary_dark:R(4287393164),system_palette_key_color_neutral_light:R(4285953917),system_palette_key_color_neutral_dark:R(4285953917),system_palette_key_color_neutral_variant_light:R(4285888384),system_palette_key_color_neutral_variant_dark:R(4285888384),system_text_hint_inverse_light:R(4293059305),system_text_hint_inverse_dark:R(4279900960),system_text_primary_inverse_light:R(4293059305),system_text_primary_inverse_dark:R(4279900960),system_text_primary_inverse_disable_only_light:R(4293059305),system_text_primary_inverse_disable_only_dark:R(4279900960),system_text_secondary_and_tertiary_inverse_light:R(4291151568),system_text_secondary_and_tertiary_inverse_dark:R(4282664527),system_text_secondary_and_tertiary_inverse_disabled_light:R(4293059305),system_text_secondary_and_tertiary_inverse_disabled_dark:R(4279900960),holo_blue_bright:R(4278246911),holo_blue_dark:R(4278229452),holo_blue_light:R(4281578981),holo_green_dark:R(4284913920),holo_green_light:R(4288269312),holo_orange_dark:R(4294936576),holo_orange_light:R(4294949683),holo_purple:R(4289357516),holo_red_dark:R(4291559424),holo_red_light:R(4294919236),background_dark:R(4278190080),background_light:R(4294967295),black:R(4278190080),darker_gray:R(4289374890),tab_indicator_text:R(4286611584)};function gh(o){return _g[o]}var Pr=class extends st{constructor(t,i=gr){super(i);this.namedVariables=new Map;this.namedColorOverrides=new Map;this.namedStringOverrides=new Map;this.namedBooleanOverrides=new Map;this.namedIntegerOverrides=new Map;this.namedFloatOverrides=new Map;this.audioContext=null;this.soundBytes=new Map;this.soundBuffers=new Map;this.soundDecoding=new Set;this.soundSources=new Map;this.canvasPaintContext=t,this.mPaintContext=t}loadPathData(t,i,r){this.mRemoteComposeState.putPathData(t,r),this.mRemoteComposeState.putPathWinding(t,i),this.canvasPaintContext.loadPathData(t,i,r)}getPathData(t){return this.mRemoteComposeState.getPathData(t)}loadVariableName(t,i,r){if(this.namedVariables.set(t,{id:i,type:r}),r===2){let n=t.startsWith("color.")?t.substring(6):t,s=gh(n);s!==void 0&&!this.namedColorOverrides.has(t)&&this.mRemoteComposeState.overrideColor(i,s)}}getNamedVariables(){return this.namedVariables}getVariableNameMap(){let t=new Map;return this.namedVariables.forEach(({id:i},r)=>t.set(i,r)),t}loadColor(t,i){this.mRemoteComposeState.updateColor(t,i)}setNamedColorOverride(t,i){this.namedColorOverrides.set(t,i);let r=this.namedVariables.get(t);r&&this.mRemoteComposeState.overrideColor(r.id,i)}getColor(t){return this.mRemoteComposeState.getColor(t)}setNamedStringOverride(t,i){this.namedStringOverrides.set(t,i);let r=this.namedVariables.get(t);r&&(this.mRemoteComposeState.overrideData(r.id,i),this.canvasPaintContext.loadText(r.id,i))}clearNamedStringOverride(t){this.namedStringOverrides.delete(t);let i=this.namedVariables.get(t);i&&this.mRemoteComposeState.clearDataOverride(i.id)}setNamedBooleanOverride(t,i){this.namedBooleanOverrides.set(t,i)}clearNamedBooleanOverride(t){this.namedBooleanOverrides.delete(t)}setNamedIntegerOverride(t,i){this.namedIntegerOverrides.set(t,i);let r=this.namedVariables.get(t);r&&this.mRemoteComposeState.overrideInteger(r.id,i)}clearNamedIntegerOverride(t){this.namedIntegerOverrides.delete(t);let i=this.namedVariables.get(t);i&&this.mRemoteComposeState.clearIntegerOverride(i.id)}setNamedFloatOverride(t,i){this.namedFloatOverrides.set(t,i);let r=this.namedVariables.get(t);r&&this.mRemoteComposeState.overrideFloat(r.id,i)}clearNamedFloatOverride(t){this.namedFloatOverrides.delete(t);let i=this.namedVariables.get(t);i&&this.mRemoteComposeState.clearFloatOverride(i.id)}setNamedLong(t,i){}setNamedDataOverride(t,i){let r=this.namedVariables.get(t);r&&this.mRemoteComposeState.overrideData(r.id,i)}clearNamedDataOverride(t){let i=this.namedVariables.get(t);i&&this.mRemoteComposeState.clearDataOverride(i.id)}setNamedFloatArrayOverride(t,i){let r=this.namedVariables.get(t);r&&this.mRemoteComposeState.overrideFloatArray(r.id,i)}clearNamedFloatArrayOverride(t){let i=this.namedVariables.get(t);i&&this.mRemoteComposeState.clearFloatArrayOverride(i.id)}addCollection(t,i){this.mRemoteComposeState.addCollection(t,i)}putDataMap(t,i){this.mRemoteComposeState.putDataMap(t,i)}getDataMap(t){return this.mRemoteComposeState.getDataMap(t)}runAction(t,i){this.mDocument?.runAction(t,i)}runNamedAction(t,i){let r=this.mRemoteComposeState.getFromId(t);this.mDocument?.runNamedAction(r,i)}putObject(t,i){this.mRemoteComposeState.updateObject(t,i)}getObject(t){return this.mRemoteComposeState.getObject(t)}hapticEffect(t){}loadBitmap(t,i,r,n,s,a){this.canvasPaintContext.loadBitmap(t,i,r,n,s,a)}loadFont(t,i){super.loadFont(t,i),this.canvasPaintContext.loadFont(t,i)}loadText(t,i){this.mRemoteComposeState.isDataOverridden(t)||(this.mRemoteComposeState.cacheDataWithId(t,i),this.canvasPaintContext.loadText(t,i))}getText(t){return this.canvasPaintContext.getText(t)}loadFloat(t,i){this.mRemoteComposeState.updateFloat(t,i)}overrideFloat(t,i){this.mRemoteComposeState.overrideFloat(t,i)}getFloat(t){return this.mRemoteComposeState.getFloat(t)}loadInteger(t,i){this.mRemoteComposeState.updateInteger(t,i)}overrideInteger(t,i){this.mRemoteComposeState.overrideInteger(t,i)}getInteger(t){return this.mRemoteComposeState.getInteger(t)}getLong(t){return this.mRemoteComposeState.getInteger(t)}overrideText(t,i){let r=this.mRemoteComposeState.getFromId(i);r&&this.loadText(t,r)}loadAnimatedFloat(t,i){}loadShader(t,i){this.mRemoteComposeState.updateObject(t,i)}getShader(t){return this.mRemoteComposeState.getObject(t)}getAudioContext(){try{if(!this.audioContext){let t=typeof window<"u"&&(window.AudioContext||window.webkitAudioContext)||(typeof AudioContext<"u"?AudioContext:void 0);if(!t)return null;this.audioContext=new t}return this.audioContext}catch(t){return console.warn("RemoteCompose: failed to create AudioContext",t),null}}loadSound(t,i){try{let r=this.soundBytes.get(t);if(r&&r.length===i.length&&r.every((n,s)=>n===i[s]))return;this.soundBytes.set(t,i.slice()),this.soundBuffers.delete(t)}catch(r){console.warn(`RemoteCompose: loadSound(${t}) failed`,r)}}playSound(t){try{let i=this.getAudioContext();if(!i)return;i.resume?.().catch(()=>{});let r=this.soundBuffers.get(t);if(r){this.startBuffer(i,r,t);return}let n=this.soundBytes.get(t);if(!n||this.soundDecoding.has(t))return;this.soundDecoding.add(t);let s=n.slice().buffer,a=i.decodeAudioData(s);a&&typeof a.then=="function"?a.then(m=>{this.soundDecoding.delete(t),this.soundBytes.get(t)===n&&(this.soundBuffers.set(t,m),this.startBuffer(i,m,t))}).catch(m=>{this.soundDecoding.delete(t),console.warn(`RemoteCompose: decode sound(${t}) failed`,m)}):this.soundDecoding.delete(t)}catch(i){this.soundDecoding.delete(t),console.warn(`RemoteCompose: playSound(${t}) failed`,i)}}startBuffer(t,i,r){try{let n=this.soundSources.get(r);if(n)try{n.stop()}catch{}let s=t.createBufferSource();this.soundSources.set(r,s),s.onended=()=>{this.soundSources.get(r)===s&&this.soundSources.delete(r)},s.buffer=i;let a=t.createGain();a.gain.value=1,s.connect(a).connect(t.destination),s.start(0)}catch(n){console.warn("RemoteCompose: startBuffer failed",n)}}listensTo(t,i){this.mRemoteComposeState.listenToVar(t,i)}addClickArea(t,i,r,n,s,a,m){let u=this.mRemoteComposeState.getFromId(i)??"",l=this.mRemoteComposeState.getFromId(m)??"";this.mDocument?.addClickArea(t,u,r,n,s,a,l)}updateOps(){return this.mRemoteComposeState.getOpsToUpdate(this,Date.now())}};function Ih(o,e="fit"){let t={kind:"",path:o,fit:e,crop:[0,0,1,1],mirror:!1,gate:0,persist:!1,hasStep:!1,step:0,stepId:-1,timeId:-1,prevStepId:-1,prevTimeId:-1,hasWindow:!1,from:0,to:-1,speed:1,start:0,still:-1,loop:!0,until:-1,zooms:[]},i=o.indexOf(":");i>0&&/^[a-z]+$/.test(o.slice(0,i))&&(t.kind=o.slice(0,i),t.path=o.slice(i+1)),t.kind==="camera"&&(t.fit="fill",(!t.path||t.path.startsWith("#"))&&(t.path="default"+t.path));let r=t.path.indexOf("#");if(r>=0){let n=t.path.slice(r+1);t.path=t.path.slice(0,r);for(let s of n.split("&")){let a=s.indexOf("=");if(a<0){s==="persist"?t.persist=!0:s==="once"?t.loop=!1:s==="mirror"?t.mirror=!0:s&&(t.fit=s);continue}let m=s.slice(0,a),u=s.slice(a+1);if(m==="fit")t.fit=u;else if(m==="mirror")t.mirror=!(u==="0"||u==="false"||u==="off");else if(m==="persist")t.persist=!(u==="0"||u==="false"||u==="off");else if(m==="step")t.hasStep=!0,t.step=parseFloat(u)||0,t.persist=!0;else if(m==="stepid")t.stepId=parseInt(u,10);else if(m==="timeid")t.timeId=parseInt(u,10);else if(m==="prevstepid")t.prevStepId=parseInt(u,10);else if(m==="prevtimeid")t.prevTimeId=parseInt(u,10);else if(m==="from")t.hasWindow=!0,t.from=parseFloat(u)||0,t.persist=!0;else if(m==="to")t.hasWindow=!0,t.to=parseFloat(u),t.persist=!0;else if(m==="speed")t.speed=parseFloat(u)||1;else if(m==="start")t.start=Math.max(0,parseFloat(u)||0);else if(m==="until")t.until=parseFloat(u);else if(m==="loop")t.loop=!["0","false","off","no","once"].includes(u);else if(m==="zooms")t.zooms=Rg(u);else if(m==="still"){let l=parseFloat(u);t.still=isNaN(l)?-1:Math.max(0,l)}else if(m==="gate")t.gate=parseFloat(u)||0;else if(m==="crop"){let l=u.split(",").map(parseFloat);l.length===4&&l.every(h=>!isNaN(h))&&(t.crop=[l[0],l[1],l[2],l[3]])}}}return t}function ha(o,e,t,i,r){let n;r==="fill"?n=Math.max(o/t,e/i):r==="native"?n=1:n=Math.min(o/t,e/i);let s=t*n,a=i*n;return{s:n,ox:(o-s)*.5,oy:(e-a)*.5}}var bh=.55;function Rg(o){let e=[];for(let t of o.split(";")){let i=t.indexOf("@");if(i<0)continue;let[r,n,s]=t.slice(i+1).split(",").map(parseFloat);e.push({t:parseFloat(t.slice(0,i))||0,x:isNaN(r)?.5:r,y:isNaN(n)?.5:n,z:Math.max(1,isNaN(s)?1:s)})}return e.sort((t,i)=>t.t-i.t)}function yh(o,e,t){if(!o.length)return t;let i=d=>1-Math.pow(1-Math.min(1,Math.max(0,d)),4),r=(d,p,b)=>({x:d.x+(p.x-d.x)*b,y:d.y+(p.y-d.y)*b,lz:d.lz+(p.lz-d.lz)*b}),n={x:.5,y:.5,lz:0},s=n,a=-1e9;for(let d of o){if(d.t>e)break;n=r(n,s,i((d.t-a)/bh)),s={x:d.x,y:d.y,lz:Math.log(d.z)},a=d.t}let m=r(n,s,i((e-a)/bh)),u=.5/Math.exp(m.lz),l=Math.min(1-u,Math.max(u,m.x)),h=Math.min(1-u,Math.max(u,m.y)),c=t[2]-t[0],f=t[3]-t[1];return[t[0]+(l-u)*c,t[1]+(h-u)*f,t[0]+(l+u)*c,t[1]+(h+u)*f]}var so=class{constructor(e){this.inputs=null;this.docs=new Map;this.videos=new Map;this.camera=null;this.take=null;this.defaultFit="fit";this.pending=0;this.resolver=e??(async t=>{try{let i=await fetch(t);return i.ok?await i.arrayBuffer():null}catch{return null}})}setResolver(e){this.resolver=e}setDefaultFit(e){this.defaultFit=e}setCameraTake(e,t=!1){if(this.take&&this.take.src===e){this.take.framed=t;return}if(this.take&&(this.take.element.pause(),this.take.element.remove(),this.take=null),!e||typeof document>"u")return;let i=document.createElement("video");i.src=e,i.muted=!0,i.playsInline=!0,i.preload="auto",i.style.cssText="position:fixed;left:0;top:0;width:2px;height:2px;opacity:0;pointer-events:none",document.body.appendChild(i);let r={element:i,src:e,ready:!1,framed:t};i.addEventListener("loadeddata",()=>{r.ready=!0}),this.take=r}setCameraTakeTime(e,t){let i=this.take;if(!i||!i.ready)return;let r=i.element;if(t&&r.paused&&r.play().catch(()=>{}),!t&&!r.paused&&r.pause(),Math.abs(r.currentTime-e)>.25)try{r.currentTime=e}catch{}}retire(){for(let[e,t]of this.docs)t.persist||(t.paint&&t.paint.dispose(),this.docs.delete(e));for(let[e,t]of this.videos)t.element.pause(),t.element.removeAttribute("src"),this.videos.delete(e)}reset(){for(let e of this.docs.values())e.paint&&e.paint.dispose();this.docs.clear(),this.retire()}drawCustom(e,t,i,r,n,s,a){if(r<=0||n<=0)return!1;if(this.inputs?.draw(e,t,i,r,n,a))return!0;if(t.startsWith("rc:input/")){if(i instanceof We){let l=i.getCanvas();l.save(),l.font="14px system-ui",l.fillStyle="#555",l.fillText("Input unavailable \xB7 Update player or open app",4,20,Math.max(1,r-8)),l.restore()}return!0}let m=Ih(t,this.defaultFit);if(!m.path)return!1;if(m.kind==="video")return this.drawVideo(m,i,r,n);if(m.kind==="camera")return this.drawCamera(m,i,r,n);if(m.kind==="web")return this.drawWebFrame(m,i,r,n);if(m.kind&&m.kind!=="rc")return!1;let u=()=>this.drawRc(m,t,i,r,n,s);return this.inputs?this.inputs.withDocument(`${e}:${t}`,u):u()}drawRc(e,t,i,r,n,s){if(e.gate>0&&s<e.gate)return!0;let a=i;if(typeof a.getCanvas!="function")return!1;let m=a.getCanvas(),u=e.persist?"persist:"+e.path:t,l=this.docs.get(u);if(l||(l={persist:e.persist,ok:!1,failed:!1,doc:null,ctx:null,paint:null,hostBase:0,hostLast:0,curStep:-1,prevStep:-1,prevTime:0},this.docs.set(u,l),this.load(l,e.path,m)),!l.ok)return l.failed||i.needsRepaint(),!0;let h=l.doc,c=l.ctx,f=l.paint,d=h.getWidth(),p=h.getHeight();d<=0&&(d=r),p<=0&&(p=n);let b=yh(e.zooms,s,e.crop);e.zooms.length&&i.needsRepaint();let g=b[0]*d,C=b[1]*p,y=(b[2]-b[0])*d,I=(b[3]-b[1])*p;(y<=0||I<=0)&&(y=d,I=p);let{s:T,ox:v,oy:_}=ha(r,n,y,I,e.fit),P=s;if(e.hasStep&&e.step!==l.curStep&&(l.curStep>=0&&(l.prevStep=l.curStep,l.prevTime=l.hostLast),l.curStep=e.step),l.persist&&(s+1e-6<l.hostLast&&(l.hostBase+=l.hostLast),l.hostLast=s,P=l.hostBase+s),f.setCanvas(m),c.mWidth=d,c.mHeight=p,c.currentTime=Date.now(),e.hasWindow){let E=s*e.speed;e.to>e.from&&(E=Math.min(E,e.to-e.from)),P=e.from+Math.max(E,0)}c.overrideFloat(st.ID_ANIMATION_TIME,P),c.setAnimationTime(P),e.hasStep&&e.stepId>=0&&c.overrideFloat(e.stepId,e.step),e.timeId>=0&&c.overrideFloat(e.timeId,s),e.prevStepId>=0&&c.overrideFloat(e.prevStepId,l.prevStep),e.prevTimeId>=0&&c.overrideFloat(e.prevTimeId,l.prevTime),a.matrixSave(),a.clipRect(0,0,r,n),m.translate(v,_),m.scale(T,T),m.translate(-g,-C),a.clipRect(0,0,d,p),f.reset(),f.inheritInputClip(a),f.clearNeedsRepaint();try{h.paint(c,Vt.DARK)}finally{a.matrixRestore()}return(h.needsRepaint()>=0||f.doesNeedsRepaint())&&i.needsRepaint(),!0}async load(e,t,i){this.pending++;try{let r=await this.resolver(t);if(!r||r.byteLength===0){e.failed=!0;return}let n=new ri;n.initFromBuffer(di.fromArrayBuffer(r));let s=new We(null,i),a=new Pr(s);n.initializeContext(a),a.setPaintContext(s),s.setContext(a),a.mWidth=n.getWidth(),a.mHeight=n.getHeight(),a.setDensity(1),a.setCustomHost(this),n.applyDataOperations(a),await new Promise(m=>setTimeout(m,50)),e.doc=n,e.ctx=a,e.paint=s,e.ok=!0}catch(r){console.error("embed: cannot load "+t,r),e.failed=!0}finally{this.pending--}}drawVideo(e,t,i,r){let n=t;if(typeof n.getCanvas!="function"||typeof document>"u")return!1;let s=n.getCanvas(),a=e.still>=0,m=e.until>e.start,u=a?e.path+"@"+e.still:e.path+"#"+e.start+(m?"-"+e.until:""),l=this.videos.get(u);if(!l){let v=document.createElement("video");v.src=e.path,v.muted=!0,v.loop=!a&&!m&&e.loop&&e.start<=0,v.playsInline=!0,v.preload="auto";let _={element:v,ready:!1};l=_;let P=a?e.still:e.start;P>0?(v.addEventListener("loadedmetadata",()=>{v.currentTime=P},{once:!0}),v.addEventListener("seeked",()=>{_.ready=!0},{once:!0})):v.addEventListener("loadeddata",()=>{_.ready=!0}),a||(e.loop&&!m&&e.start>0&&v.addEventListener("ended",()=>{v.currentTime=e.start,v.play().catch(()=>{})}),v.play().catch(()=>{})),this.videos.set(u,l)}let h=l.element.videoWidth,c=l.element.videoHeight;if((!a||!l.ready)&&t.needsRepaint(),!l.ready||h<=0||c<=0)return!0;let f=m&&l.element.currentTime>=e.until;f&&!l.element.paused&&(l.element.pause(),l.element.currentTime=e.until),!a&&!f&&l.element.paused&&!l.element.ended&&l.element.play().catch(()=>{});let d=yh(e.zooms,a?e.still:l.element.currentTime,e.crop);e.zooms.length&&!a&&t.needsRepaint();let p=d[0]*h,b=d[1]*c,g=(d[2]-d[0])*h,C=(d[3]-d[1])*c;(g<=0||C<=0)&&(g=h,C=c);let{s:y,ox:I,oy:T}=ha(i,r,g,C,e.fit);return s.save(),s.beginPath(),s.rect(0,0,i,r),s.clip(),s.drawImage(l.element,p,b,g,C,I,T,g*y,C*y),s.restore(),!0}drawCamera(e,t,i,r){let n=t;if(typeof n.getCanvas!="function"||typeof document>"u")return!1;let s=n.getCanvas();if(this.take){let m=this.take.framed?{...e,crop:[0,0,1,1]}:e;return this.drawVideoInto(s,this.take.element,m,i,r,this.take.ready),t.needsRepaint(),!0}if(!this.camera){let m=document.createElement("video");m.muted=!0,m.playsInline=!0,m.autoplay=!0,m.style.cssText="position:fixed;left:0;top:0;width:2px;height:2px;opacity:0;pointer-events:none",document.body.appendChild(m);let u={element:m,ready:!1,failed:!1,stream:null};this.camera=u;let l=typeof navigator<"u"?navigator.mediaDevices:void 0;!l||!l.getUserMedia?u.failed=!0:l.getUserMedia({video:{facingMode:"user",width:{ideal:1280},height:{ideal:720}},audio:!1}).then(h=>{u.stream=h,m.srcObject=h,m.addEventListener("loadeddata",()=>{u.ready=!0}),m.play().catch(()=>{})}).catch(h=>{console.warn("camera: not available",h),u.failed=!0})}let a=this.camera;return this.drawVideoInto(s,a.element,e,i,r,a.ready),a.failed||t.needsRepaint(),!0}drawVideoInto(e,t,i,r,n,s){e.save(),e.beginPath(),e.rect(0,0,r,n),e.clip();let a=t.videoWidth,m=t.videoHeight;if(!s||a<=0||m<=0){e.fillStyle="#101318",e.fillRect(0,0,r,n),e.restore();return}let u=i.crop[0]*a,l=i.crop[1]*m,h=(i.crop[2]-i.crop[0])*a,c=(i.crop[3]-i.crop[1])*m;(h<=0||c<=0)&&(h=a,c=m);let{s:f,ox:d,oy:p}=ha(r,n,h,c,i.fit);i.mirror&&(e.translate(r,0),e.scale(-1,1)),e.drawImage(t,u,l,h,c,d,p,h*f,c*f),e.restore()}drawWebFrame(e,t,i,r){let n=t;if(typeof n.getCanvas!="function")return!1;let s=n.getCanvas();s.save(),s.beginPath(),s.rect(0,0,i,r),s.clip(),s.fillStyle="#171a20",s.fillRect(0,0,i,r),s.strokeStyle="#2a2f38",s.lineWidth=2,s.strokeRect(1,1,i-2,r-2),s.fillStyle="#868d9c";let a=Math.max(12,Math.min(i*.03,r*.08));return s.font=`${a}px -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif`,s.textAlign="center",s.textBaseline="middle",s.fillText(e.path,i*.5,r*.5,i*.9),s.restore(),!0}};function Ch(o,e,t){return o!==null&&o>0?o:e>0?e:t>0?t:1}function ca(o){let e=atob(o),t=new Uint8Array(e.length);for(let i=0;i<e.length;i++)t[i]=e.charCodeAt(i);return t.buffer}function bm(o,e={}){let t=document.createElement("canvas");t.width=256,t.height=256,e.background&&(t.style.background=e.background),o.appendChild(t);let i=new _r(t);e.theme&&i.setTheme(e.theme),e.onLoad&&i.setOnLoad(e.onLoad);let r=()=>{e.width!=null&&e.height!=null&&i.resize(e.width,e.height)};if(e.data){let s=ca(e.data);i.loadFromArrayBuffer(s).then(r)}else e.buffer?i.loadFromArrayBuffer(e.buffer).then(r):e.src&&i.loadFromUrl(e.src).then(r);return{async loadFromUrl(s){let a=await i.loadFromUrl(s);return r(),a},async loadFromBase64(s){let a=ca(s),m=await i.loadFromArrayBuffer(a);return r(),m},async loadFromArrayBuffer(s){let a=await i.loadFromArrayBuffer(s);return r(),a},resize(s,a){i.resize(s,a)},destroy(){i.destroy(),t.remove()},player:i,canvas:t}}var Bg=typeof HTMLElement<"u"?HTMLElement:class{},oo=class extends Bg{constructor(){super();this._handle=null;this._shadow=this.attachShadow({mode:"open"}),this._shadow.innerHTML=`
|
|
78
|
+
<style>
|
|
79
|
+
:host { display: inline-block; }
|
|
80
|
+
.container { display: inline-block; }
|
|
81
|
+
canvas { display: block; }
|
|
82
|
+
</style>
|
|
83
|
+
<div class="container"></div>
|
|
84
|
+
`,this._container=this._shadow.querySelector(".container")}static{this.observedAttributes=["src","data","width","height","theme","background"]}connectedCallback(){this._init()}disconnectedCallback(){this._handle&&(this._handle.destroy(),this._handle=null)}attributeChangedCallback(t,i,r){if(this._handle)if(t==="src"&&r)this._handle.loadFromUrl(r);else if(t==="data"&&r)this._handle.loadFromBase64(r);else if(t==="width"||t==="height"){let n=parseInt(this.getAttribute("width")||"0",10),s=parseInt(this.getAttribute("height")||"0",10);n>0&&s>0&&this._handle.resize(n,s)}else t==="theme"&&r?this._handle.player.setTheme(r):t==="background"&&r&&(this._handle.canvas.style.background=r)}_init(){if(this._handle)return;let t={},i=this.getAttribute("src"),r=this.getAttribute("data"),n=this.getAttribute("width"),s=this.getAttribute("height"),a=this.getAttribute("theme"),m=this.getAttribute("background");i&&(t.src=i),r&&(t.data=r),n&&s&&(t.width=parseInt(n,10),t.height=parseInt(s,10)),a&&(t.theme=a),m&&(t.background=m),this._handle=bm(this._container,t)}};var Dg=new Date(2026,0,1,0,0,0,0).getTime();function wg(o,e,t=e){let i=o&&o.document,r=i&&i.mTimeVariables,n=Dg+Math.round(e*1e3),s=!1,a=[r&&r.getClock&&r.getClock(),i&&i.getClock&&i.getClock(),o&&o.remoteContext&&o.remoteContext.getClock&&o.remoteContext.getClock()];for(let m of a)m&&(m.millis=()=>n,m.snapshot=()=>fr(n),s=!0);return r&&(r.getElapsedSeconds=()=>t),s}var ym=["string","float","color","image","int","long","float_array"],Lg=o=>"#"+(o>>>0).toString(16).toUpperCase().padStart(8,"0");function Ng(o){if(typeof o=="number"&&Number.isFinite(o))return o|0;let e=/^#?([0-9a-f]{6}|[0-9a-f]{8})$/i.exec(String(o).trim());if(!e)return null;let t=parseInt(e[1],16);return e[1].length===6&&(t=4278190080+t),t|0}function Vg(o){let e=Array.isArray(o)?o.map(Number):String(o).split(/[\s,;[\]]+/).filter(t=>t!=="").map(Number);return e.length&&e.every(Number.isFinite)?e:null}var Wg=50;function kg(o){let e=[],t=[],i=new Map,r=new Map,n=null,s=!1,a=()=>o.getRemoteContext(),m=()=>a()?.getNamedVariables()??new Map;function u(g){let C=a(),y=m().get(g);if(!(!C||!y))switch(ym[y.type]){case"float":return C.getFloat(y.id);case"int":return C.getInteger(y.id);case"long":return C.mRemoteComposeState.getObject(y.id)?.getValue?.()??0;case"color":return Lg(C.getColor(y.id));case"string":return C.getText(y.id)??"";case"float_array":{let I=C.mRemoteComposeState,T=I.getDynamicFloats(y.id)??I.getArray(y.id)?.getFloats?.();return T?Array.from(T):[]}default:return}}function l(g,C){let y=a(),I=m().get(g);if(!y||!I)return!1;switch(ym[I.type]){case"float":{let T=Number(C);return Number.isFinite(T)?(y.setNamedFloatOverride(g,T),!0):!1}case"int":{let T=Number(C);return Number.isFinite(T)?(y.setNamedIntegerOverride(g,Math.trunc(T)),!0):!1}case"long":return!1;case"color":{let T=Ng(C);return T===null?!1:(y.setNamedColorOverride(g,T),!0)}case"string":return y.setNamedStringOverride(g,String(C)),!0;case"float_array":{let T=Vg(C);return T?(y.setNamedFloatArrayOverride(g,T),!0):!1}default:return!1}}function h(g){n=g,g.addActionCallback({onAction:(C,y)=>{if(!(s||n!==g)){for(let I of e.slice())if(I.name==="*"||I.name===C)try{I.handler(y,C)}catch(T){console.error(T)}}}}),c=!1,f()}let c=!1;function f(){if(!(c||!n||!m().size)){c=!0;for(let[g,C]of i)l(g,C);o.repaint?.()}}function d(){if(s)return;let g=o.getDocument();if(g&&g!==n&&h(g),f(),!t.length||!n)return;let C=t.some(y=>y.name==="*")?[...m().keys()]:[...new Set(t.map(y=>y.name))];for(let y of C){let I=u(y),T=JSON.stringify(I);if(r.get(y)===T)continue;let v=!r.has(y);if(r.set(y,T),!v){for(let _ of t.slice())if(_.name==="*"||_.name===y)try{_.handler(I,y)}catch(P){console.error(P)}}}}let p=setInterval(d,Wg);d();let b=(g,C)=>()=>{let y=g.indexOf(C);y>=0&&g.splice(y,1)};return{variables(){let g={};for(let[C,y]of m())g[C]=ym[y.type]??"string";return g},get:u,set(g,C){let y=l(g,C);return y&&(i.set(g,C),o.repaint?.()),y},onAction(g,C){let y={name:g,handler:C};return e.push(y),b(e,y)},onChange(g,C){let y={name:g,handler:C};return t.push(y),g!=="*"&&!r.has(g)&&r.set(g,JSON.stringify(u(g))),b(t,y)},dispose(){s=!0,clearInterval(p),e.length=0,t.length=0}}}function Hg(o,e=360){if(!o.length||new Set(o.map(a=>a.key)).size!==o.length||!Number.isInteger(e)||e<=0||o.some(a=>!a.key.trim()||!a.label.trim()||a.options?.some(m=>!m||m.includes(`
|
|
85
|
+
`))))throw new Error("Invalid input fields");let t=o.map(a=>a.kind?{text:G.TEXT,choice:G.CHOICE,toggle:G.TOGGLE,number:G.NUMBER,range:G.RANGE}[a.kind]:a.options?.length?G.CHOICE:G.TEXT);o.forEach((a,m)=>{if(a.chrome!==void 0&&a.chrome!=="default"&&a.chrome!=="none"||!t[m]||a.multiline&&t[m]!==G.TEXT||(t[m]===G.CHOICE?!a.options?.length:a.options?.length)||a.options&&new Set(a.options).size!==a.options.length||![G.NUMBER,G.RANGE].some(u=>u===t[m])&&[a.minimum,a.maximum,a.step].some(u=>u!==void 0)||[a.minimum,a.maximum,a.step].some(u=>u!==void 0&&!Number.isFinite(u))||a.minimum!==void 0&&a.maximum!==void 0&&a.minimum>a.maximum||a.step!==void 0&&a.step<=0||a.submit&&a.submitLabel!==void 0&&!a.submitLabel.trim()||!(!a.value&&(t[m]===G.CHOICE||t[m]===G.NUMBER))&&!dr(t[m],a.value??"",a.options,a.minimum,a.maximum,a.step)||t[m]===G.RANGE&&!dr(t[m],String(a.maximum),a.options,a.minimum,a.maximum,a.step))throw new Error("Invalid input field")});let i=new ve,r=(a,...m)=>{i.start(a),m.forEach(u=>i.writeInt(u))},n=(a,m,u)=>{r(a,m),i.writeFloat(u)},s=a=>a.multiline?136:a.submit||a.kind==="range"?112:80;r(0,76283905,2,0,3),i.writeShort(Ct.DOC_PROFILES),i.writeShort(4),i.writeInt(513),i.writeShort(5),i.writeShort(4),i.writeInt(e),i.writeShort(6),i.writeShort(4),i.writeInt(o.reduce((a,m)=>a+s(m)+4,0)),o.forEach((a,m)=>{[t[m],a.value??"",a.key,a.label,(a.options??[]).join(`
|
|
86
|
+
`),a.submit??"",a.minimum===void 0?"":String(a.minimum),a.maximum===void 0?"":String(a.maximum),a.step===void 0?"":String(a.step),a.submitLabel??"Send"].forEach((l,h)=>{r(102,100+m*16+h),i.writeUTF8(l)})}),r(200,1),r(204,3,0,1,4),i.writeFloat(4),n(16,1,1),n(67,2,0),r(201,4),o.forEach((a,m)=>{let u=100+m*16;r(93,10+m,0,u,13);for(let[l,h,c]of[[1,2,u+1],[2,4,u+1],[3,2,u+2],[4,2,u+3],[5,0,a.multiline?1:0],[6,2,u+4],[7,2,u+5],[8,2,u+6],[9,2,u+7],[10,2,u+8],[11,0,a.enabled===!1?0:1],[12,2,u+9],[13,0,a.chrome==="none"?1:0]])i.writeShort(l),i.writeShort(h),i.writeInt(c);n(16,1,1),n(67,0,s(a)),r(214)});for(let a=0;a<3;a++)r(214);return i.getBuffer().slice(0,i.getSize()).buffer}var Ug=8,_r=class{constructor(e){this.document=null;this.paintContext=null;this.remoteContext=null;this.animationFrameId=null;this.repaintTimeoutId=null;this.startTime=0;this.onLoad=null;this.themeOverride="auto";this.variableListener=null;this.measurementSink=null;this.density=typeof window<"u"&&window.devicePixelRatio||1;this.densityExplicit=!1;this.pointerIsDown=!1;this.pointerHistory=[];this.pointerDownX=0;this.pointerDownY=0;this.pointerHasMoved=!1;this.mContentScale=1;this.mContentOffsetX=0;this.mContentOffsetY=0;this.isPaused=!1;this.customHost=new so;this.inputEditing=!1;this.bitmapVideos=null;this.onPointerDown=e=>{if(!this.document||!this.remoteContext)return;this.pointerIsDown=!0;try{this.canvas.setPointerCapture(e.pointerId)}catch{}let{x:t,y:i}=this.canvasCoords(e);this.pointerDownX=t,this.pointerDownY=i,this.pointerHasMoved=!1,this.pointerHistory=[{x:t,y:i,t:performance.now()}],this.remoteContext.loadFloat(st.ID_TOUCH_EVENT_TIME,this.remoteContext.getAnimationTime()),this.document.touchDown(this.remoteContext,t,i),this.scheduleRepaint(),window.addEventListener("pointermove",this.onPointerMove,{passive:!1}),window.addEventListener("pointerup",this.onPointerUp,{passive:!1}),window.addEventListener("pointercancel",this.onPointerCancel,{passive:!1})};this.onPointerMove=e=>{if(!this.pointerIsDown||!this.document||!this.remoteContext)return;let{x:t,y:i}=this.canvasCoords(e);if(!this.pointerHasMoved){let r=t-this.pointerDownX,n=i-this.pointerDownY,s=Ug/(this.mContentScale||1);r*r+n*n>s*s&&(this.pointerHasMoved=!0)}this.pointerHistory.push({x:t,y:i,t:performance.now()}),this.pointerHistory.length>5&&this.pointerHistory.shift(),this.remoteContext.loadFloat(st.ID_TOUCH_EVENT_TIME,this.remoteContext.getAnimationTime()),this.document.touchDrag(this.remoteContext,t,i),this.scheduleRepaint()};this.onPointerUp=e=>{if(!this.pointerIsDown||!this.document||!this.remoteContext)return;this.pointerIsDown=!1;try{this.canvas.releasePointerCapture(e.pointerId)}catch{}window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("pointercancel",this.onPointerCancel);let{x:t,y:i}=this.canvasCoords(e),{dx:r,dy:n}=this.computeVelocity(t,i);this.remoteContext.loadFloat(st.ID_TOUCH_EVENT_TIME,this.remoteContext.getAnimationTime()),this.pointerHasMoved||this.document.onClick(this.remoteContext,t,i),this.document.touchUp(this.remoteContext,t,i,r,n),this.pointerHistory=[],this.scheduleRepaint()};this.onPointerCancel=e=>{if(!this.pointerIsDown||!this.document||!this.remoteContext)return;this.pointerIsDown=!1;try{this.canvas.releasePointerCapture(e.pointerId)}catch{}window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("pointercancel",this.onPointerCancel);let{x:t,y:i}=this.canvasCoords(e),{dx:r,dy:n}=this.computeVelocity(t,i);this.remoteContext.loadFloat(st.ID_TOUCH_EVENT_TIME,this.remoteContext.getAnimationTime()),this.document.touchCancel(this.remoteContext,t,i,r,n),this.pointerHasMoved=!1,this.pointerHistory=[],this.scheduleRepaint()};this.naturalWidth=0;this.naturalHeight=0;this.renderFrame=e=>{if(this.animationFrameId=null,!this.document||!this.remoteContext||!this.paintContext)return;let t=(e-this.startTime)/1e3;this.remoteContext.setAnimationTime(t),this.remoteContext.currentTime=Date.now(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.mContentScale=1,this.mContentOffsetX=0,this.mContentOffsetY=0,this.paintContext.reset(),this.paintContext.clearNeedsRepaint();let i;if(this.themeOverride==="light"?i=Vt.LIGHT:this.themeOverride==="dark"?i=Vt.DARK:i=window.matchMedia?.("(prefers-color-scheme: dark)").matches?Vt.DARK:Vt.LIGHT,this.customHost.inputs?.beginFrame(),this.document.paint(this.remoteContext,i),this.customHost.inputs?.endFrame(),this.variableListener&&this.variableListener(this.remoteContext.mRemoteComposeState.getFloatEntries()),this.isPaused)return;let r=this.document.needsRepaint();r>=0&&(r<=1?this.animationFrameId=requestAnimationFrame(this.renderFrame):this.repaintTimeoutId=setTimeout(()=>{this.repaintTimeoutId=null,this.scheduleRepaint()},r))};this.customHost.inputs=new pr(e,{editable:!1}),this.canvas=e;let t=e.getContext("2d");if(!t)throw new Error("Could not get 2D context");this.ctx=t,this.setupPointerEvents()}setupPointerEvents(){this.canvas.addEventListener("pointerdown",this.onPointerDown)}canvasCoords(e){let t=this.canvas.getBoundingClientRect(),i=this.canvas.width/t.width,r=this.canvas.height/t.height,n=(e.clientX-t.left)*i,s=(e.clientY-t.top)*r,a=this.mContentScale||1;return{x:(n-this.mContentOffsetX)/a,y:(s-this.mContentOffsetY)/a}}computeVelocity(e,t){if(this.pointerHistory.length<2)return{dx:0,dy:0};let i=this.pointerHistory[0],n=(performance.now()-i.t)/1e3;return n<=0?{dx:0,dy:0}:{dx:(e-i.x)/n,dy:(t-i.y)/n}}scheduleRepaint(){this.isPaused||(this.repaintTimeoutId!==null&&(clearTimeout(this.repaintTimeoutId),this.repaintTimeoutId=null),this.animationFrameId===null&&(this.animationFrameId=requestAnimationFrame(this.renderFrame)))}pause(){this.isPaused=!0,this.stop()}play(){this.isPaused=!1,this.scheduleRepaint()}getIsPaused(){return this.isPaused}setOnLoad(e){this.onLoad=e}setTheme(e){this.themeOverride=e,this.scheduleRepaint()}setVariableListener(e){this.variableListener=e}removeVariableListener(){this.variableListener=null}setMeasurementSink(e){this.measurementSink=e,this.remoteContext?.setMeasurementSink(e)}setDensity(e){e>0&&!Number.isNaN(e)&&(this.density=e,this.densityExplicit=!0,this.remoteContext?.setDensity(e),this.scheduleRepaint())}getDensity(){return this.density}getNaturalSize(){return this.document?{width:this.naturalWidth,height:this.naturalHeight}:null}measureSize(){let e=this.document?.getRootLayoutComponent()?.getMeasuredContentSize();if(!e)return null;let{width:t,height:i}=e;return Number.isFinite(t)&&t>0&&Number.isFinite(i)&&i>0?{width:t,height:i}:null}getOpsPerFrame(){return this.document?.getOpsPerFrame()??0}async loadFromArrayBuffer(e){this.stop(),this.paintContext&&this.paintContext.destroy();let t=di.fromArrayBuffer(e),i=new ri;i.initFromBuffer(t),this.document=i,this.naturalWidth=i.getWidth(),this.naturalHeight=i.getHeight();let r=Ch(this.densityExplicit?this.density:null,i.getProperty(Ct.DOC_DENSITY_AT_GENERATION)||0,this.density);this.densityExplicit||(this.density=r);let n=this.canvas.width,s=this.canvas.height;return i.setWidth(n),i.setHeight(s),this.paintContext&&(typeof this.paintContext.destroy=="function"&&this.paintContext.destroy(),typeof this.paintContext.dispose=="function"&&this.paintContext.dispose()),this.paintContext=new We(null,this.ctx),this.paintContext.onFontLoaded=()=>{this.document?.invalidateMeasure(),this.scheduleRepaint()},this.paintContext.setBitmapVideos(this.bitmapVideos),this.remoteContext=new Pr(this.paintContext),i.initializeContext(this.remoteContext),this.remoteContext.setPaintContext(this.paintContext),this.paintContext.setContext(this.remoteContext),this.customHost.retire(),this.remoteContext.setCustomHost(this.customHost),this.remoteContext.mWidth=n,this.remoteContext.mHeight=s,this.remoteContext.setDensity(r),this.measurementSink&&this.remoteContext.setMeasurementSink(this.measurementSink),i.applyDataOperations(this.remoteContext),await this.paintContext.bitmapsReady(),this.onLoad&&this.onLoad(i),this.startTime=performance.now(),this.renderFrame(this.startTime),i}async loadFromUrl(e){let t=await fetch(e);if(!t.ok)throw new Error(`Document request failed: HTTP ${t.status}`);let i=await t.arrayBuffer();return this.loadFromArrayBuffer(i)}stop(){this.cancelRepaint(),this.pointerIsDown&&(this.pointerIsDown=!1,window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("pointercancel",this.onPointerCancel))}cancelRepaint(){this.repaintTimeoutId!==null&&(clearTimeout(this.repaintTimeoutId),this.repaintTimeoutId=null),this.animationFrameId!==null&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}destroy(){this.customHost.inputs?.dispose(),this.stop(),this.canvas.removeEventListener("pointerdown",this.onPointerDown),this.paintContext&&this.paintContext.destroy()}repaint(){this.cancelRepaint(),this.document&&this.renderFrame(performance.now())}async fontsReady(){await Ra(),this.document?.invalidateMeasure()}resize(e,t){this.canvas.width=e,this.canvas.height=t;let i=this.remoteContext?.getDensity()||this.density||1;this.canvas.style.width=e/i+"px",this.canvas.style.height=t/i+"px",this.remoteContext&&(this.remoteContext.mWidth=e,this.remoteContext.mHeight=t),this.document&&(this.document.setWidth(e),this.document.setHeight(t),this.document.invalidateMeasure()),this.repaint()}setEmbedResolver(e){this.customHost.setResolver(e)}setBitmapVideos(e){this.bitmapVideos=e}configureInputs(e){this.customHost.inputs?.dispose(),this.inputEditing=e.editable,this.customHost.inputs=new pr(this.canvas,e),this.repaint()}inputCapabilities(){return{components:this.customHost.inputs?[G.TEXT,G.CHOICE,G.TOGGLE,G.NUMBER,G.RANGE]:[],editing:this.inputEditing}}setCameraTake(e,t=!1){this.customHost.setCameraTake(e,t)}setCameraTakeTime(e,t){this.customHost.setCameraTakeTime(e,t)}getCustomHost(){return this.customHost}getDocument(){return this.document}getRemoteContext(){return this.remoteContext}async screenshot(e="image/png",t){return this.withInputSnapshot(()=>new Promise((i,r)=>{this.canvas.toBlob(n=>n?i(n):r(new Error("toBlob failed")),e,t)}))}screenshotDataURL(e="image/png",t){return this.withInputSnapshot(()=>this.canvas.toDataURL(e,t))}withInputSnapshot(e){let t=this.customHost.inputs;if(!t)return e();try{return t.withCanvasExport(()=>(this.repaint(),e()))}finally{this.repaint()}}async saveScreenshot(e="screenshot.png"){let t=await this.screenshot(),i=URL.createObjectURL(t),r=document.createElement("a");r.href=i,r.download=e,r.click(),URL.revokeObjectURL(i)}};typeof window<"u"&&(window.RcdPlayer=_r,window.RC={RcdPlayer:_r,createPlayer:bm,RcPlayerElement:oo,base64ToArrayBuffer:ca},customElements.get("rc-player")||customElements.define("rc-player",oo));export{Aa as GOOGLE_PREFIX,G as Input,Bo as InputChrome,oo as RcPlayerElement,_r as RcdPlayer,so as WebCustomHost,pr as WebInputComponents,ca as base64ToArrayBuffer,tc as configureWebFonts,kg as createHostApi,bm as createPlayer,fr as createSnapshot,xi as cssFontStackFor,Oo as cssQuoted,Xa as decompressDocument,ou as embeddedFontDescriptors,xo as ensureWebFont,ha as fitInto,iu as googleFontsAxisUrl,eu as googleFontsUrl,Hg as inputDocument,dr as inputValueIsValid,Ya as isCompressed,Na as namedFontStack,Ih as parseEmbedConfig,Pa as parseFamily,wg as pinClock,_a as registerEmbeddedFont,Ao as releaseEmbeddedFont,ac as resetWebFonts,Ra as webFontsReady};
|