@tresjs/cientos 3.4.0 → 3.5.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 +1 -1
- package/dist/composables/useLogger.d.ts +8 -0
- package/dist/core/abstractions/GlobalAudio.d.ts +50 -0
- package/dist/core/abstractions/Lensflare/RandUtils.d.ts +68 -0
- package/dist/core/abstractions/Lensflare/component.vue.d.ts +69 -0
- package/dist/core/abstractions/Lensflare/constants.d.ts +20 -0
- package/dist/core/abstractions/Lensflare/index.d.ts +36 -0
- package/dist/core/abstractions/Levioso.vue.d.ts +52 -0
- package/dist/core/abstractions/MouseParallax.vue.d.ts +58 -0
- package/dist/core/abstractions/Text3D.vue.d.ts +234 -0
- package/dist/core/abstractions/index.d.ts +10 -0
- package/dist/core/abstractions/useAnimations.d.ts +18 -0
- package/dist/core/abstractions/useFBO/component.vue.d.ts +37 -0
- package/dist/core/abstractions/useFBO/index.d.ts +10 -0
- package/dist/core/controls/CameraControls.vue.d.ts +10026 -0
- package/dist/core/controls/KeyboardControls.vue.d.ts +167 -0
- package/dist/core/controls/MapControls.vue.d.ts +54 -0
- package/dist/core/controls/OrbitControls.vue.d.ts +456 -0
- package/dist/core/controls/PointerLockControls.vue.d.ts +75 -0
- package/dist/core/controls/ScrollControls.vue.d.ts +101 -0
- package/dist/core/controls/TransformControls.vue.d.ts +124 -0
- package/dist/core/controls/index.d.ts +8 -0
- package/dist/core/directives/index.d.ts +5 -0
- package/dist/core/directives/vAlwaysLookAt.d.ts +4 -0
- package/dist/core/directives/vDistanceTo.d.ts +4 -0
- package/dist/core/directives/vLightHelper.d.ts +5 -0
- package/dist/core/directives/vLog.d.ts +3 -0
- package/dist/core/index.d.ts +8 -0
- package/dist/core/loaders/SVG/component.vue.d.ts +68 -0
- package/dist/core/loaders/index.d.ts +8 -0
- package/dist/core/loaders/useFBX/component.vue.d.ts +24 -0
- package/dist/core/loaders/useFBX/index.d.ts +9 -0
- package/dist/core/loaders/useGLTF/component.vue.d.ts +65 -0
- package/dist/core/loaders/useGLTF/index.d.ts +36 -0
- package/dist/core/loaders/useProgress.d.ts +6 -0
- package/dist/core/loaders/useVideoTexture.d.ts +28 -0
- package/dist/core/materials/index.d.ts +3 -0
- package/dist/core/materials/meshGlassMaterial/index.vue.d.ts +4 -0
- package/dist/core/materials/meshGlassMaterial/material.d.ts +31 -0
- package/dist/core/materials/meshWobbleMaterial/index.vue.d.ts +23 -0
- package/dist/core/materials/meshWobbleMaterial/material.d.ts +16 -0
- package/dist/core/misc/Stats.d.ts +13 -0
- package/dist/core/misc/StatsGl.d.ts +10 -0
- package/dist/core/misc/html/HTML.vue.d.ts +133 -0
- package/dist/core/misc/html/utils.d.ts +18 -0
- package/dist/core/misc/index.d.ts +5 -0
- package/dist/core/misc/useTweakPane/index.d.ts +10 -0
- package/dist/core/shapes/Box.vue.d.ts +53 -0
- package/dist/core/shapes/CatmullRomCurve3.vue.d.ts +112 -0
- package/dist/core/shapes/Circle.vue.d.ts +52 -0
- package/dist/core/shapes/Cone.vue.d.ts +52 -0
- package/dist/core/shapes/Dodecahedron.vue.d.ts +52 -0
- package/dist/core/shapes/Icosahedron.vue.d.ts +52 -0
- package/dist/core/shapes/Line2.vue.d.ts +120 -0
- package/dist/core/shapes/Octahedron.vue.d.ts +52 -0
- package/dist/core/shapes/Plane.vue.d.ts +52 -0
- package/dist/core/shapes/Ring.vue.d.ts +52 -0
- package/dist/core/shapes/Sphere.vue.d.ts +53 -0
- package/dist/core/shapes/Tetrahedron.vue.d.ts +52 -0
- package/dist/core/shapes/Torus.vue.d.ts +52 -0
- package/dist/core/shapes/TorusKnot.vue.d.ts +52 -0
- package/dist/core/shapes/Tube.vue.d.ts +53 -0
- package/dist/core/shapes/index.d.ts +16 -0
- package/dist/core/staging/Backdrop.vue.d.ts +44 -0
- package/dist/core/staging/Precipitation.vue.d.ts +226 -0
- package/dist/core/staging/Sky.vue.d.ts +77 -0
- package/dist/core/staging/Smoke.vue.d.ts +146 -0
- package/dist/core/staging/Stars.vue.d.ts +145 -0
- package/dist/core/staging/index.d.ts +8 -0
- package/dist/core/staging/useEnvironment/const.d.ts +51 -0
- package/dist/core/staging/useEnvironment/index.d.ts +3 -0
- package/dist/index.d.ts +2 -0
- package/dist/trescientos.js +40015 -0
- package/dist/trescientos.umd.cjs +1726 -0
- package/dist/utils/easing.d.ts +5 -0
- package/dist/utils/index.d.ts +22 -0
- package/package.json +24 -17
|
@@ -0,0 +1,1726 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* name: @tresjs/cientos
|
|
3
|
+
* version: v3.5.0
|
|
4
|
+
* (c) 2023
|
|
5
|
+
* description: Collection of useful helpers and fully functional, ready-made abstractions for Tres
|
|
6
|
+
* author: Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)
|
|
7
|
+
*/
|
|
8
|
+
(function(k,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("three"),require("vue"),require("@tresjs/core"),require("tweakpane")):typeof define=="function"&&define.amd?define(["exports","three","vue","@tresjs/core","tweakpane"],c):(k=typeof globalThis<"u"?globalThis:k||self,c(k.trescientos={},k.Three,k.Vue,k.TresjsCore,k.tweakpane))})(this,function(k,c,p,Ae,A2){"use strict";var KI=Object.defineProperty;var XI=(k,c,p)=>c in k?KI(k,c,{enumerable:!0,configurable:!0,writable:!0,value:p}):k[c]=p;var Ve=(k,c,p)=>(XI(k,typeof c!="symbol"?c+"":c,p),p);var Bt=Uint8Array,Mn=Uint16Array,Ta=Uint32Array,Yl=new Bt([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,0,0,0]),jl=new Bt([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,0,0]),f2=new Bt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ql=function(t,e){for(var n=new Mn(31),r=0;r<31;++r)n[r]=e+=1<<t[r-1];for(var i=new Ta(n[30]),r=1;r<30;++r)for(var s=n[r];s<n[r+1];++s)i[s]=s-n[r]<<5|r;return[n,i]},Kl=ql(Yl,2),Xl=Kl[0],d2=Kl[1];Xl[28]=258,d2[258]=28;for(var p2=ql(jl,0),g2=p2[0],Ma=new Mn(32768),Oe=0;Oe<32768;++Oe){var Dn=(Oe&43690)>>>1|(Oe&21845)<<1;Dn=(Dn&52428)>>>2|(Dn&13107)<<2,Dn=(Dn&61680)>>>4|(Dn&3855)<<4,Ma[Oe]=((Dn&65280)>>>8|(Dn&255)<<8)>>>1}for(var qr=function(t,e,n){for(var r=t.length,i=0,s=new Mn(e);i<r;++i)++s[t[i]-1];var a=new Mn(e);for(i=0;i<e;++i)a[i]=a[i-1]+s[i-1]<<1;var o;if(n){o=new Mn(1<<e);var l=15-e;for(i=0;i<r;++i)if(t[i])for(var h=i<<4|t[i],u=e-t[i],A=a[t[i]-1]++<<u,f=A|(1<<u)-1;A<=f;++A)o[Ma[A]>>>l]=h}else for(o=new Mn(r),i=0;i<r;++i)t[i]&&(o[i]=Ma[a[t[i]-1]++]>>>15-t[i]);return o},Kr=new Bt(288),Oe=0;Oe<144;++Oe)Kr[Oe]=8;for(var Oe=144;Oe<256;++Oe)Kr[Oe]=9;for(var Oe=256;Oe<280;++Oe)Kr[Oe]=7;for(var Oe=280;Oe<288;++Oe)Kr[Oe]=8;for(var Zl=new Bt(32),Oe=0;Oe<32;++Oe)Zl[Oe]=5;var m2=qr(Kr,9,1),v2=qr(Zl,5,1),Da=function(t){for(var e=t[0],n=1;n<t.length;++n)t[n]>e&&(e=t[n]);return e},Ft=function(t,e,n){var r=e/8|0;return(t[r]|t[r+1]<<8)>>(e&7)&n},La=function(t,e){var n=e/8|0;return(t[n]|t[n+1]<<8|t[n+2]<<16)>>(e&7)},y2=function(t){return(t/8|0)+(t&7&&1)},C2=function(t,e,n){(e==null||e<0)&&(e=0),(n==null||n>t.length)&&(n=t.length);var r=new(t instanceof Mn?Mn:t instanceof Ta?Ta:Bt)(n-e);return r.set(t.subarray(e,n)),r},I2=function(t,e,n){var r=t.length;if(!r||n&&!n.l&&r<5)return e||new Bt(0);var i=!e||n,s=!n||n.i;n||(n={}),e||(e=new Bt(r*3));var a=function(z){var P=e.length;if(z>P){var K=new Bt(Math.max(P*2,z));K.set(e),e=K}},o=n.f||0,l=n.p||0,h=n.b||0,u=n.l,A=n.d,f=n.m,d=n.n,m=r*8;do{if(!u){n.f=o=Ft(t,l,1);var y=Ft(t,l+1,3);if(l+=3,y)if(y==1)u=m2,A=v2,f=9,d=5;else if(y==2){var g=Ft(t,l,31)+257,v=Ft(t,l+10,15)+4,w=g+Ft(t,l+5,31)+1;l+=14;for(var b=new Bt(w),B=new Bt(19),_=0;_<v;++_)B[f2[_]]=Ft(t,l+_*3,7);l+=v*3;for(var E=Da(B),T=(1<<E)-1,L=qr(B,E,1),_=0;_<w;){var R=L[Ft(t,l,T)];l+=R&15;var C=R>>>4;if(C<16)b[_++]=C;else{var V=0,Y=0;for(C==16?(Y=3+Ft(t,l,3),l+=2,V=b[_-1]):C==17?(Y=3+Ft(t,l,7),l+=3):C==18&&(Y=11+Ft(t,l,127),l+=7);Y--;)b[_++]=V}}var q=b.subarray(0,g),ne=b.subarray(g);f=Da(q),d=Da(ne),u=qr(q,f,1),A=qr(ne,d,1)}else throw"invalid block type";else{var C=y2(l)+4,x=t[C-4]|t[C-3]<<8,I=C+x;if(I>r){if(s)throw"unexpected EOF";break}i&&a(h+x),e.set(t.subarray(C,I),h),n.b=h+=x,n.p=l=I*8;continue}if(l>m){if(s)throw"unexpected EOF";break}}i&&a(h+131072);for(var X=(1<<f)-1,G=(1<<d)-1,H=l;;H=l){var V=u[La(t,l)&X],Z=V>>>4;if(l+=V&15,l>m){if(s)throw"unexpected EOF";break}if(!V)throw"invalid length/literal";if(Z<256)e[h++]=Z;else if(Z==256){H=l,u=null;break}else{var $=Z-254;if(Z>264){var _=Z-257,O=Yl[_];$=Ft(t,l,(1<<O)-1)+Xl[_],l+=O}var F=A[La(t,l)&G],S=F>>>4;if(!F)throw"invalid distance";l+=F&15;var ne=g2[S];if(S>3){var O=jl[S];ne+=La(t,l)&(1<<O)-1,l+=O}if(l>m){if(s)throw"unexpected EOF";break}i&&a(h+131072);for(var Q=h+$;h<Q;h+=4)e[h]=e[h-ne],e[h+1]=e[h+1-ne],e[h+2]=e[h+2-ne],e[h+3]=e[h+3-ne];h=Q}}n.l=u,n.p=H,n.b=h,u&&(o=1,n.m=f,n.d=A,n.n=d)}while(!o);return h==e.length?e:C2(e,0,h)},x2=new Bt(0),S2=function(t){if((t[0]&15)!=8||t[0]>>>4>7||(t[0]<<8|t[1])%31)throw"invalid zlib data";if(t[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function B2(t,e){return I2((S2(t),t.subarray(2,-4)),e)}var w2=typeof TextDecoder<"u"&&new TextDecoder,b2=0;try{w2.decode(x2,{stream:!0}),b2=1}catch{}function Pa(){}Pa.prototype.s2u=function(t){for(var e=this.s2uTable,n="",r=0;r<t.length;){var i=t[r++];if(!(i>=0&&i<=126||i>=161&&i<=223)&&r<t.length&&(i=i<<8|t[r++]),e[i]===void 0)return console.error("unknown char code "+i+"."),n;n+=String.fromCharCode(e[i])}return n},Pa.prototype.s2uTable={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,14:14,15:15,16:16,17:17,18:18,19:19,20:20,21:21,22:22,23:23,24:24,25:25,26:26,27:27,28:28,29:29,30:30,31:31,32:32,33:33,34:34,35:35,36:36,37:37,38:38,39:39,40:40,41:41,42:42,43:43,44:44,45:45,46:46,47:47,48:48,49:49,50:50,51:51,52:52,53:53,54:54,55:55,56:56,57:57,58:58,59:59,60:60,61:61,62:62,63:63,64:64,65:65,66:66,67:67,68:68,69:69,70:70,71:71,72:72,73:73,74:74,75:75,76:76,77:77,78:78,79:79,80:80,81:81,82:82,83:83,84:84,85:85,86:86,87:87,88:88,89:89,90:90,91:91,92:92,93:93,94:94,95:95,96:96,97:97,98:98,99:99,100:100,101:101,102:102,103:103,104:104,105:105,106:106,107:107,108:108,109:109,110:110,111:111,112:112,113:113,114:114,115:115,116:116,117:117,118:118,119:119,120:120,121:121,122:122,123:123,124:124,125:125,126:126,161:65377,162:65378,163:65379,164:65380,165:65381,166:65382,167:65383,168:65384,169:65385,170:65386,171:65387,172:65388,173:65389,174:65390,175:65391,176:65392,177:65393,178:65394,179:65395,180:65396,181:65397,182:65398,183:65399,184:65400,185:65401,186:65402,187:65403,188:65404,189:65405,190:65406,191:65407,192:65408,193:65409,194:65410,195:65411,196:65412,197:65413,198:65414,199:65415,200:65416,201:65417,202:65418,203:65419,204:65420,205:65421,206:65422,207:65423,208:65424,209:65425,210:65426,211:65427,212:65428,213:65429,214:65430,215:65431,216:65432,217:65433,218:65434,219:65435,220:65436,221:65437,222:65438,223:65439,33088:12288,33089:12289,33090:12290,33091:65292,33092:65294,33093:12539,33094:65306,33095:65307,33096:65311,33097:65281,33098:12443,33099:12444,33100:180,33101:65344,33102:168,33103:65342,33104:65507,33105:65343,33106:12541,33107:12542,33108:12445,33109:12446,33110:12291,33111:20189,33112:12293,33113:12294,33114:12295,33115:12540,33116:8213,33117:8208,33118:65295,33119:65340,33120:65374,33121:8741,33122:65372,33123:8230,33124:8229,33125:8216,33126:8217,33127:8220,33128:8221,33129:65288,33130:65289,33131:12308,33132:12309,33133:65339,33134:65341,33135:65371,33136:65373,33137:12296,33138:12297,33139:12298,33140:12299,33141:12300,33142:12301,33143:12302,33144:12303,33145:12304,33146:12305,33147:65291,33148:65293,33149:177,33150:215,33152:247,33153:65309,33154:8800,33155:65308,33156:65310,33157:8806,33158:8807,33159:8734,33160:8756,33161:9794,33162:9792,33163:176,33164:8242,33165:8243,33166:8451,33167:65509,33168:65284,33169:65504,33170:65505,33171:65285,33172:65283,33173:65286,33174:65290,33175:65312,33176:167,33177:9734,33178:9733,33179:9675,33180:9679,33181:9678,33182:9671,33183:9670,33184:9633,33185:9632,33186:9651,33187:9650,33188:9661,33189:9660,33190:8251,33191:12306,33192:8594,33193:8592,33194:8593,33195:8595,33196:12307,33208:8712,33209:8715,33210:8838,33211:8839,33212:8834,33213:8835,33214:8746,33215:8745,33224:8743,33225:8744,33226:65506,33227:8658,33228:8660,33229:8704,33230:8707,33242:8736,33243:8869,33244:8978,33245:8706,33246:8711,33247:8801,33248:8786,33249:8810,33250:8811,33251:8730,33252:8765,33253:8733,33254:8757,33255:8747,33256:8748,33264:8491,33265:8240,33266:9839,33267:9837,33268:9834,33269:8224,33270:8225,33271:182,33276:9711,33359:65296,33360:65297,33361:65298,33362:65299,33363:65300,33364:65301,33365:65302,33366:65303,33367:65304,33368:65305,33376:65313,33377:65314,33378:65315,33379:65316,33380:65317,33381:65318,33382:65319,33383:65320,33384:65321,33385:65322,33386:65323,33387:65324,33388:65325,33389:65326,33390:65327,33391:65328,33392:65329,33393:65330,33394:65331,33395:65332,33396:65333,33397:65334,33398:65335,33399:65336,33400:65337,33401:65338,33409:65345,33410:65346,33411:65347,33412:65348,33413:65349,33414:65350,33415:65351,33416:65352,33417:65353,33418:65354,33419:65355,33420:65356,33421:65357,33422:65358,33423:65359,33424:65360,33425:65361,33426:65362,33427:65363,33428:65364,33429:65365,33430:65366,33431:65367,33432:65368,33433:65369,33434:65370,33439:12353,33440:12354,33441:12355,33442:12356,33443:12357,33444:12358,33445:12359,33446:12360,33447:12361,33448:12362,33449:12363,33450:12364,33451:12365,33452:12366,33453:12367,33454:12368,33455:12369,33456:12370,33457:12371,33458:12372,33459:12373,33460:12374,33461:12375,33462:12376,33463:12377,33464:12378,33465:12379,33466:12380,33467:12381,33468:12382,33469:12383,33470:12384,33471:12385,33472:12386,33473:12387,33474:12388,33475:12389,33476:12390,33477:12391,33478:12392,33479:12393,33480:12394,33481:12395,33482:12396,33483:12397,33484:12398,33485:12399,33486:12400,33487:12401,33488:12402,33489:12403,33490:12404,33491:12405,33492:12406,33493:12407,33494:12408,33495:12409,33496:12410,33497:12411,33498:12412,33499:12413,33500:12414,33501:12415,33502:12416,33503:12417,33504:12418,33505:12419,33506:12420,33507:12421,33508:12422,33509:12423,33510:12424,33511:12425,33512:12426,33513:12427,33514:12428,33515:12429,33516:12430,33517:12431,33518:12432,33519:12433,33520:12434,33521:12435,33600:12449,33601:12450,33602:12451,33603:12452,33604:12453,33605:12454,33606:12455,33607:12456,33608:12457,33609:12458,33610:12459,33611:12460,33612:12461,33613:12462,33614:12463,33615:12464,33616:12465,33617:12466,33618:12467,33619:12468,33620:12469,33621:12470,33622:12471,33623:12472,33624:12473,33625:12474,33626:12475,33627:12476,33628:12477,33629:12478,33630:12479,33631:12480,33632:12481,33633:12482,33634:12483,33635:12484,33636:12485,33637:12486,33638:12487,33639:12488,33640:12489,33641:12490,33642:12491,33643:12492,33644:12493,33645:12494,33646:12495,33647:12496,33648:12497,33649:12498,33650:12499,33651:12500,33652:12501,33653:12502,33654:12503,33655:12504,33656:12505,33657:12506,33658:12507,33659:12508,33660:12509,33661:12510,33662:12511,33664:12512,33665:12513,33666:12514,33667:12515,33668:12516,33669:12517,33670:12518,33671:12519,33672:12520,33673:12521,33674:12522,33675:12523,33676:12524,33677:12525,33678:12526,33679:12527,33680:12528,33681:12529,33682:12530,33683:12531,33684:12532,33685:12533,33686:12534,33695:913,33696:914,33697:915,33698:916,33699:917,33700:918,33701:919,33702:920,33703:921,33704:922,33705:923,33706:924,33707:925,33708:926,33709:927,33710:928,33711:929,33712:931,33713:932,33714:933,33715:934,33716:935,33717:936,33718:937,33727:945,33728:946,33729:947,33730:948,33731:949,33732:950,33733:951,33734:952,33735:953,33736:954,33737:955,33738:956,33739:957,33740:958,33741:959,33742:960,33743:961,33744:963,33745:964,33746:965,33747:966,33748:967,33749:968,33750:969,33856:1040,33857:1041,33858:1042,33859:1043,33860:1044,33861:1045,33862:1025,33863:1046,33864:1047,33865:1048,33866:1049,33867:1050,33868:1051,33869:1052,33870:1053,33871:1054,33872:1055,33873:1056,33874:1057,33875:1058,33876:1059,33877:1060,33878:1061,33879:1062,33880:1063,33881:1064,33882:1065,33883:1066,33884:1067,33885:1068,33886:1069,33887:1070,33888:1071,33904:1072,33905:1073,33906:1074,33907:1075,33908:1076,33909:1077,33910:1105,33911:1078,33912:1079,33913:1080,33914:1081,33915:1082,33916:1083,33917:1084,33918:1085,33920:1086,33921:1087,33922:1088,33923:1089,33924:1090,33925:1091,33926:1092,33927:1093,33928:1094,33929:1095,33930:1096,33931:1097,33932:1098,33933:1099,33934:1100,33935:1101,33936:1102,33937:1103,33951:9472,33952:9474,33953:9484,33954:9488,33955:9496,33956:9492,33957:9500,33958:9516,33959:9508,33960:9524,33961:9532,33962:9473,33963:9475,33964:9487,33965:9491,33966:9499,33967:9495,33968:9507,33969:9523,33970:9515,33971:9531,33972:9547,33973:9504,33974:9519,33975:9512,33976:9527,33977:9535,33978:9501,33979:9520,33980:9509,33981:9528,33982:9538,34624:9312,34625:9313,34626:9314,34627:9315,34628:9316,34629:9317,34630:9318,34631:9319,34632:9320,34633:9321,34634:9322,34635:9323,34636:9324,34637:9325,34638:9326,34639:9327,34640:9328,34641:9329,34642:9330,34643:9331,34644:8544,34645:8545,34646:8546,34647:8547,34648:8548,34649:8549,34650:8550,34651:8551,34652:8552,34653:8553,34655:13129,34656:13076,34657:13090,34658:13133,34659:13080,34660:13095,34661:13059,34662:13110,34663:13137,34664:13143,34665:13069,34666:13094,34667:13091,34668:13099,34669:13130,34670:13115,34671:13212,34672:13213,34673:13214,34674:13198,34675:13199,34676:13252,34677:13217,34686:13179,34688:12317,34689:12319,34690:8470,34691:13261,34692:8481,34693:12964,34694:12965,34695:12966,34696:12967,34697:12968,34698:12849,34699:12850,34700:12857,34701:13182,34702:13181,34703:13180,34704:8786,34705:8801,34706:8747,34707:8750,34708:8721,34709:8730,34710:8869,34711:8736,34712:8735,34713:8895,34714:8757,34715:8745,34716:8746,34975:20124,34976:21782,34977:23043,34978:38463,34979:21696,34980:24859,34981:25384,34982:23030,34983:36898,34984:33909,34985:33564,34986:31312,34987:24746,34988:25569,34989:28197,34990:26093,34991:33894,34992:33446,34993:39925,34994:26771,34995:22311,34996:26017,34997:25201,34998:23451,34999:22992,35e3:34427,35001:39156,35002:32098,35003:32190,35004:39822,35005:25110,35006:31903,35007:34999,35008:23433,35009:24245,35010:25353,35011:26263,35012:26696,35013:38343,35014:38797,35015:26447,35016:20197,35017:20234,35018:20301,35019:20381,35020:20553,35021:22258,35022:22839,35023:22996,35024:23041,35025:23561,35026:24799,35027:24847,35028:24944,35029:26131,35030:26885,35031:28858,35032:30031,35033:30064,35034:31227,35035:32173,35036:32239,35037:32963,35038:33806,35039:34915,35040:35586,35041:36949,35042:36986,35043:21307,35044:20117,35045:20133,35046:22495,35047:32946,35048:37057,35049:30959,35050:19968,35051:22769,35052:28322,35053:36920,35054:31282,35055:33576,35056:33419,35057:39983,35058:20801,35059:21360,35060:21693,35061:21729,35062:22240,35063:23035,35064:24341,35065:39154,35066:28139,35067:32996,35068:34093,35136:38498,35137:38512,35138:38560,35139:38907,35140:21515,35141:21491,35142:23431,35143:28879,35144:32701,35145:36802,35146:38632,35147:21359,35148:40284,35149:31418,35150:19985,35151:30867,35152:33276,35153:28198,35154:22040,35155:21764,35156:27421,35157:34074,35158:39995,35159:23013,35160:21417,35161:28006,35162:29916,35163:38287,35164:22082,35165:20113,35166:36939,35167:38642,35168:33615,35169:39180,35170:21473,35171:21942,35172:23344,35173:24433,35174:26144,35175:26355,35176:26628,35177:27704,35178:27891,35179:27945,35180:29787,35181:30408,35182:31310,35183:38964,35184:33521,35185:34907,35186:35424,35187:37613,35188:28082,35189:30123,35190:30410,35191:39365,35192:24742,35193:35585,35194:36234,35195:38322,35196:27022,35197:21421,35198:20870,35200:22290,35201:22576,35202:22852,35203:23476,35204:24310,35205:24616,35206:25513,35207:25588,35208:27839,35209:28436,35210:28814,35211:28948,35212:29017,35213:29141,35214:29503,35215:32257,35216:33398,35217:33489,35218:34199,35219:36960,35220:37467,35221:40219,35222:22633,35223:26044,35224:27738,35225:29989,35226:20985,35227:22830,35228:22885,35229:24448,35230:24540,35231:25276,35232:26106,35233:27178,35234:27431,35235:27572,35236:29579,35237:32705,35238:35158,35239:40236,35240:40206,35241:40644,35242:23713,35243:27798,35244:33659,35245:20740,35246:23627,35247:25014,35248:33222,35249:26742,35250:29281,35251:20057,35252:20474,35253:21368,35254:24681,35255:28201,35256:31311,35257:38899,35258:19979,35259:21270,35260:20206,35261:20309,35262:20285,35263:20385,35264:20339,35265:21152,35266:21487,35267:22025,35268:22799,35269:23233,35270:23478,35271:23521,35272:31185,35273:26247,35274:26524,35275:26550,35276:27468,35277:27827,35278:28779,35279:29634,35280:31117,35281:31166,35282:31292,35283:31623,35284:33457,35285:33499,35286:33540,35287:33655,35288:33775,35289:33747,35290:34662,35291:35506,35292:22057,35293:36008,35294:36838,35295:36942,35296:38686,35297:34442,35298:20420,35299:23784,35300:25105,35301:29273,35302:30011,35303:33253,35304:33469,35305:34558,35306:36032,35307:38597,35308:39187,35309:39381,35310:20171,35311:20250,35312:35299,35313:22238,35314:22602,35315:22730,35316:24315,35317:24555,35318:24618,35319:24724,35320:24674,35321:25040,35322:25106,35323:25296,35324:25913,35392:39745,35393:26214,35394:26800,35395:28023,35396:28784,35397:30028,35398:30342,35399:32117,35400:33445,35401:34809,35402:38283,35403:38542,35404:35997,35405:20977,35406:21182,35407:22806,35408:21683,35409:23475,35410:23830,35411:24936,35412:27010,35413:28079,35414:30861,35415:33995,35416:34903,35417:35442,35418:37799,35419:39608,35420:28012,35421:39336,35422:34521,35423:22435,35424:26623,35425:34510,35426:37390,35427:21123,35428:22151,35429:21508,35430:24275,35431:25313,35432:25785,35433:26684,35434:26680,35435:27579,35436:29554,35437:30906,35438:31339,35439:35226,35440:35282,35441:36203,35442:36611,35443:37101,35444:38307,35445:38548,35446:38761,35447:23398,35448:23731,35449:27005,35450:38989,35451:38990,35452:25499,35453:31520,35454:27179,35456:27263,35457:26806,35458:39949,35459:28511,35460:21106,35461:21917,35462:24688,35463:25324,35464:27963,35465:28167,35466:28369,35467:33883,35468:35088,35469:36676,35470:19988,35471:39993,35472:21494,35473:26907,35474:27194,35475:38788,35476:26666,35477:20828,35478:31427,35479:33970,35480:37340,35481:37772,35482:22107,35483:40232,35484:26658,35485:33541,35486:33841,35487:31909,35488:21e3,35489:33477,35490:29926,35491:20094,35492:20355,35493:20896,35494:23506,35495:21002,35496:21208,35497:21223,35498:24059,35499:21914,35500:22570,35501:23014,35502:23436,35503:23448,35504:23515,35505:24178,35506:24185,35507:24739,35508:24863,35509:24931,35510:25022,35511:25563,35512:25954,35513:26577,35514:26707,35515:26874,35516:27454,35517:27475,35518:27735,35519:28450,35520:28567,35521:28485,35522:29872,35523:29976,35524:30435,35525:30475,35526:31487,35527:31649,35528:31777,35529:32233,35530:32566,35531:32752,35532:32925,35533:33382,35534:33694,35535:35251,35536:35532,35537:36011,35538:36996,35539:37969,35540:38291,35541:38289,35542:38306,35543:38501,35544:38867,35545:39208,35546:33304,35547:20024,35548:21547,35549:23736,35550:24012,35551:29609,35552:30284,35553:30524,35554:23721,35555:32747,35556:36107,35557:38593,35558:38929,35559:38996,35560:39e3,35561:20225,35562:20238,35563:21361,35564:21916,35565:22120,35566:22522,35567:22855,35568:23305,35569:23492,35570:23696,35571:24076,35572:24190,35573:24524,35574:25582,35575:26426,35576:26071,35577:26082,35578:26399,35579:26827,35580:26820,35648:27231,35649:24112,35650:27589,35651:27671,35652:27773,35653:30079,35654:31048,35655:23395,35656:31232,35657:32e3,35658:24509,35659:35215,35660:35352,35661:36020,35662:36215,35663:36556,35664:36637,35665:39138,35666:39438,35667:39740,35668:20096,35669:20605,35670:20736,35671:22931,35672:23452,35673:25135,35674:25216,35675:25836,35676:27450,35677:29344,35678:30097,35679:31047,35680:32681,35681:34811,35682:35516,35683:35696,35684:25516,35685:33738,35686:38816,35687:21513,35688:21507,35689:21931,35690:26708,35691:27224,35692:35440,35693:30759,35694:26485,35695:40653,35696:21364,35697:23458,35698:33050,35699:34384,35700:36870,35701:19992,35702:20037,35703:20167,35704:20241,35705:21450,35706:21560,35707:23470,35708:24339,35709:24613,35710:25937,35712:26429,35713:27714,35714:27762,35715:27875,35716:28792,35717:29699,35718:31350,35719:31406,35720:31496,35721:32026,35722:31998,35723:32102,35724:26087,35725:29275,35726:21435,35727:23621,35728:24040,35729:25298,35730:25312,35731:25369,35732:28192,35733:34394,35734:35377,35735:36317,35736:37624,35737:28417,35738:31142,35739:39770,35740:20136,35741:20139,35742:20140,35743:20379,35744:20384,35745:20689,35746:20807,35747:31478,35748:20849,35749:20982,35750:21332,35751:21281,35752:21375,35753:21483,35754:21932,35755:22659,35756:23777,35757:24375,35758:24394,35759:24623,35760:24656,35761:24685,35762:25375,35763:25945,35764:27211,35765:27841,35766:29378,35767:29421,35768:30703,35769:33016,35770:33029,35771:33288,35772:34126,35773:37111,35774:37857,35775:38911,35776:39255,35777:39514,35778:20208,35779:20957,35780:23597,35781:26241,35782:26989,35783:23616,35784:26354,35785:26997,35786:29577,35787:26704,35788:31873,35789:20677,35790:21220,35791:22343,35792:24062,35793:37670,35794:26020,35795:27427,35796:27453,35797:29748,35798:31105,35799:31165,35800:31563,35801:32202,35802:33465,35803:33740,35804:34943,35805:35167,35806:35641,35807:36817,35808:37329,35809:21535,35810:37504,35811:20061,35812:20534,35813:21477,35814:21306,35815:29399,35816:29590,35817:30697,35818:33510,35819:36527,35820:39366,35821:39368,35822:39378,35823:20855,35824:24858,35825:34398,35826:21936,35827:31354,35828:20598,35829:23507,35830:36935,35831:38533,35832:20018,35833:27355,35834:37351,35835:23633,35836:23624,35904:25496,35905:31391,35906:27795,35907:38772,35908:36705,35909:31402,35910:29066,35911:38536,35912:31874,35913:26647,35914:32368,35915:26705,35916:37740,35917:21234,35918:21531,35919:34219,35920:35347,35921:32676,35922:36557,35923:37089,35924:21350,35925:34952,35926:31041,35927:20418,35928:20670,35929:21009,35930:20804,35931:21843,35932:22317,35933:29674,35934:22411,35935:22865,35936:24418,35937:24452,35938:24693,35939:24950,35940:24935,35941:25001,35942:25522,35943:25658,35944:25964,35945:26223,35946:26690,35947:28179,35948:30054,35949:31293,35950:31995,35951:32076,35952:32153,35953:32331,35954:32619,35955:33550,35956:33610,35957:34509,35958:35336,35959:35427,35960:35686,35961:36605,35962:38938,35963:40335,35964:33464,35965:36814,35966:39912,35968:21127,35969:25119,35970:25731,35971:28608,35972:38553,35973:26689,35974:20625,35975:27424,35976:27770,35977:28500,35978:31348,35979:32080,35980:34880,35981:35363,35982:26376,35983:20214,35984:20537,35985:20518,35986:20581,35987:20860,35988:21048,35989:21091,35990:21927,35991:22287,35992:22533,35993:23244,35994:24314,35995:25010,35996:25080,35997:25331,35998:25458,35999:26908,36e3:27177,36001:29309,36002:29356,36003:29486,36004:30740,36005:30831,36006:32121,36007:30476,36008:32937,36009:35211,36010:35609,36011:36066,36012:36562,36013:36963,36014:37749,36015:38522,36016:38997,36017:39443,36018:40568,36019:20803,36020:21407,36021:21427,36022:24187,36023:24358,36024:28187,36025:28304,36026:29572,36027:29694,36028:32067,36029:33335,36030:35328,36031:35578,36032:38480,36033:20046,36034:20491,36035:21476,36036:21628,36037:22266,36038:22993,36039:23396,36040:24049,36041:24235,36042:24359,36043:25144,36044:25925,36045:26543,36046:28246,36047:29392,36048:31946,36049:34996,36050:32929,36051:32993,36052:33776,36053:34382,36054:35463,36055:36328,36056:37431,36057:38599,36058:39015,36059:40723,36060:20116,36061:20114,36062:20237,36063:21320,36064:21577,36065:21566,36066:23087,36067:24460,36068:24481,36069:24735,36070:26791,36071:27278,36072:29786,36073:30849,36074:35486,36075:35492,36076:35703,36077:37264,36078:20062,36079:39881,36080:20132,36081:20348,36082:20399,36083:20505,36084:20502,36085:20809,36086:20844,36087:21151,36088:21177,36089:21246,36090:21402,36091:21475,36092:21521,36160:21518,36161:21897,36162:22353,36163:22434,36164:22909,36165:23380,36166:23389,36167:23439,36168:24037,36169:24039,36170:24055,36171:24184,36172:24195,36173:24218,36174:24247,36175:24344,36176:24658,36177:24908,36178:25239,36179:25304,36180:25511,36181:25915,36182:26114,36183:26179,36184:26356,36185:26477,36186:26657,36187:26775,36188:27083,36189:27743,36190:27946,36191:28009,36192:28207,36193:28317,36194:30002,36195:30343,36196:30828,36197:31295,36198:31968,36199:32005,36200:32024,36201:32094,36202:32177,36203:32789,36204:32771,36205:32943,36206:32945,36207:33108,36208:33167,36209:33322,36210:33618,36211:34892,36212:34913,36213:35611,36214:36002,36215:36092,36216:37066,36217:37237,36218:37489,36219:30783,36220:37628,36221:38308,36222:38477,36224:38917,36225:39321,36226:39640,36227:40251,36228:21083,36229:21163,36230:21495,36231:21512,36232:22741,36233:25335,36234:28640,36235:35946,36236:36703,36237:40633,36238:20811,36239:21051,36240:21578,36241:22269,36242:31296,36243:37239,36244:40288,36245:40658,36246:29508,36247:28425,36248:33136,36249:29969,36250:24573,36251:24794,36252:39592,36253:29403,36254:36796,36255:27492,36256:38915,36257:20170,36258:22256,36259:22372,36260:22718,36261:23130,36262:24680,36263:25031,36264:26127,36265:26118,36266:26681,36267:26801,36268:28151,36269:30165,36270:32058,36271:33390,36272:39746,36273:20123,36274:20304,36275:21449,36276:21766,36277:23919,36278:24038,36279:24046,36280:26619,36281:27801,36282:29811,36283:30722,36284:35408,36285:37782,36286:35039,36287:22352,36288:24231,36289:25387,36290:20661,36291:20652,36292:20877,36293:26368,36294:21705,36295:22622,36296:22971,36297:23472,36298:24425,36299:25165,36300:25505,36301:26685,36302:27507,36303:28168,36304:28797,36305:37319,36306:29312,36307:30741,36308:30758,36309:31085,36310:25998,36311:32048,36312:33756,36313:35009,36314:36617,36315:38555,36316:21092,36317:22312,36318:26448,36319:32618,36320:36001,36321:20916,36322:22338,36323:38442,36324:22586,36325:27018,36326:32948,36327:21682,36328:23822,36329:22524,36330:30869,36331:40442,36332:20316,36333:21066,36334:21643,36335:25662,36336:26152,36337:26388,36338:26613,36339:31364,36340:31574,36341:32034,36342:37679,36343:26716,36344:39853,36345:31545,36346:21273,36347:20874,36348:21047,36416:23519,36417:25334,36418:25774,36419:25830,36420:26413,36421:27578,36422:34217,36423:38609,36424:30352,36425:39894,36426:25420,36427:37638,36428:39851,36429:30399,36430:26194,36431:19977,36432:20632,36433:21442,36434:23665,36435:24808,36436:25746,36437:25955,36438:26719,36439:29158,36440:29642,36441:29987,36442:31639,36443:32386,36444:34453,36445:35715,36446:36059,36447:37240,36448:39184,36449:26028,36450:26283,36451:27531,36452:20181,36453:20180,36454:20282,36455:20351,36456:21050,36457:21496,36458:21490,36459:21987,36460:22235,36461:22763,36462:22987,36463:22985,36464:23039,36465:23376,36466:23629,36467:24066,36468:24107,36469:24535,36470:24605,36471:25351,36472:25903,36473:23388,36474:26031,36475:26045,36476:26088,36477:26525,36478:27490,36480:27515,36481:27663,36482:29509,36483:31049,36484:31169,36485:31992,36486:32025,36487:32043,36488:32930,36489:33026,36490:33267,36491:35222,36492:35422,36493:35433,36494:35430,36495:35468,36496:35566,36497:36039,36498:36060,36499:38604,36500:39164,36501:27503,36502:20107,36503:20284,36504:20365,36505:20816,36506:23383,36507:23546,36508:24904,36509:25345,36510:26178,36511:27425,36512:28363,36513:27835,36514:29246,36515:29885,36516:30164,36517:30913,36518:31034,36519:32780,36520:32819,36521:33258,36522:33940,36523:36766,36524:27728,36525:40575,36526:24335,36527:35672,36528:40235,36529:31482,36530:36600,36531:23437,36532:38635,36533:19971,36534:21489,36535:22519,36536:22833,36537:23241,36538:23460,36539:24713,36540:28287,36541:28422,36542:30142,36543:36074,36544:23455,36545:34048,36546:31712,36547:20594,36548:26612,36549:33437,36550:23649,36551:34122,36552:32286,36553:33294,36554:20889,36555:23556,36556:25448,36557:36198,36558:26012,36559:29038,36560:31038,36561:32023,36562:32773,36563:35613,36564:36554,36565:36974,36566:34503,36567:37034,36568:20511,36569:21242,36570:23610,36571:26451,36572:28796,36573:29237,36574:37196,36575:37320,36576:37675,36577:33509,36578:23490,36579:24369,36580:24825,36581:20027,36582:21462,36583:23432,36584:25163,36585:26417,36586:27530,36587:29417,36588:29664,36589:31278,36590:33131,36591:36259,36592:37202,36593:39318,36594:20754,36595:21463,36596:21610,36597:23551,36598:25480,36599:27193,36600:32172,36601:38656,36602:22234,36603:21454,36604:21608,36672:23447,36673:23601,36674:24030,36675:20462,36676:24833,36677:25342,36678:27954,36679:31168,36680:31179,36681:32066,36682:32333,36683:32722,36684:33261,36685:33311,36686:33936,36687:34886,36688:35186,36689:35728,36690:36468,36691:36655,36692:36913,36693:37195,36694:37228,36695:38598,36696:37276,36697:20160,36698:20303,36699:20805,36700:21313,36701:24467,36702:25102,36703:26580,36704:27713,36705:28171,36706:29539,36707:32294,36708:37325,36709:37507,36710:21460,36711:22809,36712:23487,36713:28113,36714:31069,36715:32302,36716:31899,36717:22654,36718:29087,36719:20986,36720:34899,36721:36848,36722:20426,36723:23803,36724:26149,36725:30636,36726:31459,36727:33308,36728:39423,36729:20934,36730:24490,36731:26092,36732:26991,36733:27529,36734:28147,36736:28310,36737:28516,36738:30462,36739:32020,36740:24033,36741:36981,36742:37255,36743:38918,36744:20966,36745:21021,36746:25152,36747:26257,36748:26329,36749:28186,36750:24246,36751:32210,36752:32626,36753:26360,36754:34223,36755:34295,36756:35576,36757:21161,36758:21465,36759:22899,36760:24207,36761:24464,36762:24661,36763:37604,36764:38500,36765:20663,36766:20767,36767:21213,36768:21280,36769:21319,36770:21484,36771:21736,36772:21830,36773:21809,36774:22039,36775:22888,36776:22974,36777:23100,36778:23477,36779:23558,36780:23567,36781:23569,36782:23578,36783:24196,36784:24202,36785:24288,36786:24432,36787:25215,36788:25220,36789:25307,36790:25484,36791:25463,36792:26119,36793:26124,36794:26157,36795:26230,36796:26494,36797:26786,36798:27167,36799:27189,36800:27836,36801:28040,36802:28169,36803:28248,36804:28988,36805:28966,36806:29031,36807:30151,36808:30465,36809:30813,36810:30977,36811:31077,36812:31216,36813:31456,36814:31505,36815:31911,36816:32057,36817:32918,36818:33750,36819:33931,36820:34121,36821:34909,36822:35059,36823:35359,36824:35388,36825:35412,36826:35443,36827:35937,36828:36062,36829:37284,36830:37478,36831:37758,36832:37912,36833:38556,36834:38808,36835:19978,36836:19976,36837:19998,36838:20055,36839:20887,36840:21104,36841:22478,36842:22580,36843:22732,36844:23330,36845:24120,36846:24773,36847:25854,36848:26465,36849:26454,36850:27972,36851:29366,36852:30067,36853:31331,36854:33976,36855:35698,36856:37304,36857:37664,36858:22065,36859:22516,36860:39166,36928:25325,36929:26893,36930:27542,36931:29165,36932:32340,36933:32887,36934:33394,36935:35302,36936:39135,36937:34645,36938:36785,36939:23611,36940:20280,36941:20449,36942:20405,36943:21767,36944:23072,36945:23517,36946:23529,36947:24515,36948:24910,36949:25391,36950:26032,36951:26187,36952:26862,36953:27035,36954:28024,36955:28145,36956:30003,36957:30137,36958:30495,36959:31070,36960:31206,36961:32051,36962:33251,36963:33455,36964:34218,36965:35242,36966:35386,36967:36523,36968:36763,36969:36914,36970:37341,36971:38663,36972:20154,36973:20161,36974:20995,36975:22645,36976:22764,36977:23563,36978:29978,36979:23613,36980:33102,36981:35338,36982:36805,36983:38499,36984:38765,36985:31525,36986:35535,36987:38920,36988:37218,36989:22259,36990:21416,36992:36887,36993:21561,36994:22402,36995:24101,36996:25512,36997:27700,36998:28810,36999:30561,37e3:31883,37001:32736,37002:34928,37003:36930,37004:37204,37005:37648,37006:37656,37007:38543,37008:29790,37009:39620,37010:23815,37011:23913,37012:25968,37013:26530,37014:36264,37015:38619,37016:25454,37017:26441,37018:26905,37019:33733,37020:38935,37021:38592,37022:35070,37023:28548,37024:25722,37025:23544,37026:19990,37027:28716,37028:30045,37029:26159,37030:20932,37031:21046,37032:21218,37033:22995,37034:24449,37035:24615,37036:25104,37037:25919,37038:25972,37039:26143,37040:26228,37041:26866,37042:26646,37043:27491,37044:28165,37045:29298,37046:29983,37047:30427,37048:31934,37049:32854,37050:22768,37051:35069,37052:35199,37053:35488,37054:35475,37055:35531,37056:36893,37057:37266,37058:38738,37059:38745,37060:25993,37061:31246,37062:33030,37063:38587,37064:24109,37065:24796,37066:25114,37067:26021,37068:26132,37069:26512,37070:30707,37071:31309,37072:31821,37073:32318,37074:33034,37075:36012,37076:36196,37077:36321,37078:36447,37079:30889,37080:20999,37081:25305,37082:25509,37083:25666,37084:25240,37085:35373,37086:31363,37087:31680,37088:35500,37089:38634,37090:32118,37091:33292,37092:34633,37093:20185,37094:20808,37095:21315,37096:21344,37097:23459,37098:23554,37099:23574,37100:24029,37101:25126,37102:25159,37103:25776,37104:26643,37105:26676,37106:27849,37107:27973,37108:27927,37109:26579,37110:28508,37111:29006,37112:29053,37113:26059,37114:31359,37115:31661,37116:32218,37184:32330,37185:32680,37186:33146,37187:33307,37188:33337,37189:34214,37190:35438,37191:36046,37192:36341,37193:36984,37194:36983,37195:37549,37196:37521,37197:38275,37198:39854,37199:21069,37200:21892,37201:28472,37202:28982,37203:20840,37204:31109,37205:32341,37206:33203,37207:31950,37208:22092,37209:22609,37210:23720,37211:25514,37212:26366,37213:26365,37214:26970,37215:29401,37216:30095,37217:30094,37218:30990,37219:31062,37220:31199,37221:31895,37222:32032,37223:32068,37224:34311,37225:35380,37226:38459,37227:36961,37228:40736,37229:20711,37230:21109,37231:21452,37232:21474,37233:20489,37234:21930,37235:22766,37236:22863,37237:29245,37238:23435,37239:23652,37240:21277,37241:24803,37242:24819,37243:25436,37244:25475,37245:25407,37246:25531,37248:25805,37249:26089,37250:26361,37251:24035,37252:27085,37253:27133,37254:28437,37255:29157,37256:20105,37257:30185,37258:30456,37259:31379,37260:31967,37261:32207,37262:32156,37263:32865,37264:33609,37265:33624,37266:33900,37267:33980,37268:34299,37269:35013,37270:36208,37271:36865,37272:36973,37273:37783,37274:38684,37275:39442,37276:20687,37277:22679,37278:24974,37279:33235,37280:34101,37281:36104,37282:36896,37283:20419,37284:20596,37285:21063,37286:21363,37287:24687,37288:25417,37289:26463,37290:28204,37291:36275,37292:36895,37293:20439,37294:23646,37295:36042,37296:26063,37297:32154,37298:21330,37299:34966,37300:20854,37301:25539,37302:23384,37303:23403,37304:23562,37305:25613,37306:26449,37307:36956,37308:20182,37309:22810,37310:22826,37311:27760,37312:35409,37313:21822,37314:22549,37315:22949,37316:24816,37317:25171,37318:26561,37319:33333,37320:26965,37321:38464,37322:39364,37323:39464,37324:20307,37325:22534,37326:23550,37327:32784,37328:23729,37329:24111,37330:24453,37331:24608,37332:24907,37333:25140,37334:26367,37335:27888,37336:28382,37337:32974,37338:33151,37339:33492,37340:34955,37341:36024,37342:36864,37343:36910,37344:38538,37345:40667,37346:39899,37347:20195,37348:21488,37349:22823,37350:31532,37351:37261,37352:38988,37353:40441,37354:28381,37355:28711,37356:21331,37357:21828,37358:23429,37359:25176,37360:25246,37361:25299,37362:27810,37363:28655,37364:29730,37365:35351,37366:37944,37367:28609,37368:35582,37369:33592,37370:20967,37371:34552,37372:21482,37440:21481,37441:20294,37442:36948,37443:36784,37444:22890,37445:33073,37446:24061,37447:31466,37448:36799,37449:26842,37450:35895,37451:29432,37452:40008,37453:27197,37454:35504,37455:20025,37456:21336,37457:22022,37458:22374,37459:25285,37460:25506,37461:26086,37462:27470,37463:28129,37464:28251,37465:28845,37466:30701,37467:31471,37468:31658,37469:32187,37470:32829,37471:32966,37472:34507,37473:35477,37474:37723,37475:22243,37476:22727,37477:24382,37478:26029,37479:26262,37480:27264,37481:27573,37482:30007,37483:35527,37484:20516,37485:30693,37486:22320,37487:24347,37488:24677,37489:26234,37490:27744,37491:30196,37492:31258,37493:32622,37494:33268,37495:34584,37496:36933,37497:39347,37498:31689,37499:30044,37500:31481,37501:31569,37502:33988,37504:36880,37505:31209,37506:31378,37507:33590,37508:23265,37509:30528,37510:20013,37511:20210,37512:23449,37513:24544,37514:25277,37515:26172,37516:26609,37517:27880,37518:34411,37519:34935,37520:35387,37521:37198,37522:37619,37523:39376,37524:27159,37525:28710,37526:29482,37527:33511,37528:33879,37529:36015,37530:19969,37531:20806,37532:20939,37533:21899,37534:23541,37535:24086,37536:24115,37537:24193,37538:24340,37539:24373,37540:24427,37541:24500,37542:25074,37543:25361,37544:26274,37545:26397,37546:28526,37547:29266,37548:30010,37549:30522,37550:32884,37551:33081,37552:33144,37553:34678,37554:35519,37555:35548,37556:36229,37557:36339,37558:37530,37559:38263,37560:38914,37561:40165,37562:21189,37563:25431,37564:30452,37565:26389,37566:27784,37567:29645,37568:36035,37569:37806,37570:38515,37571:27941,37572:22684,37573:26894,37574:27084,37575:36861,37576:37786,37577:30171,37578:36890,37579:22618,37580:26626,37581:25524,37582:27131,37583:20291,37584:28460,37585:26584,37586:36795,37587:34086,37588:32180,37589:37716,37590:26943,37591:28528,37592:22378,37593:22775,37594:23340,37595:32044,37596:29226,37597:21514,37598:37347,37599:40372,37600:20141,37601:20302,37602:20572,37603:20597,37604:21059,37605:35998,37606:21576,37607:22564,37608:23450,37609:24093,37610:24213,37611:24237,37612:24311,37613:24351,37614:24716,37615:25269,37616:25402,37617:25552,37618:26799,37619:27712,37620:30855,37621:31118,37622:31243,37623:32224,37624:33351,37625:35330,37626:35558,37627:36420,37628:36883,37696:37048,37697:37165,37698:37336,37699:40718,37700:27877,37701:25688,37702:25826,37703:25973,37704:28404,37705:30340,37706:31515,37707:36969,37708:37841,37709:28346,37710:21746,37711:24505,37712:25764,37713:36685,37714:36845,37715:37444,37716:20856,37717:22635,37718:22825,37719:23637,37720:24215,37721:28155,37722:32399,37723:29980,37724:36028,37725:36578,37726:39003,37727:28857,37728:20253,37729:27583,37730:28593,37731:3e4,37732:38651,37733:20814,37734:21520,37735:22581,37736:22615,37737:22956,37738:23648,37739:24466,37740:26007,37741:26460,37742:28193,37743:30331,37744:33759,37745:36077,37746:36884,37747:37117,37748:37709,37749:30757,37750:30778,37751:21162,37752:24230,37753:22303,37754:22900,37755:24594,37756:20498,37757:20826,37758:20908,37760:20941,37761:20992,37762:21776,37763:22612,37764:22616,37765:22871,37766:23445,37767:23798,37768:23947,37769:24764,37770:25237,37771:25645,37772:26481,37773:26691,37774:26812,37775:26847,37776:30423,37777:28120,37778:28271,37779:28059,37780:28783,37781:29128,37782:24403,37783:30168,37784:31095,37785:31561,37786:31572,37787:31570,37788:31958,37789:32113,37790:21040,37791:33891,37792:34153,37793:34276,37794:35342,37795:35588,37796:35910,37797:36367,37798:36867,37799:36879,37800:37913,37801:38518,37802:38957,37803:39472,37804:38360,37805:20685,37806:21205,37807:21516,37808:22530,37809:23566,37810:24999,37811:25758,37812:27934,37813:30643,37814:31461,37815:33012,37816:33796,37817:36947,37818:37509,37819:23776,37820:40199,37821:21311,37822:24471,37823:24499,37824:28060,37825:29305,37826:30563,37827:31167,37828:31716,37829:27602,37830:29420,37831:35501,37832:26627,37833:27233,37834:20984,37835:31361,37836:26932,37837:23626,37838:40182,37839:33515,37840:23493,37841:37193,37842:28702,37843:22136,37844:23663,37845:24775,37846:25958,37847:27788,37848:35930,37849:36929,37850:38931,37851:21585,37852:26311,37853:37389,37854:22856,37855:37027,37856:20869,37857:20045,37858:20970,37859:34201,37860:35598,37861:28760,37862:25466,37863:37707,37864:26978,37865:39348,37866:32260,37867:30071,37868:21335,37869:26976,37870:36575,37871:38627,37872:27741,37873:20108,37874:23612,37875:24336,37876:36841,37877:21250,37878:36049,37879:32905,37880:34425,37881:24319,37882:26085,37883:20083,37884:20837,37952:22914,37953:23615,37954:38894,37955:20219,37956:22922,37957:24525,37958:35469,37959:28641,37960:31152,37961:31074,37962:23527,37963:33905,37964:29483,37965:29105,37966:24180,37967:24565,37968:25467,37969:25754,37970:29123,37971:31896,37972:20035,37973:24316,37974:20043,37975:22492,37976:22178,37977:24745,37978:28611,37979:32013,37980:33021,37981:33075,37982:33215,37983:36786,37984:35223,37985:34468,37986:24052,37987:25226,37988:25773,37989:35207,37990:26487,37991:27874,37992:27966,37993:29750,37994:30772,37995:23110,37996:32629,37997:33453,37998:39340,37999:20467,38e3:24259,38001:25309,38002:25490,38003:25943,38004:26479,38005:30403,38006:29260,38007:32972,38008:32954,38009:36649,38010:37197,38011:20493,38012:22521,38013:23186,38014:26757,38016:26995,38017:29028,38018:29437,38019:36023,38020:22770,38021:36064,38022:38506,38023:36889,38024:34687,38025:31204,38026:30695,38027:33833,38028:20271,38029:21093,38030:21338,38031:25293,38032:26575,38033:27850,38034:30333,38035:31636,38036:31893,38037:33334,38038:34180,38039:36843,38040:26333,38041:28448,38042:29190,38043:32283,38044:33707,38045:39361,38046:40614,38047:20989,38048:31665,38049:30834,38050:31672,38051:32903,38052:31560,38053:27368,38054:24161,38055:32908,38056:30033,38057:30048,38058:20843,38059:37474,38060:28300,38061:30330,38062:37271,38063:39658,38064:20240,38065:32624,38066:25244,38067:31567,38068:38309,38069:40169,38070:22138,38071:22617,38072:34532,38073:38588,38074:20276,38075:21028,38076:21322,38077:21453,38078:21467,38079:24070,38080:25644,38081:26001,38082:26495,38083:27710,38084:27726,38085:29256,38086:29359,38087:29677,38088:30036,38089:32321,38090:33324,38091:34281,38092:36009,38093:31684,38094:37318,38095:29033,38096:38930,38097:39151,38098:25405,38099:26217,38100:30058,38101:30436,38102:30928,38103:34115,38104:34542,38105:21290,38106:21329,38107:21542,38108:22915,38109:24199,38110:24444,38111:24754,38112:25161,38113:25209,38114:25259,38115:26e3,38116:27604,38117:27852,38118:30130,38119:30382,38120:30865,38121:31192,38122:32203,38123:32631,38124:32933,38125:34987,38126:35513,38127:36027,38128:36991,38129:38750,38130:39131,38131:27147,38132:31800,38133:20633,38134:23614,38135:24494,38136:26503,38137:27608,38138:29749,38139:30473,38140:32654,38208:40763,38209:26570,38210:31255,38211:21305,38212:30091,38213:39661,38214:24422,38215:33181,38216:33777,38217:32920,38218:24380,38219:24517,38220:30050,38221:31558,38222:36924,38223:26727,38224:23019,38225:23195,38226:32016,38227:30334,38228:35628,38229:20469,38230:24426,38231:27161,38232:27703,38233:28418,38234:29922,38235:31080,38236:34920,38237:35413,38238:35961,38239:24287,38240:25551,38241:30149,38242:31186,38243:33495,38244:37672,38245:37618,38246:33948,38247:34541,38248:39981,38249:21697,38250:24428,38251:25996,38252:27996,38253:28693,38254:36007,38255:36051,38256:38971,38257:25935,38258:29942,38259:19981,38260:20184,38261:22496,38262:22827,38263:23142,38264:23500,38265:20904,38266:24067,38267:24220,38268:24598,38269:25206,38270:25975,38272:26023,38273:26222,38274:28014,38275:29238,38276:31526,38277:33104,38278:33178,38279:33433,38280:35676,38281:36e3,38282:36070,38283:36212,38284:38428,38285:38468,38286:20398,38287:25771,38288:27494,38289:33310,38290:33889,38291:34154,38292:37096,38293:23553,38294:26963,38295:39080,38296:33914,38297:34135,38298:20239,38299:21103,38300:24489,38301:24133,38302:26381,38303:31119,38304:33145,38305:35079,38306:35206,38307:28149,38308:24343,38309:25173,38310:27832,38311:20175,38312:29289,38313:39826,38314:20998,38315:21563,38316:22132,38317:22707,38318:24996,38319:25198,38320:28954,38321:22894,38322:31881,38323:31966,38324:32027,38325:38640,38326:25991,38327:32862,38328:19993,38329:20341,38330:20853,38331:22592,38332:24163,38333:24179,38334:24330,38335:26564,38336:20006,38337:34109,38338:38281,38339:38491,38340:31859,38341:38913,38342:20731,38343:22721,38344:30294,38345:30887,38346:21029,38347:30629,38348:34065,38349:31622,38350:20559,38351:22793,38352:29255,38353:31687,38354:32232,38355:36794,38356:36820,38357:36941,38358:20415,38359:21193,38360:23081,38361:24321,38362:38829,38363:20445,38364:33303,38365:37610,38366:22275,38367:25429,38368:27497,38369:29995,38370:35036,38371:36628,38372:31298,38373:21215,38374:22675,38375:24917,38376:25098,38377:26286,38378:27597,38379:31807,38380:33769,38381:20515,38382:20472,38383:21253,38384:21574,38385:22577,38386:22857,38387:23453,38388:23792,38389:23791,38390:23849,38391:24214,38392:25265,38393:25447,38394:25918,38395:26041,38396:26379,38464:27861,38465:27873,38466:28921,38467:30770,38468:32299,38469:32990,38470:33459,38471:33804,38472:34028,38473:34562,38474:35090,38475:35370,38476:35914,38477:37030,38478:37586,38479:39165,38480:40179,38481:40300,38482:20047,38483:20129,38484:20621,38485:21078,38486:22346,38487:22952,38488:24125,38489:24536,38490:24537,38491:25151,38492:26292,38493:26395,38494:26576,38495:26834,38496:20882,38497:32033,38498:32938,38499:33192,38500:35584,38501:35980,38502:36031,38503:37502,38504:38450,38505:21536,38506:38956,38507:21271,38508:20693,38509:21340,38510:22696,38511:25778,38512:26420,38513:29287,38514:30566,38515:31302,38516:37350,38517:21187,38518:27809,38519:27526,38520:22528,38521:24140,38522:22868,38523:26412,38524:32763,38525:20961,38526:30406,38528:25705,38529:30952,38530:39764,38531:40635,38532:22475,38533:22969,38534:26151,38535:26522,38536:27598,38537:21737,38538:27097,38539:24149,38540:33180,38541:26517,38542:39850,38543:26622,38544:40018,38545:26717,38546:20134,38547:20451,38548:21448,38549:25273,38550:26411,38551:27819,38552:36804,38553:20397,38554:32365,38555:40639,38556:19975,38557:24930,38558:28288,38559:28459,38560:34067,38561:21619,38562:26410,38563:39749,38564:24051,38565:31637,38566:23724,38567:23494,38568:34588,38569:28234,38570:34001,38571:31252,38572:33032,38573:22937,38574:31885,38575:27665,38576:30496,38577:21209,38578:22818,38579:28961,38580:29279,38581:30683,38582:38695,38583:40289,38584:26891,38585:23167,38586:23064,38587:20901,38588:21517,38589:21629,38590:26126,38591:30431,38592:36855,38593:37528,38594:40180,38595:23018,38596:29277,38597:28357,38598:20813,38599:26825,38600:32191,38601:32236,38602:38754,38603:40634,38604:25720,38605:27169,38606:33538,38607:22916,38608:23391,38609:27611,38610:29467,38611:30450,38612:32178,38613:32791,38614:33945,38615:20786,38616:26408,38617:40665,38618:30446,38619:26466,38620:21247,38621:39173,38622:23588,38623:25147,38624:31870,38625:36016,38626:21839,38627:24758,38628:32011,38629:38272,38630:21249,38631:20063,38632:20918,38633:22812,38634:29242,38635:32822,38636:37326,38637:24357,38638:30690,38639:21380,38640:24441,38641:32004,38642:34220,38643:35379,38644:36493,38645:38742,38646:26611,38647:34222,38648:37971,38649:24841,38650:24840,38651:27833,38652:30290,38720:35565,38721:36664,38722:21807,38723:20305,38724:20778,38725:21191,38726:21451,38727:23461,38728:24189,38729:24736,38730:24962,38731:25558,38732:26377,38733:26586,38734:28263,38735:28044,38736:29494,38737:29495,38738:30001,38739:31056,38740:35029,38741:35480,38742:36938,38743:37009,38744:37109,38745:38596,38746:34701,38747:22805,38748:20104,38749:20313,38750:19982,38751:35465,38752:36671,38753:38928,38754:20653,38755:24188,38756:22934,38757:23481,38758:24248,38759:25562,38760:25594,38761:25793,38762:26332,38763:26954,38764:27096,38765:27915,38766:28342,38767:29076,38768:29992,38769:31407,38770:32650,38771:32768,38772:33865,38773:33993,38774:35201,38775:35617,38776:36362,38777:36965,38778:38525,38779:39178,38780:24958,38781:25233,38782:27442,38784:27779,38785:28020,38786:32716,38787:32764,38788:28096,38789:32645,38790:34746,38791:35064,38792:26469,38793:33713,38794:38972,38795:38647,38796:27931,38797:32097,38798:33853,38799:37226,38800:20081,38801:21365,38802:23888,38803:27396,38804:28651,38805:34253,38806:34349,38807:35239,38808:21033,38809:21519,38810:23653,38811:26446,38812:26792,38813:29702,38814:29827,38815:30178,38816:35023,38817:35041,38818:37324,38819:38626,38820:38520,38821:24459,38822:29575,38823:31435,38824:33870,38825:25504,38826:30053,38827:21129,38828:27969,38829:28316,38830:29705,38831:30041,38832:30827,38833:31890,38834:38534,38835:31452,38836:40845,38837:20406,38838:24942,38839:26053,38840:34396,38841:20102,38842:20142,38843:20698,38844:20001,38845:20940,38846:23534,38847:26009,38848:26753,38849:28092,38850:29471,38851:30274,38852:30637,38853:31260,38854:31975,38855:33391,38856:35538,38857:36988,38858:37327,38859:38517,38860:38936,38861:21147,38862:32209,38863:20523,38864:21400,38865:26519,38866:28107,38867:29136,38868:29747,38869:33256,38870:36650,38871:38563,38872:40023,38873:40607,38874:29792,38875:22593,38876:28057,38877:32047,38878:39006,38879:20196,38880:20278,38881:20363,38882:20919,38883:21169,38884:23994,38885:24604,38886:29618,38887:31036,38888:33491,38889:37428,38890:38583,38891:38646,38892:38666,38893:40599,38894:40802,38895:26278,38896:27508,38897:21015,38898:21155,38899:28872,38900:35010,38901:24265,38902:24651,38903:24976,38904:28451,38905:29001,38906:31806,38907:32244,38908:32879,38976:34030,38977:36899,38978:37676,38979:21570,38980:39791,38981:27347,38982:28809,38983:36034,38984:36335,38985:38706,38986:21172,38987:23105,38988:24266,38989:24324,38990:26391,38991:27004,38992:27028,38993:28010,38994:28431,38995:29282,38996:29436,38997:31725,38998:32769,38999:32894,39e3:34635,39001:37070,39002:20845,39003:40595,39004:31108,39005:32907,39006:37682,39007:35542,39008:20525,39009:21644,39010:35441,39011:27498,39012:36036,39013:33031,39014:24785,39015:26528,39016:40434,39017:20121,39018:20120,39019:39952,39020:35435,39021:34241,39022:34152,39023:26880,39024:28286,39025:30871,39026:33109,39071:24332,39072:19984,39073:19989,39074:20010,39075:20017,39076:20022,39077:20028,39078:20031,39079:20034,39080:20054,39081:20056,39082:20098,39083:20101,39084:35947,39085:20106,39086:33298,39087:24333,39088:20110,39089:20126,39090:20127,39091:20128,39092:20130,39093:20144,39094:20147,39095:20150,39096:20174,39097:20173,39098:20164,39099:20166,39100:20162,39101:20183,39102:20190,39103:20205,39104:20191,39105:20215,39106:20233,39107:20314,39108:20272,39109:20315,39110:20317,39111:20311,39112:20295,39113:20342,39114:20360,39115:20367,39116:20376,39117:20347,39118:20329,39119:20336,39120:20369,39121:20335,39122:20358,39123:20374,39124:20760,39125:20436,39126:20447,39127:20430,39128:20440,39129:20443,39130:20433,39131:20442,39132:20432,39133:20452,39134:20453,39135:20506,39136:20520,39137:20500,39138:20522,39139:20517,39140:20485,39141:20252,39142:20470,39143:20513,39144:20521,39145:20524,39146:20478,39147:20463,39148:20497,39149:20486,39150:20547,39151:20551,39152:26371,39153:20565,39154:20560,39155:20552,39156:20570,39157:20566,39158:20588,39159:20600,39160:20608,39161:20634,39162:20613,39163:20660,39164:20658,39232:20681,39233:20682,39234:20659,39235:20674,39236:20694,39237:20702,39238:20709,39239:20717,39240:20707,39241:20718,39242:20729,39243:20725,39244:20745,39245:20737,39246:20738,39247:20758,39248:20757,39249:20756,39250:20762,39251:20769,39252:20794,39253:20791,39254:20796,39255:20795,39256:20799,39257:20800,39258:20818,39259:20812,39260:20820,39261:20834,39262:31480,39263:20841,39264:20842,39265:20846,39266:20864,39267:20866,39268:22232,39269:20876,39270:20873,39271:20879,39272:20881,39273:20883,39274:20885,39275:20886,39276:20900,39277:20902,39278:20898,39279:20905,39280:20906,39281:20907,39282:20915,39283:20913,39284:20914,39285:20912,39286:20917,39287:20925,39288:20933,39289:20937,39290:20955,39291:20960,39292:34389,39293:20969,39294:20973,39296:20976,39297:20981,39298:20990,39299:20996,39300:21003,39301:21012,39302:21006,39303:21031,39304:21034,39305:21038,39306:21043,39307:21049,39308:21071,39309:21060,39310:21067,39311:21068,39312:21086,39313:21076,39314:21098,39315:21108,39316:21097,39317:21107,39318:21119,39319:21117,39320:21133,39321:21140,39322:21138,39323:21105,39324:21128,39325:21137,39326:36776,39327:36775,39328:21164,39329:21165,39330:21180,39331:21173,39332:21185,39333:21197,39334:21207,39335:21214,39336:21219,39337:21222,39338:39149,39339:21216,39340:21235,39341:21237,39342:21240,39343:21241,39344:21254,39345:21256,39346:30008,39347:21261,39348:21264,39349:21263,39350:21269,39351:21274,39352:21283,39353:21295,39354:21297,39355:21299,39356:21304,39357:21312,39358:21318,39359:21317,39360:19991,39361:21321,39362:21325,39363:20950,39364:21342,39365:21353,39366:21358,39367:22808,39368:21371,39369:21367,39370:21378,39371:21398,39372:21408,39373:21414,39374:21413,39375:21422,39376:21424,39377:21430,39378:21443,39379:31762,39380:38617,39381:21471,39382:26364,39383:29166,39384:21486,39385:21480,39386:21485,39387:21498,39388:21505,39389:21565,39390:21568,39391:21548,39392:21549,39393:21564,39394:21550,39395:21558,39396:21545,39397:21533,39398:21582,39399:21647,39400:21621,39401:21646,39402:21599,39403:21617,39404:21623,39405:21616,39406:21650,39407:21627,39408:21632,39409:21622,39410:21636,39411:21648,39412:21638,39413:21703,39414:21666,39415:21688,39416:21669,39417:21676,39418:21700,39419:21704,39420:21672,39488:21675,39489:21698,39490:21668,39491:21694,39492:21692,39493:21720,39494:21733,39495:21734,39496:21775,39497:21780,39498:21757,39499:21742,39500:21741,39501:21754,39502:21730,39503:21817,39504:21824,39505:21859,39506:21836,39507:21806,39508:21852,39509:21829,39510:21846,39511:21847,39512:21816,39513:21811,39514:21853,39515:21913,39516:21888,39517:21679,39518:21898,39519:21919,39520:21883,39521:21886,39522:21912,39523:21918,39524:21934,39525:21884,39526:21891,39527:21929,39528:21895,39529:21928,39530:21978,39531:21957,39532:21983,39533:21956,39534:21980,39535:21988,39536:21972,39537:22036,39538:22007,39539:22038,39540:22014,39541:22013,39542:22043,39543:22009,39544:22094,39545:22096,39546:29151,39547:22068,39548:22070,39549:22066,39550:22072,39552:22123,39553:22116,39554:22063,39555:22124,39556:22122,39557:22150,39558:22144,39559:22154,39560:22176,39561:22164,39562:22159,39563:22181,39564:22190,39565:22198,39566:22196,39567:22210,39568:22204,39569:22209,39570:22211,39571:22208,39572:22216,39573:22222,39574:22225,39575:22227,39576:22231,39577:22254,39578:22265,39579:22272,39580:22271,39581:22276,39582:22281,39583:22280,39584:22283,39585:22285,39586:22291,39587:22296,39588:22294,39589:21959,39590:22300,39591:22310,39592:22327,39593:22328,39594:22350,39595:22331,39596:22336,39597:22351,39598:22377,39599:22464,39600:22408,39601:22369,39602:22399,39603:22409,39604:22419,39605:22432,39606:22451,39607:22436,39608:22442,39609:22448,39610:22467,39611:22470,39612:22484,39613:22482,39614:22483,39615:22538,39616:22486,39617:22499,39618:22539,39619:22553,39620:22557,39621:22642,39622:22561,39623:22626,39624:22603,39625:22640,39626:27584,39627:22610,39628:22589,39629:22649,39630:22661,39631:22713,39632:22687,39633:22699,39634:22714,39635:22750,39636:22715,39637:22712,39638:22702,39639:22725,39640:22739,39641:22737,39642:22743,39643:22745,39644:22744,39645:22757,39646:22748,39647:22756,39648:22751,39649:22767,39650:22778,39651:22777,39652:22779,39653:22780,39654:22781,39655:22786,39656:22794,39657:22800,39658:22811,39659:26790,39660:22821,39661:22828,39662:22829,39663:22834,39664:22840,39665:22846,39666:31442,39667:22869,39668:22864,39669:22862,39670:22874,39671:22872,39672:22882,39673:22880,39674:22887,39675:22892,39676:22889,39744:22904,39745:22913,39746:22941,39747:20318,39748:20395,39749:22947,39750:22962,39751:22982,39752:23016,39753:23004,39754:22925,39755:23001,39756:23002,39757:23077,39758:23071,39759:23057,39760:23068,39761:23049,39762:23066,39763:23104,39764:23148,39765:23113,39766:23093,39767:23094,39768:23138,39769:23146,39770:23194,39771:23228,39772:23230,39773:23243,39774:23234,39775:23229,39776:23267,39777:23255,39778:23270,39779:23273,39780:23254,39781:23290,39782:23291,39783:23308,39784:23307,39785:23318,39786:23346,39787:23248,39788:23338,39789:23350,39790:23358,39791:23363,39792:23365,39793:23360,39794:23377,39795:23381,39796:23386,39797:23387,39798:23397,39799:23401,39800:23408,39801:23411,39802:23413,39803:23416,39804:25992,39805:23418,39806:23424,39808:23427,39809:23462,39810:23480,39811:23491,39812:23495,39813:23497,39814:23508,39815:23504,39816:23524,39817:23526,39818:23522,39819:23518,39820:23525,39821:23531,39822:23536,39823:23542,39824:23539,39825:23557,39826:23559,39827:23560,39828:23565,39829:23571,39830:23584,39831:23586,39832:23592,39833:23608,39834:23609,39835:23617,39836:23622,39837:23630,39838:23635,39839:23632,39840:23631,39841:23409,39842:23660,39843:23662,39844:20066,39845:23670,39846:23673,39847:23692,39848:23697,39849:23700,39850:22939,39851:23723,39852:23739,39853:23734,39854:23740,39855:23735,39856:23749,39857:23742,39858:23751,39859:23769,39860:23785,39861:23805,39862:23802,39863:23789,39864:23948,39865:23786,39866:23819,39867:23829,39868:23831,39869:23900,39870:23839,39871:23835,39872:23825,39873:23828,39874:23842,39875:23834,39876:23833,39877:23832,39878:23884,39879:23890,39880:23886,39881:23883,39882:23916,39883:23923,39884:23926,39885:23943,39886:23940,39887:23938,39888:23970,39889:23965,39890:23980,39891:23982,39892:23997,39893:23952,39894:23991,39895:23996,39896:24009,39897:24013,39898:24019,39899:24018,39900:24022,39901:24027,39902:24043,39903:24050,39904:24053,39905:24075,39906:24090,39907:24089,39908:24081,39909:24091,39910:24118,39911:24119,39912:24132,39913:24131,39914:24128,39915:24142,39916:24151,39917:24148,39918:24159,39919:24162,39920:24164,39921:24135,39922:24181,39923:24182,39924:24186,39925:40636,39926:24191,39927:24224,39928:24257,39929:24258,39930:24264,39931:24272,39932:24271,4e4:24278,40001:24291,40002:24285,40003:24282,40004:24283,40005:24290,40006:24289,40007:24296,40008:24297,40009:24300,40010:24305,40011:24307,40012:24304,40013:24308,40014:24312,40015:24318,40016:24323,40017:24329,40018:24413,40019:24412,40020:24331,40021:24337,40022:24342,40023:24361,40024:24365,40025:24376,40026:24385,40027:24392,40028:24396,40029:24398,40030:24367,40031:24401,40032:24406,40033:24407,40034:24409,40035:24417,40036:24429,40037:24435,40038:24439,40039:24451,40040:24450,40041:24447,40042:24458,40043:24456,40044:24465,40045:24455,40046:24478,40047:24473,40048:24472,40049:24480,40050:24488,40051:24493,40052:24508,40053:24534,40054:24571,40055:24548,40056:24568,40057:24561,40058:24541,40059:24755,40060:24575,40061:24609,40062:24672,40064:24601,40065:24592,40066:24617,40067:24590,40068:24625,40069:24603,40070:24597,40071:24619,40072:24614,40073:24591,40074:24634,40075:24666,40076:24641,40077:24682,40078:24695,40079:24671,40080:24650,40081:24646,40082:24653,40083:24675,40084:24643,40085:24676,40086:24642,40087:24684,40088:24683,40089:24665,40090:24705,40091:24717,40092:24807,40093:24707,40094:24730,40095:24708,40096:24731,40097:24726,40098:24727,40099:24722,40100:24743,40101:24715,40102:24801,40103:24760,40104:24800,40105:24787,40106:24756,40107:24560,40108:24765,40109:24774,40110:24757,40111:24792,40112:24909,40113:24853,40114:24838,40115:24822,40116:24823,40117:24832,40118:24820,40119:24826,40120:24835,40121:24865,40122:24827,40123:24817,40124:24845,40125:24846,40126:24903,40127:24894,40128:24872,40129:24871,40130:24906,40131:24895,40132:24892,40133:24876,40134:24884,40135:24893,40136:24898,40137:24900,40138:24947,40139:24951,40140:24920,40141:24921,40142:24922,40143:24939,40144:24948,40145:24943,40146:24933,40147:24945,40148:24927,40149:24925,40150:24915,40151:24949,40152:24985,40153:24982,40154:24967,40155:25004,40156:24980,40157:24986,40158:24970,40159:24977,40160:25003,40161:25006,40162:25036,40163:25034,40164:25033,40165:25079,40166:25032,40167:25027,40168:25030,40169:25018,40170:25035,40171:32633,40172:25037,40173:25062,40174:25059,40175:25078,40176:25082,40177:25076,40178:25087,40179:25085,40180:25084,40181:25086,40182:25088,40183:25096,40184:25097,40185:25101,40186:25100,40187:25108,40188:25115,40256:25118,40257:25121,40258:25130,40259:25134,40260:25136,40261:25138,40262:25139,40263:25153,40264:25166,40265:25182,40266:25187,40267:25179,40268:25184,40269:25192,40270:25212,40271:25218,40272:25225,40273:25214,40274:25234,40275:25235,40276:25238,40277:25300,40278:25219,40279:25236,40280:25303,40281:25297,40282:25275,40283:25295,40284:25343,40285:25286,40286:25812,40287:25288,40288:25308,40289:25292,40290:25290,40291:25282,40292:25287,40293:25243,40294:25289,40295:25356,40296:25326,40297:25329,40298:25383,40299:25346,40300:25352,40301:25327,40302:25333,40303:25424,40304:25406,40305:25421,40306:25628,40307:25423,40308:25494,40309:25486,40310:25472,40311:25515,40312:25462,40313:25507,40314:25487,40315:25481,40316:25503,40317:25525,40318:25451,40320:25449,40321:25534,40322:25577,40323:25536,40324:25542,40325:25571,40326:25545,40327:25554,40328:25590,40329:25540,40330:25622,40331:25652,40332:25606,40333:25619,40334:25638,40335:25654,40336:25885,40337:25623,40338:25640,40339:25615,40340:25703,40341:25711,40342:25718,40343:25678,40344:25898,40345:25749,40346:25747,40347:25765,40348:25769,40349:25736,40350:25788,40351:25818,40352:25810,40353:25797,40354:25799,40355:25787,40356:25816,40357:25794,40358:25841,40359:25831,40360:33289,40361:25824,40362:25825,40363:25260,40364:25827,40365:25839,40366:25900,40367:25846,40368:25844,40369:25842,40370:25850,40371:25856,40372:25853,40373:25880,40374:25884,40375:25861,40376:25892,40377:25891,40378:25899,40379:25908,40380:25909,40381:25911,40382:25910,40383:25912,40384:30027,40385:25928,40386:25942,40387:25941,40388:25933,40389:25944,40390:25950,40391:25949,40392:25970,40393:25976,40394:25986,40395:25987,40396:35722,40397:26011,40398:26015,40399:26027,40400:26039,40401:26051,40402:26054,40403:26049,40404:26052,40405:26060,40406:26066,40407:26075,40408:26073,40409:26080,40410:26081,40411:26097,40412:26482,40413:26122,40414:26115,40415:26107,40416:26483,40417:26165,40418:26166,40419:26164,40420:26140,40421:26191,40422:26180,40423:26185,40424:26177,40425:26206,40426:26205,40427:26212,40428:26215,40429:26216,40430:26207,40431:26210,40432:26224,40433:26243,40434:26248,40435:26254,40436:26249,40437:26244,40438:26264,40439:26269,40440:26305,40441:26297,40442:26313,40443:26302,40444:26300,40512:26308,40513:26296,40514:26326,40515:26330,40516:26336,40517:26175,40518:26342,40519:26345,40520:26352,40521:26357,40522:26359,40523:26383,40524:26390,40525:26398,40526:26406,40527:26407,40528:38712,40529:26414,40530:26431,40531:26422,40532:26433,40533:26424,40534:26423,40535:26438,40536:26462,40537:26464,40538:26457,40539:26467,40540:26468,40541:26505,40542:26480,40543:26537,40544:26492,40545:26474,40546:26508,40547:26507,40548:26534,40549:26529,40550:26501,40551:26551,40552:26607,40553:26548,40554:26604,40555:26547,40556:26601,40557:26552,40558:26596,40559:26590,40560:26589,40561:26594,40562:26606,40563:26553,40564:26574,40565:26566,40566:26599,40567:27292,40568:26654,40569:26694,40570:26665,40571:26688,40572:26701,40573:26674,40574:26702,40576:26803,40577:26667,40578:26713,40579:26723,40580:26743,40581:26751,40582:26783,40583:26767,40584:26797,40585:26772,40586:26781,40587:26779,40588:26755,40589:27310,40590:26809,40591:26740,40592:26805,40593:26784,40594:26810,40595:26895,40596:26765,40597:26750,40598:26881,40599:26826,40600:26888,40601:26840,40602:26914,40603:26918,40604:26849,40605:26892,40606:26829,40607:26836,40608:26855,40609:26837,40610:26934,40611:26898,40612:26884,40613:26839,40614:26851,40615:26917,40616:26873,40617:26848,40618:26863,40619:26920,40620:26922,40621:26906,40622:26915,40623:26913,40624:26822,40625:27001,40626:26999,40627:26972,40628:27e3,40629:26987,40630:26964,40631:27006,40632:26990,40633:26937,40634:26996,40635:26941,40636:26969,40637:26928,40638:26977,40639:26974,40640:26973,40641:27009,40642:26986,40643:27058,40644:27054,40645:27088,40646:27071,40647:27073,40648:27091,40649:27070,40650:27086,40651:23528,40652:27082,40653:27101,40654:27067,40655:27075,40656:27047,40657:27182,40658:27025,40659:27040,40660:27036,40661:27029,40662:27060,40663:27102,40664:27112,40665:27138,40666:27163,40667:27135,40668:27402,40669:27129,40670:27122,40671:27111,40672:27141,40673:27057,40674:27166,40675:27117,40676:27156,40677:27115,40678:27146,40679:27154,40680:27329,40681:27171,40682:27155,40683:27204,40684:27148,40685:27250,40686:27190,40687:27256,40688:27207,40689:27234,40690:27225,40691:27238,40692:27208,40693:27192,40694:27170,40695:27280,40696:27277,40697:27296,40698:27268,40699:27298,40700:27299,40768:27287,40769:34327,40770:27323,40771:27331,40772:27330,40773:27320,40774:27315,40775:27308,40776:27358,40777:27345,40778:27359,40779:27306,40780:27354,40781:27370,40782:27387,40783:27397,40784:34326,40785:27386,40786:27410,40787:27414,40788:39729,40789:27423,40790:27448,40791:27447,40792:30428,40793:27449,40794:39150,40795:27463,40796:27459,40797:27465,40798:27472,40799:27481,40800:27476,40801:27483,40802:27487,40803:27489,40804:27512,40805:27513,40806:27519,40807:27520,40808:27524,40809:27523,40810:27533,40811:27544,40812:27541,40813:27550,40814:27556,40815:27562,40816:27563,40817:27567,40818:27570,40819:27569,40820:27571,40821:27575,40822:27580,40823:27590,40824:27595,40825:27603,40826:27615,40827:27628,40828:27627,40829:27635,40830:27631,40832:40638,40833:27656,40834:27667,40835:27668,40836:27675,40837:27684,40838:27683,40839:27742,40840:27733,40841:27746,40842:27754,40843:27778,40844:27789,40845:27802,40846:27777,40847:27803,40848:27774,40849:27752,40850:27763,40851:27794,40852:27792,40853:27844,40854:27889,40855:27859,40856:27837,40857:27863,40858:27845,40859:27869,40860:27822,40861:27825,40862:27838,40863:27834,40864:27867,40865:27887,40866:27865,40867:27882,40868:27935,40869:34893,40870:27958,40871:27947,40872:27965,40873:27960,40874:27929,40875:27957,40876:27955,40877:27922,40878:27916,40879:28003,40880:28051,40881:28004,40882:27994,40883:28025,40884:27993,40885:28046,40886:28053,40887:28644,40888:28037,40889:28153,40890:28181,40891:28170,40892:28085,40893:28103,40894:28134,40895:28088,40896:28102,40897:28140,40898:28126,40899:28108,40900:28136,40901:28114,40902:28101,40903:28154,40904:28121,40905:28132,40906:28117,40907:28138,40908:28142,40909:28205,40910:28270,40911:28206,40912:28185,40913:28274,40914:28255,40915:28222,40916:28195,40917:28267,40918:28203,40919:28278,40920:28237,40921:28191,40922:28227,40923:28218,40924:28238,40925:28196,40926:28415,40927:28189,40928:28216,40929:28290,40930:28330,40931:28312,40932:28361,40933:28343,40934:28371,40935:28349,40936:28335,40937:28356,40938:28338,40939:28372,40940:28373,40941:28303,40942:28325,40943:28354,40944:28319,40945:28481,40946:28433,40947:28748,40948:28396,40949:28408,40950:28414,40951:28479,40952:28402,40953:28465,40954:28399,40955:28466,40956:28364,57408:28478,57409:28435,57410:28407,57411:28550,57412:28538,57413:28536,57414:28545,57415:28544,57416:28527,57417:28507,57418:28659,57419:28525,57420:28546,57421:28540,57422:28504,57423:28558,57424:28561,57425:28610,57426:28518,57427:28595,57428:28579,57429:28577,57430:28580,57431:28601,57432:28614,57433:28586,57434:28639,57435:28629,57436:28652,57437:28628,57438:28632,57439:28657,57440:28654,57441:28635,57442:28681,57443:28683,57444:28666,57445:28689,57446:28673,57447:28687,57448:28670,57449:28699,57450:28698,57451:28532,57452:28701,57453:28696,57454:28703,57455:28720,57456:28734,57457:28722,57458:28753,57459:28771,57460:28825,57461:28818,57462:28847,57463:28913,57464:28844,57465:28856,57466:28851,57467:28846,57468:28895,57469:28875,57470:28893,57472:28889,57473:28937,57474:28925,57475:28956,57476:28953,57477:29029,57478:29013,57479:29064,57480:29030,57481:29026,57482:29004,57483:29014,57484:29036,57485:29071,57486:29179,57487:29060,57488:29077,57489:29096,57490:29100,57491:29143,57492:29113,57493:29118,57494:29138,57495:29129,57496:29140,57497:29134,57498:29152,57499:29164,57500:29159,57501:29173,57502:29180,57503:29177,57504:29183,57505:29197,57506:29200,57507:29211,57508:29224,57509:29229,57510:29228,57511:29232,57512:29234,57513:29243,57514:29244,57515:29247,57516:29248,57517:29254,57518:29259,57519:29272,57520:29300,57521:29310,57522:29314,57523:29313,57524:29319,57525:29330,57526:29334,57527:29346,57528:29351,57529:29369,57530:29362,57531:29379,57532:29382,57533:29380,57534:29390,57535:29394,57536:29410,57537:29408,57538:29409,57539:29433,57540:29431,57541:20495,57542:29463,57543:29450,57544:29468,57545:29462,57546:29469,57547:29492,57548:29487,57549:29481,57550:29477,57551:29502,57552:29518,57553:29519,57554:40664,57555:29527,57556:29546,57557:29544,57558:29552,57559:29560,57560:29557,57561:29563,57562:29562,57563:29640,57564:29619,57565:29646,57566:29627,57567:29632,57568:29669,57569:29678,57570:29662,57571:29858,57572:29701,57573:29807,57574:29733,57575:29688,57576:29746,57577:29754,57578:29781,57579:29759,57580:29791,57581:29785,57582:29761,57583:29788,57584:29801,57585:29808,57586:29795,57587:29802,57588:29814,57589:29822,57590:29835,57591:29854,57592:29863,57593:29898,57594:29903,57595:29908,57596:29681,57664:29920,57665:29923,57666:29927,57667:29929,57668:29934,57669:29938,57670:29936,57671:29937,57672:29944,57673:29943,57674:29956,57675:29955,57676:29957,57677:29964,57678:29966,57679:29965,57680:29973,57681:29971,57682:29982,57683:29990,57684:29996,57685:30012,57686:30020,57687:30029,57688:30026,57689:30025,57690:30043,57691:30022,57692:30042,57693:30057,57694:30052,57695:30055,57696:30059,57697:30061,57698:30072,57699:30070,57700:30086,57701:30087,57702:30068,57703:30090,57704:30089,57705:30082,57706:30100,57707:30106,57708:30109,57709:30117,57710:30115,57711:30146,57712:30131,57713:30147,57714:30133,57715:30141,57716:30136,57717:30140,57718:30129,57719:30157,57720:30154,57721:30162,57722:30169,57723:30179,57724:30174,57725:30206,57726:30207,57728:30204,57729:30209,57730:30192,57731:30202,57732:30194,57733:30195,57734:30219,57735:30221,57736:30217,57737:30239,57738:30247,57739:30240,57740:30241,57741:30242,57742:30244,57743:30260,57744:30256,57745:30267,57746:30279,57747:30280,57748:30278,57749:30300,57750:30296,57751:30305,57752:30306,57753:30312,57754:30313,57755:30314,57756:30311,57757:30316,57758:30320,57759:30322,57760:30326,57761:30328,57762:30332,57763:30336,57764:30339,57765:30344,57766:30347,57767:30350,57768:30358,57769:30355,57770:30361,57771:30362,57772:30384,57773:30388,57774:30392,57775:30393,57776:30394,57777:30402,57778:30413,57779:30422,57780:30418,57781:30430,57782:30433,57783:30437,57784:30439,57785:30442,57786:34351,57787:30459,57788:30472,57789:30471,57790:30468,57791:30505,57792:30500,57793:30494,57794:30501,57795:30502,57796:30491,57797:30519,57798:30520,57799:30535,57800:30554,57801:30568,57802:30571,57803:30555,57804:30565,57805:30591,57806:30590,57807:30585,57808:30606,57809:30603,57810:30609,57811:30624,57812:30622,57813:30640,57814:30646,57815:30649,57816:30655,57817:30652,57818:30653,57819:30651,57820:30663,57821:30669,57822:30679,57823:30682,57824:30684,57825:30691,57826:30702,57827:30716,57828:30732,57829:30738,57830:31014,57831:30752,57832:31018,57833:30789,57834:30862,57835:30836,57836:30854,57837:30844,57838:30874,57839:30860,57840:30883,57841:30901,57842:30890,57843:30895,57844:30929,57845:30918,57846:30923,57847:30932,57848:30910,57849:30908,57850:30917,57851:30922,57852:30956,57920:30951,57921:30938,57922:30973,57923:30964,57924:30983,57925:30994,57926:30993,57927:31001,57928:31020,57929:31019,57930:31040,57931:31072,57932:31063,57933:31071,57934:31066,57935:31061,57936:31059,57937:31098,57938:31103,57939:31114,57940:31133,57941:31143,57942:40779,57943:31146,57944:31150,57945:31155,57946:31161,57947:31162,57948:31177,57949:31189,57950:31207,57951:31212,57952:31201,57953:31203,57954:31240,57955:31245,57956:31256,57957:31257,57958:31264,57959:31263,57960:31104,57961:31281,57962:31291,57963:31294,57964:31287,57965:31299,57966:31319,57967:31305,57968:31329,57969:31330,57970:31337,57971:40861,57972:31344,57973:31353,57974:31357,57975:31368,57976:31383,57977:31381,57978:31384,57979:31382,57980:31401,57981:31432,57982:31408,57984:31414,57985:31429,57986:31428,57987:31423,57988:36995,57989:31431,57990:31434,57991:31437,57992:31439,57993:31445,57994:31443,57995:31449,57996:31450,57997:31453,57998:31457,57999:31458,58e3:31462,58001:31469,58002:31472,58003:31490,58004:31503,58005:31498,58006:31494,58007:31539,58008:31512,58009:31513,58010:31518,58011:31541,58012:31528,58013:31542,58014:31568,58015:31610,58016:31492,58017:31565,58018:31499,58019:31564,58020:31557,58021:31605,58022:31589,58023:31604,58024:31591,58025:31600,58026:31601,58027:31596,58028:31598,58029:31645,58030:31640,58031:31647,58032:31629,58033:31644,58034:31642,58035:31627,58036:31634,58037:31631,58038:31581,58039:31641,58040:31691,58041:31681,58042:31692,58043:31695,58044:31668,58045:31686,58046:31709,58047:31721,58048:31761,58049:31764,58050:31718,58051:31717,58052:31840,58053:31744,58054:31751,58055:31763,58056:31731,58057:31735,58058:31767,58059:31757,58060:31734,58061:31779,58062:31783,58063:31786,58064:31775,58065:31799,58066:31787,58067:31805,58068:31820,58069:31811,58070:31828,58071:31823,58072:31808,58073:31824,58074:31832,58075:31839,58076:31844,58077:31830,58078:31845,58079:31852,58080:31861,58081:31875,58082:31888,58083:31908,58084:31917,58085:31906,58086:31915,58087:31905,58088:31912,58089:31923,58090:31922,58091:31921,58092:31918,58093:31929,58094:31933,58095:31936,58096:31941,58097:31938,58098:31960,58099:31954,58100:31964,58101:31970,58102:39739,58103:31983,58104:31986,58105:31988,58106:31990,58107:31994,58108:32006,58176:32002,58177:32028,58178:32021,58179:32010,58180:32069,58181:32075,58182:32046,58183:32050,58184:32063,58185:32053,58186:32070,58187:32115,58188:32086,58189:32078,58190:32114,58191:32104,58192:32110,58193:32079,58194:32099,58195:32147,58196:32137,58197:32091,58198:32143,58199:32125,58200:32155,58201:32186,58202:32174,58203:32163,58204:32181,58205:32199,58206:32189,58207:32171,58208:32317,58209:32162,58210:32175,58211:32220,58212:32184,58213:32159,58214:32176,58215:32216,58216:32221,58217:32228,58218:32222,58219:32251,58220:32242,58221:32225,58222:32261,58223:32266,58224:32291,58225:32289,58226:32274,58227:32305,58228:32287,58229:32265,58230:32267,58231:32290,58232:32326,58233:32358,58234:32315,58235:32309,58236:32313,58237:32323,58238:32311,58240:32306,58241:32314,58242:32359,58243:32349,58244:32342,58245:32350,58246:32345,58247:32346,58248:32377,58249:32362,58250:32361,58251:32380,58252:32379,58253:32387,58254:32213,58255:32381,58256:36782,58257:32383,58258:32392,58259:32393,58260:32396,58261:32402,58262:32400,58263:32403,58264:32404,58265:32406,58266:32398,58267:32411,58268:32412,58269:32568,58270:32570,58271:32581,58272:32588,58273:32589,58274:32590,58275:32592,58276:32593,58277:32597,58278:32596,58279:32600,58280:32607,58281:32608,58282:32616,58283:32617,58284:32615,58285:32632,58286:32642,58287:32646,58288:32643,58289:32648,58290:32647,58291:32652,58292:32660,58293:32670,58294:32669,58295:32666,58296:32675,58297:32687,58298:32690,58299:32697,58300:32686,58301:32694,58302:32696,58303:35697,58304:32709,58305:32710,58306:32714,58307:32725,58308:32724,58309:32737,58310:32742,58311:32745,58312:32755,58313:32761,58314:39132,58315:32774,58316:32772,58317:32779,58318:32786,58319:32792,58320:32793,58321:32796,58322:32801,58323:32808,58324:32831,58325:32827,58326:32842,58327:32838,58328:32850,58329:32856,58330:32858,58331:32863,58332:32866,58333:32872,58334:32883,58335:32882,58336:32880,58337:32886,58338:32889,58339:32893,58340:32895,58341:32900,58342:32902,58343:32901,58344:32923,58345:32915,58346:32922,58347:32941,58348:20880,58349:32940,58350:32987,58351:32997,58352:32985,58353:32989,58354:32964,58355:32986,58356:32982,58357:33033,58358:33007,58359:33009,58360:33051,58361:33065,58362:33059,58363:33071,58364:33099,58432:38539,58433:33094,58434:33086,58435:33107,58436:33105,58437:33020,58438:33137,58439:33134,58440:33125,58441:33126,58442:33140,58443:33155,58444:33160,58445:33162,58446:33152,58447:33154,58448:33184,58449:33173,58450:33188,58451:33187,58452:33119,58453:33171,58454:33193,58455:33200,58456:33205,58457:33214,58458:33208,58459:33213,58460:33216,58461:33218,58462:33210,58463:33225,58464:33229,58465:33233,58466:33241,58467:33240,58468:33224,58469:33242,58470:33247,58471:33248,58472:33255,58473:33274,58474:33275,58475:33278,58476:33281,58477:33282,58478:33285,58479:33287,58480:33290,58481:33293,58482:33296,58483:33302,58484:33321,58485:33323,58486:33336,58487:33331,58488:33344,58489:33369,58490:33368,58491:33373,58492:33370,58493:33375,58494:33380,58496:33378,58497:33384,58498:33386,58499:33387,58500:33326,58501:33393,58502:33399,58503:33400,58504:33406,58505:33421,58506:33426,58507:33451,58508:33439,58509:33467,58510:33452,58511:33505,58512:33507,58513:33503,58514:33490,58515:33524,58516:33523,58517:33530,58518:33683,58519:33539,58520:33531,58521:33529,58522:33502,58523:33542,58524:33500,58525:33545,58526:33497,58527:33589,58528:33588,58529:33558,58530:33586,58531:33585,58532:33600,58533:33593,58534:33616,58535:33605,58536:33583,58537:33579,58538:33559,58539:33560,58540:33669,58541:33690,58542:33706,58543:33695,58544:33698,58545:33686,58546:33571,58547:33678,58548:33671,58549:33674,58550:33660,58551:33717,58552:33651,58553:33653,58554:33696,58555:33673,58556:33704,58557:33780,58558:33811,58559:33771,58560:33742,58561:33789,58562:33795,58563:33752,58564:33803,58565:33729,58566:33783,58567:33799,58568:33760,58569:33778,58570:33805,58571:33826,58572:33824,58573:33725,58574:33848,58575:34054,58576:33787,58577:33901,58578:33834,58579:33852,58580:34138,58581:33924,58582:33911,58583:33899,58584:33965,58585:33902,58586:33922,58587:33897,58588:33862,58589:33836,58590:33903,58591:33913,58592:33845,58593:33994,58594:33890,58595:33977,58596:33983,58597:33951,58598:34009,58599:33997,58600:33979,58601:34010,58602:34e3,58603:33985,58604:33990,58605:34006,58606:33953,58607:34081,58608:34047,58609:34036,58610:34071,58611:34072,58612:34092,58613:34079,58614:34069,58615:34068,58616:34044,58617:34112,58618:34147,58619:34136,58620:34120,58688:34113,58689:34306,58690:34123,58691:34133,58692:34176,58693:34212,58694:34184,58695:34193,58696:34186,58697:34216,58698:34157,58699:34196,58700:34203,58701:34282,58702:34183,58703:34204,58704:34167,58705:34174,58706:34192,58707:34249,58708:34234,58709:34255,58710:34233,58711:34256,58712:34261,58713:34269,58714:34277,58715:34268,58716:34297,58717:34314,58718:34323,58719:34315,58720:34302,58721:34298,58722:34310,58723:34338,58724:34330,58725:34352,58726:34367,58727:34381,58728:20053,58729:34388,58730:34399,58731:34407,58732:34417,58733:34451,58734:34467,58735:34473,58736:34474,58737:34443,58738:34444,58739:34486,58740:34479,58741:34500,58742:34502,58743:34480,58744:34505,58745:34851,58746:34475,58747:34516,58748:34526,58749:34537,58750:34540,58752:34527,58753:34523,58754:34543,58755:34578,58756:34566,58757:34568,58758:34560,58759:34563,58760:34555,58761:34577,58762:34569,58763:34573,58764:34553,58765:34570,58766:34612,58767:34623,58768:34615,58769:34619,58770:34597,58771:34601,58772:34586,58773:34656,58774:34655,58775:34680,58776:34636,58777:34638,58778:34676,58779:34647,58780:34664,58781:34670,58782:34649,58783:34643,58784:34659,58785:34666,58786:34821,58787:34722,58788:34719,58789:34690,58790:34735,58791:34763,58792:34749,58793:34752,58794:34768,58795:38614,58796:34731,58797:34756,58798:34739,58799:34759,58800:34758,58801:34747,58802:34799,58803:34802,58804:34784,58805:34831,58806:34829,58807:34814,58808:34806,58809:34807,58810:34830,58811:34770,58812:34833,58813:34838,58814:34837,58815:34850,58816:34849,58817:34865,58818:34870,58819:34873,58820:34855,58821:34875,58822:34884,58823:34882,58824:34898,58825:34905,58826:34910,58827:34914,58828:34923,58829:34945,58830:34942,58831:34974,58832:34933,58833:34941,58834:34997,58835:34930,58836:34946,58837:34967,58838:34962,58839:34990,58840:34969,58841:34978,58842:34957,58843:34980,58844:34992,58845:35007,58846:34993,58847:35011,58848:35012,58849:35028,58850:35032,58851:35033,58852:35037,58853:35065,58854:35074,58855:35068,58856:35060,58857:35048,58858:35058,58859:35076,58860:35084,58861:35082,58862:35091,58863:35139,58864:35102,58865:35109,58866:35114,58867:35115,58868:35137,58869:35140,58870:35131,58871:35126,58872:35128,58873:35148,58874:35101,58875:35168,58876:35166,58944:35174,58945:35172,58946:35181,58947:35178,58948:35183,58949:35188,58950:35191,58951:35198,58952:35203,58953:35208,58954:35210,58955:35219,58956:35224,58957:35233,58958:35241,58959:35238,58960:35244,58961:35247,58962:35250,58963:35258,58964:35261,58965:35263,58966:35264,58967:35290,58968:35292,58969:35293,58970:35303,58971:35316,58972:35320,58973:35331,58974:35350,58975:35344,58976:35340,58977:35355,58978:35357,58979:35365,58980:35382,58981:35393,58982:35419,58983:35410,58984:35398,58985:35400,58986:35452,58987:35437,58988:35436,58989:35426,58990:35461,58991:35458,58992:35460,58993:35496,58994:35489,58995:35473,58996:35493,58997:35494,58998:35482,58999:35491,59e3:35524,59001:35533,59002:35522,59003:35546,59004:35563,59005:35571,59006:35559,59008:35556,59009:35569,59010:35604,59011:35552,59012:35554,59013:35575,59014:35550,59015:35547,59016:35596,59017:35591,59018:35610,59019:35553,59020:35606,59021:35600,59022:35607,59023:35616,59024:35635,59025:38827,59026:35622,59027:35627,59028:35646,59029:35624,59030:35649,59031:35660,59032:35663,59033:35662,59034:35657,59035:35670,59036:35675,59037:35674,59038:35691,59039:35679,59040:35692,59041:35695,59042:35700,59043:35709,59044:35712,59045:35724,59046:35726,59047:35730,59048:35731,59049:35734,59050:35737,59051:35738,59052:35898,59053:35905,59054:35903,59055:35912,59056:35916,59057:35918,59058:35920,59059:35925,59060:35938,59061:35948,59062:35960,59063:35962,59064:35970,59065:35977,59066:35973,59067:35978,59068:35981,59069:35982,59070:35988,59071:35964,59072:35992,59073:25117,59074:36013,59075:36010,59076:36029,59077:36018,59078:36019,59079:36014,59080:36022,59081:36040,59082:36033,59083:36068,59084:36067,59085:36058,59086:36093,59087:36090,59088:36091,59089:36100,59090:36101,59091:36106,59092:36103,59093:36111,59094:36109,59095:36112,59096:40782,59097:36115,59098:36045,59099:36116,59100:36118,59101:36199,59102:36205,59103:36209,59104:36211,59105:36225,59106:36249,59107:36290,59108:36286,59109:36282,59110:36303,59111:36314,59112:36310,59113:36300,59114:36315,59115:36299,59116:36330,59117:36331,59118:36319,59119:36323,59120:36348,59121:36360,59122:36361,59123:36351,59124:36381,59125:36382,59126:36368,59127:36383,59128:36418,59129:36405,59130:36400,59131:36404,59132:36426,59200:36423,59201:36425,59202:36428,59203:36432,59204:36424,59205:36441,59206:36452,59207:36448,59208:36394,59209:36451,59210:36437,59211:36470,59212:36466,59213:36476,59214:36481,59215:36487,59216:36485,59217:36484,59218:36491,59219:36490,59220:36499,59221:36497,59222:36500,59223:36505,59224:36522,59225:36513,59226:36524,59227:36528,59228:36550,59229:36529,59230:36542,59231:36549,59232:36552,59233:36555,59234:36571,59235:36579,59236:36604,59237:36603,59238:36587,59239:36606,59240:36618,59241:36613,59242:36629,59243:36626,59244:36633,59245:36627,59246:36636,59247:36639,59248:36635,59249:36620,59250:36646,59251:36659,59252:36667,59253:36665,59254:36677,59255:36674,59256:36670,59257:36684,59258:36681,59259:36678,59260:36686,59261:36695,59262:36700,59264:36706,59265:36707,59266:36708,59267:36764,59268:36767,59269:36771,59270:36781,59271:36783,59272:36791,59273:36826,59274:36837,59275:36834,59276:36842,59277:36847,59278:36999,59279:36852,59280:36869,59281:36857,59282:36858,59283:36881,59284:36885,59285:36897,59286:36877,59287:36894,59288:36886,59289:36875,59290:36903,59291:36918,59292:36917,59293:36921,59294:36856,59295:36943,59296:36944,59297:36945,59298:36946,59299:36878,59300:36937,59301:36926,59302:36950,59303:36952,59304:36958,59305:36968,59306:36975,59307:36982,59308:38568,59309:36978,59310:36994,59311:36989,59312:36993,59313:36992,59314:37002,59315:37001,59316:37007,59317:37032,59318:37039,59319:37041,59320:37045,59321:37090,59322:37092,59323:25160,59324:37083,59325:37122,59326:37138,59327:37145,59328:37170,59329:37168,59330:37194,59331:37206,59332:37208,59333:37219,59334:37221,59335:37225,59336:37235,59337:37234,59338:37259,59339:37257,59340:37250,59341:37282,59342:37291,59343:37295,59344:37290,59345:37301,59346:37300,59347:37306,59348:37312,59349:37313,59350:37321,59351:37323,59352:37328,59353:37334,59354:37343,59355:37345,59356:37339,59357:37372,59358:37365,59359:37366,59360:37406,59361:37375,59362:37396,59363:37420,59364:37397,59365:37393,59366:37470,59367:37463,59368:37445,59369:37449,59370:37476,59371:37448,59372:37525,59373:37439,59374:37451,59375:37456,59376:37532,59377:37526,59378:37523,59379:37531,59380:37466,59381:37583,59382:37561,59383:37559,59384:37609,59385:37647,59386:37626,59387:37700,59388:37678,59456:37657,59457:37666,59458:37658,59459:37667,59460:37690,59461:37685,59462:37691,59463:37724,59464:37728,59465:37756,59466:37742,59467:37718,59468:37808,59469:37804,59470:37805,59471:37780,59472:37817,59473:37846,59474:37847,59475:37864,59476:37861,59477:37848,59478:37827,59479:37853,59480:37840,59481:37832,59482:37860,59483:37914,59484:37908,59485:37907,59486:37891,59487:37895,59488:37904,59489:37942,59490:37931,59491:37941,59492:37921,59493:37946,59494:37953,59495:37970,59496:37956,59497:37979,59498:37984,59499:37986,59500:37982,59501:37994,59502:37417,59503:38e3,59504:38005,59505:38007,59506:38013,59507:37978,59508:38012,59509:38014,59510:38017,59511:38015,59512:38274,59513:38279,59514:38282,59515:38292,59516:38294,59517:38296,59518:38297,59520:38304,59521:38312,59522:38311,59523:38317,59524:38332,59525:38331,59526:38329,59527:38334,59528:38346,59529:28662,59530:38339,59531:38349,59532:38348,59533:38357,59534:38356,59535:38358,59536:38364,59537:38369,59538:38373,59539:38370,59540:38433,59541:38440,59542:38446,59543:38447,59544:38466,59545:38476,59546:38479,59547:38475,59548:38519,59549:38492,59550:38494,59551:38493,59552:38495,59553:38502,59554:38514,59555:38508,59556:38541,59557:38552,59558:38549,59559:38551,59560:38570,59561:38567,59562:38577,59563:38578,59564:38576,59565:38580,59566:38582,59567:38584,59568:38585,59569:38606,59570:38603,59571:38601,59572:38605,59573:35149,59574:38620,59575:38669,59576:38613,59577:38649,59578:38660,59579:38662,59580:38664,59581:38675,59582:38670,59583:38673,59584:38671,59585:38678,59586:38681,59587:38692,59588:38698,59589:38704,59590:38713,59591:38717,59592:38718,59593:38724,59594:38726,59595:38728,59596:38722,59597:38729,59598:38748,59599:38752,59600:38756,59601:38758,59602:38760,59603:21202,59604:38763,59605:38769,59606:38777,59607:38789,59608:38780,59609:38785,59610:38778,59611:38790,59612:38795,59613:38799,59614:38800,59615:38812,59616:38824,59617:38822,59618:38819,59619:38835,59620:38836,59621:38851,59622:38854,59623:38856,59624:38859,59625:38876,59626:38893,59627:40783,59628:38898,59629:31455,59630:38902,59631:38901,59632:38927,59633:38924,59634:38968,59635:38948,59636:38945,59637:38967,59638:38973,59639:38982,59640:38991,59641:38987,59642:39019,59643:39023,59644:39024,59712:39025,59713:39028,59714:39027,59715:39082,59716:39087,59717:39089,59718:39094,59719:39108,59720:39107,59721:39110,59722:39145,59723:39147,59724:39171,59725:39177,59726:39186,59727:39188,59728:39192,59729:39201,59730:39197,59731:39198,59732:39204,59733:39200,59734:39212,59735:39214,59736:39229,59737:39230,59738:39234,59739:39241,59740:39237,59741:39248,59742:39243,59743:39249,59744:39250,59745:39244,59746:39253,59747:39319,59748:39320,59749:39333,59750:39341,59751:39342,59752:39356,59753:39391,59754:39387,59755:39389,59756:39384,59757:39377,59758:39405,59759:39406,59760:39409,59761:39410,59762:39419,59763:39416,59764:39425,59765:39439,59766:39429,59767:39394,59768:39449,59769:39467,59770:39479,59771:39493,59772:39490,59773:39488,59774:39491,59776:39486,59777:39509,59778:39501,59779:39515,59780:39511,59781:39519,59782:39522,59783:39525,59784:39524,59785:39529,59786:39531,59787:39530,59788:39597,59789:39600,59790:39612,59791:39616,59792:39631,59793:39633,59794:39635,59795:39636,59796:39646,59797:39647,59798:39650,59799:39651,59800:39654,59801:39663,59802:39659,59803:39662,59804:39668,59805:39665,59806:39671,59807:39675,59808:39686,59809:39704,59810:39706,59811:39711,59812:39714,59813:39715,59814:39717,59815:39719,59816:39720,59817:39721,59818:39722,59819:39726,59820:39727,59821:39730,59822:39748,59823:39747,59824:39759,59825:39757,59826:39758,59827:39761,59828:39768,59829:39796,59830:39827,59831:39811,59832:39825,59833:39830,59834:39831,59835:39839,59836:39840,59837:39848,59838:39860,59839:39872,59840:39882,59841:39865,59842:39878,59843:39887,59844:39889,59845:39890,59846:39907,59847:39906,59848:39908,59849:39892,59850:39905,59851:39994,59852:39922,59853:39921,59854:39920,59855:39957,59856:39956,59857:39945,59858:39955,59859:39948,59860:39942,59861:39944,59862:39954,59863:39946,59864:39940,59865:39982,59866:39963,59867:39973,59868:39972,59869:39969,59870:39984,59871:40007,59872:39986,59873:40006,59874:39998,59875:40026,59876:40032,59877:40039,59878:40054,59879:40056,59880:40167,59881:40172,59882:40176,59883:40201,59884:40200,59885:40171,59886:40195,59887:40198,59888:40234,59889:40230,59890:40367,59891:40227,59892:40223,59893:40260,59894:40213,59895:40210,59896:40257,59897:40255,59898:40254,59899:40262,59900:40264,59968:40285,59969:40286,59970:40292,59971:40273,59972:40272,59973:40281,59974:40306,59975:40329,59976:40327,59977:40363,59978:40303,59979:40314,59980:40346,59981:40356,59982:40361,59983:40370,59984:40388,59985:40385,59986:40379,59987:40376,59988:40378,59989:40390,59990:40399,59991:40386,59992:40409,59993:40403,59994:40440,59995:40422,59996:40429,59997:40431,59998:40445,59999:40474,6e4:40475,60001:40478,60002:40565,60003:40569,60004:40573,60005:40577,60006:40584,60007:40587,60008:40588,60009:40594,60010:40597,60011:40593,60012:40605,60013:40613,60014:40617,60015:40632,60016:40618,60017:40621,60018:38753,60019:40652,60020:40654,60021:40655,60022:40656,60023:40660,60024:40668,60025:40670,60026:40669,60027:40672,60028:40677,60029:40680,60030:40687,60032:40692,60033:40694,60034:40695,60035:40697,60036:40699,60037:40700,60038:40701,60039:40711,60040:40712,60041:30391,60042:40725,60043:40737,60044:40748,60045:40766,60046:40778,60047:40786,60048:40788,60049:40803,60050:40799,60051:40800,60052:40801,60053:40806,60054:40807,60055:40812,60056:40810,60057:40823,60058:40818,60059:40822,60060:40853,60061:40860,60062:40864,60063:22575,60064:27079,60065:36953,60066:29796,60067:20956,60068:29081,60736:32394,60737:35100,60738:37704,60739:37512,60740:34012,60741:20425,60742:28859,60743:26161,60744:26824,60745:37625,60746:26363,60747:24389,60748:20008,60749:20193,60750:20220,60751:20224,60752:20227,60753:20281,60754:20310,60755:20370,60756:20362,60757:20378,60758:20372,60759:20429,60760:20544,60761:20514,60762:20479,60763:20510,60764:20550,60765:20592,60766:20546,60767:20628,60768:20724,60769:20696,60770:20810,60771:20836,60772:20893,60773:20926,60774:20972,60775:21013,60776:21148,60777:21158,60778:21184,60779:21211,60780:21248,60781:21255,60782:21284,60783:21362,60784:21395,60785:21426,60786:21469,60787:64014,60788:21660,60789:21642,60790:21673,60791:21759,60792:21894,60793:22361,60794:22373,60795:22444,60796:22472,60797:22471,60798:64015,60800:64016,60801:22686,60802:22706,60803:22795,60804:22867,60805:22875,60806:22877,60807:22883,60808:22948,60809:22970,60810:23382,60811:23488,60812:29999,60813:23512,60814:23532,60815:23582,60816:23718,60817:23738,60818:23797,60819:23847,60820:23891,60821:64017,60822:23874,60823:23917,60824:23992,60825:23993,60826:24016,60827:24353,60828:24372,60829:24423,60830:24503,60831:24542,60832:24669,60833:24709,60834:24714,60835:24798,60836:24789,60837:24864,60838:24818,60839:24849,60840:24887,60841:24880,60842:24984,60843:25107,60844:25254,60845:25589,60846:25696,60847:25757,60848:25806,60849:25934,60850:26112,60851:26133,60852:26171,60853:26121,60854:26158,60855:26142,60856:26148,60857:26213,60858:26199,60859:26201,60860:64018,60861:26227,60862:26265,60863:26272,60864:26290,60865:26303,60866:26362,60867:26382,60868:63785,60869:26470,60870:26555,60871:26706,60872:26560,60873:26625,60874:26692,60875:26831,60876:64019,60877:26984,60878:64020,60879:27032,60880:27106,60881:27184,60882:27243,60883:27206,60884:27251,60885:27262,60886:27362,60887:27364,60888:27606,60889:27711,60890:27740,60891:27782,60892:27759,60893:27866,60894:27908,60895:28039,60896:28015,60897:28054,60898:28076,60899:28111,60900:28152,60901:28146,60902:28156,60903:28217,60904:28252,60905:28199,60906:28220,60907:28351,60908:28552,60909:28597,60910:28661,60911:28677,60912:28679,60913:28712,60914:28805,60915:28843,60916:28943,60917:28932,60918:29020,60919:28998,60920:28999,60921:64021,60922:29121,60923:29182,60924:29361,60992:29374,60993:29476,60994:64022,60995:29559,60996:29629,60997:29641,60998:29654,60999:29667,61e3:29650,61001:29703,61002:29685,61003:29734,61004:29738,61005:29737,61006:29742,61007:29794,61008:29833,61009:29855,61010:29953,61011:30063,61012:30338,61013:30364,61014:30366,61015:30363,61016:30374,61017:64023,61018:30534,61019:21167,61020:30753,61021:30798,61022:30820,61023:30842,61024:31024,61025:64024,61026:64025,61027:64026,61028:31124,61029:64027,61030:31131,61031:31441,61032:31463,61033:64028,61034:31467,61035:31646,61036:64029,61037:32072,61038:32092,61039:32183,61040:32160,61041:32214,61042:32338,61043:32583,61044:32673,61045:64030,61046:33537,61047:33634,61048:33663,61049:33735,61050:33782,61051:33864,61052:33972,61053:34131,61054:34137,61056:34155,61057:64031,61058:34224,61059:64032,61060:64033,61061:34823,61062:35061,61063:35346,61064:35383,61065:35449,61066:35495,61067:35518,61068:35551,61069:64034,61070:35574,61071:35667,61072:35711,61073:36080,61074:36084,61075:36114,61076:36214,61077:64035,61078:36559,61079:64036,61080:64037,61081:36967,61082:37086,61083:64038,61084:37141,61085:37159,61086:37338,61087:37335,61088:37342,61089:37357,61090:37358,61091:37348,61092:37349,61093:37382,61094:37392,61095:37386,61096:37434,61097:37440,61098:37436,61099:37454,61100:37465,61101:37457,61102:37433,61103:37479,61104:37543,61105:37495,61106:37496,61107:37607,61108:37591,61109:37593,61110:37584,61111:64039,61112:37589,61113:37600,61114:37587,61115:37669,61116:37665,61117:37627,61118:64040,61119:37662,61120:37631,61121:37661,61122:37634,61123:37744,61124:37719,61125:37796,61126:37830,61127:37854,61128:37880,61129:37937,61130:37957,61131:37960,61132:38290,61133:63964,61134:64041,61135:38557,61136:38575,61137:38707,61138:38715,61139:38723,61140:38733,61141:38735,61142:38737,61143:38741,61144:38999,61145:39013,61146:64042,61147:64043,61148:39207,61149:64044,61150:39326,61151:39502,61152:39641,61153:39644,61154:39797,61155:39794,61156:39823,61157:39857,61158:39867,61159:39936,61160:40304,61161:40299,61162:64045,61163:40473,61164:40657,61167:8560,61168:8561,61169:8562,61170:8563,61171:8564,61172:8565,61173:8566,61174:8567,61175:8568,61176:8569,61177:65506,61178:65508,61179:65287,61180:65282,61504:57344,61505:57345,61506:57346,61507:57347,61508:57348,61509:57349,61510:57350,61511:57351,61512:57352,61513:57353,61514:57354,61515:57355,61516:57356,61517:57357,61518:57358,61519:57359,61520:57360,61521:57361,61522:57362,61523:57363,61524:57364,61525:57365,61526:57366,61527:57367,61528:57368,61529:57369,61530:57370,61531:57371,61532:57372,61533:57373,61534:57374,61535:57375,61536:57376,61537:57377,61538:57378,61539:57379,61540:57380,61541:57381,61542:57382,61543:57383,61544:57384,61545:57385,61546:57386,61547:57387,61548:57388,61549:57389,61550:57390,61551:57391,61552:57392,61553:57393,61554:57394,61555:57395,61556:57396,61557:57397,61558:57398,61559:57399,61560:57400,61561:57401,61562:57402,61563:57403,61564:57404,61565:57405,61566:57406,61568:57407,61569:57408,61570:57409,61571:57410,61572:57411,61573:57412,61574:57413,61575:57414,61576:57415,61577:57416,61578:57417,61579:57418,61580:57419,61581:57420,61582:57421,61583:57422,61584:57423,61585:57424,61586:57425,61587:57426,61588:57427,61589:57428,61590:57429,61591:57430,61592:57431,61593:57432,61594:57433,61595:57434,61596:57435,61597:57436,61598:57437,61599:57438,61600:57439,61601:57440,61602:57441,61603:57442,61604:57443,61605:57444,61606:57445,61607:57446,61608:57447,61609:57448,61610:57449,61611:57450,61612:57451,61613:57452,61614:57453,61615:57454,61616:57455,61617:57456,61618:57457,61619:57458,61620:57459,61621:57460,61622:57461,61623:57462,61624:57463,61625:57464,61626:57465,61627:57466,61628:57467,61629:57468,61630:57469,61631:57470,61632:57471,61633:57472,61634:57473,61635:57474,61636:57475,61637:57476,61638:57477,61639:57478,61640:57479,61641:57480,61642:57481,61643:57482,61644:57483,61645:57484,61646:57485,61647:57486,61648:57487,61649:57488,61650:57489,61651:57490,61652:57491,61653:57492,61654:57493,61655:57494,61656:57495,61657:57496,61658:57497,61659:57498,61660:57499,61661:57500,61662:57501,61663:57502,61664:57503,61665:57504,61666:57505,61667:57506,61668:57507,61669:57508,61670:57509,61671:57510,61672:57511,61673:57512,61674:57513,61675:57514,61676:57515,61677:57516,61678:57517,61679:57518,61680:57519,61681:57520,61682:57521,61683:57522,61684:57523,61685:57524,61686:57525,61687:57526,61688:57527,61689:57528,61690:57529,61691:57530,61692:57531,61760:57532,61761:57533,61762:57534,61763:57535,61764:57536,61765:57537,61766:57538,61767:57539,61768:57540,61769:57541,61770:57542,61771:57543,61772:57544,61773:57545,61774:57546,61775:57547,61776:57548,61777:57549,61778:57550,61779:57551,61780:57552,61781:57553,61782:57554,61783:57555,61784:57556,61785:57557,61786:57558,61787:57559,61788:57560,61789:57561,61790:57562,61791:57563,61792:57564,61793:57565,61794:57566,61795:57567,61796:57568,61797:57569,61798:57570,61799:57571,61800:57572,61801:57573,61802:57574,61803:57575,61804:57576,61805:57577,61806:57578,61807:57579,61808:57580,61809:57581,61810:57582,61811:57583,61812:57584,61813:57585,61814:57586,61815:57587,61816:57588,61817:57589,61818:57590,61819:57591,61820:57592,61821:57593,61822:57594,61824:57595,61825:57596,61826:57597,61827:57598,61828:57599,61829:57600,61830:57601,61831:57602,61832:57603,61833:57604,61834:57605,61835:57606,61836:57607,61837:57608,61838:57609,61839:57610,61840:57611,61841:57612,61842:57613,61843:57614,61844:57615,61845:57616,61846:57617,61847:57618,61848:57619,61849:57620,61850:57621,61851:57622,61852:57623,61853:57624,61854:57625,61855:57626,61856:57627,61857:57628,61858:57629,61859:57630,61860:57631,61861:57632,61862:57633,61863:57634,61864:57635,61865:57636,61866:57637,61867:57638,61868:57639,61869:57640,61870:57641,61871:57642,61872:57643,61873:57644,61874:57645,61875:57646,61876:57647,61877:57648,61878:57649,61879:57650,61880:57651,61881:57652,61882:57653,61883:57654,61884:57655,61885:57656,61886:57657,61887:57658,61888:57659,61889:57660,61890:57661,61891:57662,61892:57663,61893:57664,61894:57665,61895:57666,61896:57667,61897:57668,61898:57669,61899:57670,61900:57671,61901:57672,61902:57673,61903:57674,61904:57675,61905:57676,61906:57677,61907:57678,61908:57679,61909:57680,61910:57681,61911:57682,61912:57683,61913:57684,61914:57685,61915:57686,61916:57687,61917:57688,61918:57689,61919:57690,61920:57691,61921:57692,61922:57693,61923:57694,61924:57695,61925:57696,61926:57697,61927:57698,61928:57699,61929:57700,61930:57701,61931:57702,61932:57703,61933:57704,61934:57705,61935:57706,61936:57707,61937:57708,61938:57709,61939:57710,61940:57711,61941:57712,61942:57713,61943:57714,61944:57715,61945:57716,61946:57717,61947:57718,61948:57719,62016:57720,62017:57721,62018:57722,62019:57723,62020:57724,62021:57725,62022:57726,62023:57727,62024:57728,62025:57729,62026:57730,62027:57731,62028:57732,62029:57733,62030:57734,62031:57735,62032:57736,62033:57737,62034:57738,62035:57739,62036:57740,62037:57741,62038:57742,62039:57743,62040:57744,62041:57745,62042:57746,62043:57747,62044:57748,62045:57749,62046:57750,62047:57751,62048:57752,62049:57753,62050:57754,62051:57755,62052:57756,62053:57757,62054:57758,62055:57759,62056:57760,62057:57761,62058:57762,62059:57763,62060:57764,62061:57765,62062:57766,62063:57767,62064:57768,62065:57769,62066:57770,62067:57771,62068:57772,62069:57773,62070:57774,62071:57775,62072:57776,62073:57777,62074:57778,62075:57779,62076:57780,62077:57781,62078:57782,62080:57783,62081:57784,62082:57785,62083:57786,62084:57787,62085:57788,62086:57789,62087:57790,62088:57791,62089:57792,62090:57793,62091:57794,62092:57795,62093:57796,62094:57797,62095:57798,62096:57799,62097:57800,62098:57801,62099:57802,62100:57803,62101:57804,62102:57805,62103:57806,62104:57807,62105:57808,62106:57809,62107:57810,62108:57811,62109:57812,62110:57813,62111:57814,62112:57815,62113:57816,62114:57817,62115:57818,62116:57819,62117:57820,62118:57821,62119:57822,62120:57823,62121:57824,62122:57825,62123:57826,62124:57827,62125:57828,62126:57829,62127:57830,62128:57831,62129:57832,62130:57833,62131:57834,62132:57835,62133:57836,62134:57837,62135:57838,62136:57839,62137:57840,62138:57841,62139:57842,62140:57843,62141:57844,62142:57845,62143:57846,62144:57847,62145:57848,62146:57849,62147:57850,62148:57851,62149:57852,62150:57853,62151:57854,62152:57855,62153:57856,62154:57857,62155:57858,62156:57859,62157:57860,62158:57861,62159:57862,62160:57863,62161:57864,62162:57865,62163:57866,62164:57867,62165:57868,62166:57869,62167:57870,62168:57871,62169:57872,62170:57873,62171:57874,62172:57875,62173:57876,62174:57877,62175:57878,62176:57879,62177:57880,62178:57881,62179:57882,62180:57883,62181:57884,62182:57885,62183:57886,62184:57887,62185:57888,62186:57889,62187:57890,62188:57891,62189:57892,62190:57893,62191:57894,62192:57895,62193:57896,62194:57897,62195:57898,62196:57899,62197:57900,62198:57901,62199:57902,62200:57903,62201:57904,62202:57905,62203:57906,62204:57907,62272:57908,62273:57909,62274:57910,62275:57911,62276:57912,62277:57913,62278:57914,62279:57915,62280:57916,62281:57917,62282:57918,62283:57919,62284:57920,62285:57921,62286:57922,62287:57923,62288:57924,62289:57925,62290:57926,62291:57927,62292:57928,62293:57929,62294:57930,62295:57931,62296:57932,62297:57933,62298:57934,62299:57935,62300:57936,62301:57937,62302:57938,62303:57939,62304:57940,62305:57941,62306:57942,62307:57943,62308:57944,62309:57945,62310:57946,62311:57947,62312:57948,62313:57949,62314:57950,62315:57951,62316:57952,62317:57953,62318:57954,62319:57955,62320:57956,62321:57957,62322:57958,62323:57959,62324:57960,62325:57961,62326:57962,62327:57963,62328:57964,62329:57965,62330:57966,62331:57967,62332:57968,62333:57969,62334:57970,62336:57971,62337:57972,62338:57973,62339:57974,62340:57975,62341:57976,62342:57977,62343:57978,62344:57979,62345:57980,62346:57981,62347:57982,62348:57983,62349:57984,62350:57985,62351:57986,62352:57987,62353:57988,62354:57989,62355:57990,62356:57991,62357:57992,62358:57993,62359:57994,62360:57995,62361:57996,62362:57997,62363:57998,62364:57999,62365:58e3,62366:58001,62367:58002,62368:58003,62369:58004,62370:58005,62371:58006,62372:58007,62373:58008,62374:58009,62375:58010,62376:58011,62377:58012,62378:58013,62379:58014,62380:58015,62381:58016,62382:58017,62383:58018,62384:58019,62385:58020,62386:58021,62387:58022,62388:58023,62389:58024,62390:58025,62391:58026,62392:58027,62393:58028,62394:58029,62395:58030,62396:58031,62397:58032,62398:58033,62399:58034,62400:58035,62401:58036,62402:58037,62403:58038,62404:58039,62405:58040,62406:58041,62407:58042,62408:58043,62409:58044,62410:58045,62411:58046,62412:58047,62413:58048,62414:58049,62415:58050,62416:58051,62417:58052,62418:58053,62419:58054,62420:58055,62421:58056,62422:58057,62423:58058,62424:58059,62425:58060,62426:58061,62427:58062,62428:58063,62429:58064,62430:58065,62431:58066,62432:58067,62433:58068,62434:58069,62435:58070,62436:58071,62437:58072,62438:58073,62439:58074,62440:58075,62441:58076,62442:58077,62443:58078,62444:58079,62445:58080,62446:58081,62447:58082,62448:58083,62449:58084,62450:58085,62451:58086,62452:58087,62453:58088,62454:58089,62455:58090,62456:58091,62457:58092,62458:58093,62459:58094,62460:58095,62528:58096,62529:58097,62530:58098,62531:58099,62532:58100,62533:58101,62534:58102,62535:58103,62536:58104,62537:58105,62538:58106,62539:58107,62540:58108,62541:58109,62542:58110,62543:58111,62544:58112,62545:58113,62546:58114,62547:58115,62548:58116,62549:58117,62550:58118,62551:58119,62552:58120,62553:58121,62554:58122,62555:58123,62556:58124,62557:58125,62558:58126,62559:58127,62560:58128,62561:58129,62562:58130,62563:58131,62564:58132,62565:58133,62566:58134,62567:58135,62568:58136,62569:58137,62570:58138,62571:58139,62572:58140,62573:58141,62574:58142,62575:58143,62576:58144,62577:58145,62578:58146,62579:58147,62580:58148,62581:58149,62582:58150,62583:58151,62584:58152,62585:58153,62586:58154,62587:58155,62588:58156,62589:58157,62590:58158,62592:58159,62593:58160,62594:58161,62595:58162,62596:58163,62597:58164,62598:58165,62599:58166,62600:58167,62601:58168,62602:58169,62603:58170,62604:58171,62605:58172,62606:58173,62607:58174,62608:58175,62609:58176,62610:58177,62611:58178,62612:58179,62613:58180,62614:58181,62615:58182,62616:58183,62617:58184,62618:58185,62619:58186,62620:58187,62621:58188,62622:58189,62623:58190,62624:58191,62625:58192,62626:58193,62627:58194,62628:58195,62629:58196,62630:58197,62631:58198,62632:58199,62633:58200,62634:58201,62635:58202,62636:58203,62637:58204,62638:58205,62639:58206,62640:58207,62641:58208,62642:58209,62643:58210,62644:58211,62645:58212,62646:58213,62647:58214,62648:58215,62649:58216,62650:58217,62651:58218,62652:58219,62653:58220,62654:58221,62655:58222,62656:58223,62657:58224,62658:58225,62659:58226,62660:58227,62661:58228,62662:58229,62663:58230,62664:58231,62665:58232,62666:58233,62667:58234,62668:58235,62669:58236,62670:58237,62671:58238,62672:58239,62673:58240,62674:58241,62675:58242,62676:58243,62677:58244,62678:58245,62679:58246,62680:58247,62681:58248,62682:58249,62683:58250,62684:58251,62685:58252,62686:58253,62687:58254,62688:58255,62689:58256,62690:58257,62691:58258,62692:58259,62693:58260,62694:58261,62695:58262,62696:58263,62697:58264,62698:58265,62699:58266,62700:58267,62701:58268,62702:58269,62703:58270,62704:58271,62705:58272,62706:58273,62707:58274,62708:58275,62709:58276,62710:58277,62711:58278,62712:58279,62713:58280,62714:58281,62715:58282,62716:58283,62784:58284,62785:58285,62786:58286,62787:58287,62788:58288,62789:58289,62790:58290,62791:58291,62792:58292,62793:58293,62794:58294,62795:58295,62796:58296,62797:58297,62798:58298,62799:58299,62800:58300,62801:58301,62802:58302,62803:58303,62804:58304,62805:58305,62806:58306,62807:58307,62808:58308,62809:58309,62810:58310,62811:58311,62812:58312,62813:58313,62814:58314,62815:58315,62816:58316,62817:58317,62818:58318,62819:58319,62820:58320,62821:58321,62822:58322,62823:58323,62824:58324,62825:58325,62826:58326,62827:58327,62828:58328,62829:58329,62830:58330,62831:58331,62832:58332,62833:58333,62834:58334,62835:58335,62836:58336,62837:58337,62838:58338,62839:58339,62840:58340,62841:58341,62842:58342,62843:58343,62844:58344,62845:58345,62846:58346,62848:58347,62849:58348,62850:58349,62851:58350,62852:58351,62853:58352,62854:58353,62855:58354,62856:58355,62857:58356,62858:58357,62859:58358,62860:58359,62861:58360,62862:58361,62863:58362,62864:58363,62865:58364,62866:58365,62867:58366,62868:58367,62869:58368,62870:58369,62871:58370,62872:58371,62873:58372,62874:58373,62875:58374,62876:58375,62877:58376,62878:58377,62879:58378,62880:58379,62881:58380,62882:58381,62883:58382,62884:58383,62885:58384,62886:58385,62887:58386,62888:58387,62889:58388,62890:58389,62891:58390,62892:58391,62893:58392,62894:58393,62895:58394,62896:58395,62897:58396,62898:58397,62899:58398,62900:58399,62901:58400,62902:58401,62903:58402,62904:58403,62905:58404,62906:58405,62907:58406,62908:58407,62909:58408,62910:58409,62911:58410,62912:58411,62913:58412,62914:58413,62915:58414,62916:58415,62917:58416,62918:58417,62919:58418,62920:58419,62921:58420,62922:58421,62923:58422,62924:58423,62925:58424,62926:58425,62927:58426,62928:58427,62929:58428,62930:58429,62931:58430,62932:58431,62933:58432,62934:58433,62935:58434,62936:58435,62937:58436,62938:58437,62939:58438,62940:58439,62941:58440,62942:58441,62943:58442,62944:58443,62945:58444,62946:58445,62947:58446,62948:58447,62949:58448,62950:58449,62951:58450,62952:58451,62953:58452,62954:58453,62955:58454,62956:58455,62957:58456,62958:58457,62959:58458,62960:58459,62961:58460,62962:58461,62963:58462,62964:58463,62965:58464,62966:58465,62967:58466,62968:58467,62969:58468,62970:58469,62971:58470,62972:58471,63040:58472,63041:58473,63042:58474,63043:58475,63044:58476,63045:58477,63046:58478,63047:58479,63048:58480,63049:58481,63050:58482,63051:58483,63052:58484,63053:58485,63054:58486,63055:58487,63056:58488,63057:58489,63058:58490,63059:58491,63060:58492,63061:58493,63062:58494,63063:58495,63064:58496,63065:58497,63066:58498,63067:58499,63068:58500,63069:58501,63070:58502,63071:58503,63072:58504,63073:58505,63074:58506,63075:58507,63076:58508,63077:58509,63078:58510,63079:58511,63080:58512,63081:58513,63082:58514,63083:58515,63084:58516,63085:58517,63086:58518,63087:58519,63088:58520,63089:58521,63090:58522,63091:58523,63092:58524,63093:58525,63094:58526,63095:58527,63096:58528,63097:58529,63098:58530,63099:58531,63100:58532,63101:58533,63102:58534,63104:58535,63105:58536,63106:58537,63107:58538,63108:58539,63109:58540,63110:58541,63111:58542,63112:58543,63113:58544,63114:58545,63115:58546,63116:58547,63117:58548,63118:58549,63119:58550,63120:58551,63121:58552,63122:58553,63123:58554,63124:58555,63125:58556,63126:58557,63127:58558,63128:58559,63129:58560,63130:58561,63131:58562,63132:58563,63133:58564,63134:58565,63135:58566,63136:58567,63137:58568,63138:58569,63139:58570,63140:58571,63141:58572,63142:58573,63143:58574,63144:58575,63145:58576,63146:58577,63147:58578,63148:58579,63149:58580,63150:58581,63151:58582,63152:58583,63153:58584,63154:58585,63155:58586,63156:58587,63157:58588,63158:58589,63159:58590,63160:58591,63161:58592,63162:58593,63163:58594,63164:58595,63165:58596,63166:58597,63167:58598,63168:58599,63169:58600,63170:58601,63171:58602,63172:58603,63173:58604,63174:58605,63175:58606,63176:58607,63177:58608,63178:58609,63179:58610,63180:58611,63181:58612,63182:58613,63183:58614,63184:58615,63185:58616,63186:58617,63187:58618,63188:58619,63189:58620,63190:58621,63191:58622,63192:58623,63193:58624,63194:58625,63195:58626,63196:58627,63197:58628,63198:58629,63199:58630,63200:58631,63201:58632,63202:58633,63203:58634,63204:58635,63205:58636,63206:58637,63207:58638,63208:58639,63209:58640,63210:58641,63211:58642,63212:58643,63213:58644,63214:58645,63215:58646,63216:58647,63217:58648,63218:58649,63219:58650,63220:58651,63221:58652,63222:58653,63223:58654,63224:58655,63225:58656,63226:58657,63227:58658,63228:58659,63296:58660,63297:58661,63298:58662,63299:58663,63300:58664,63301:58665,63302:58666,63303:58667,63304:58668,63305:58669,63306:58670,63307:58671,63308:58672,63309:58673,63310:58674,63311:58675,63312:58676,63313:58677,63314:58678,63315:58679,63316:58680,63317:58681,63318:58682,63319:58683,63320:58684,63321:58685,63322:58686,63323:58687,63324:58688,63325:58689,63326:58690,63327:58691,63328:58692,63329:58693,63330:58694,63331:58695,63332:58696,63333:58697,63334:58698,63335:58699,63336:58700,63337:58701,63338:58702,63339:58703,63340:58704,63341:58705,63342:58706,63343:58707,63344:58708,63345:58709,63346:58710,63347:58711,63348:58712,63349:58713,63350:58714,63351:58715,63352:58716,63353:58717,63354:58718,63355:58719,63356:58720,63357:58721,63358:58722,63360:58723,63361:58724,63362:58725,63363:58726,63364:58727,63365:58728,63366:58729,63367:58730,63368:58731,63369:58732,63370:58733,63371:58734,63372:58735,63373:58736,63374:58737,63375:58738,63376:58739,63377:58740,63378:58741,63379:58742,63380:58743,63381:58744,63382:58745,63383:58746,63384:58747,63385:58748,63386:58749,63387:58750,63388:58751,63389:58752,63390:58753,63391:58754,63392:58755,63393:58756,63394:58757,63395:58758,63396:58759,63397:58760,63398:58761,63399:58762,63400:58763,63401:58764,63402:58765,63403:58766,63404:58767,63405:58768,63406:58769,63407:58770,63408:58771,63409:58772,63410:58773,63411:58774,63412:58775,63413:58776,63414:58777,63415:58778,63416:58779,63417:58780,63418:58781,63419:58782,63420:58783,63421:58784,63422:58785,63423:58786,63424:58787,63425:58788,63426:58789,63427:58790,63428:58791,63429:58792,63430:58793,63431:58794,63432:58795,63433:58796,63434:58797,63435:58798,63436:58799,63437:58800,63438:58801,63439:58802,63440:58803,63441:58804,63442:58805,63443:58806,63444:58807,63445:58808,63446:58809,63447:58810,63448:58811,63449:58812,63450:58813,63451:58814,63452:58815,63453:58816,63454:58817,63455:58818,63456:58819,63457:58820,63458:58821,63459:58822,63460:58823,63461:58824,63462:58825,63463:58826,63464:58827,63465:58828,63466:58829,63467:58830,63468:58831,63469:58832,63470:58833,63471:58834,63472:58835,63473:58836,63474:58837,63475:58838,63476:58839,63477:58840,63478:58841,63479:58842,63480:58843,63481:58844,63482:58845,63483:58846,63484:58847,63552:58848,63553:58849,63554:58850,63555:58851,63556:58852,63557:58853,63558:58854,63559:58855,63560:58856,63561:58857,63562:58858,63563:58859,63564:58860,63565:58861,63566:58862,63567:58863,63568:58864,63569:58865,63570:58866,63571:58867,63572:58868,63573:58869,63574:58870,63575:58871,63576:58872,63577:58873,63578:58874,63579:58875,63580:58876,63581:58877,63582:58878,63583:58879,63584:58880,63585:58881,63586:58882,63587:58883,63588:58884,63589:58885,63590:58886,63591:58887,63592:58888,63593:58889,63594:58890,63595:58891,63596:58892,63597:58893,63598:58894,63599:58895,63600:58896,63601:58897,63602:58898,63603:58899,63604:58900,63605:58901,63606:58902,63607:58903,63608:58904,63609:58905,63610:58906,63611:58907,63612:58908,63613:58909,63614:58910,63616:58911,63617:58912,63618:58913,63619:58914,63620:58915,63621:58916,63622:58917,63623:58918,63624:58919,63625:58920,63626:58921,63627:58922,63628:58923,63629:58924,63630:58925,63631:58926,63632:58927,63633:58928,63634:58929,63635:58930,63636:58931,63637:58932,63638:58933,63639:58934,63640:58935,63641:58936,63642:58937,63643:58938,63644:58939,63645:58940,63646:58941,63647:58942,63648:58943,63649:58944,63650:58945,63651:58946,63652:58947,63653:58948,63654:58949,63655:58950,63656:58951,63657:58952,63658:58953,63659:58954,63660:58955,63661:58956,63662:58957,63663:58958,63664:58959,63665:58960,63666:58961,63667:58962,63668:58963,63669:58964,63670:58965,63671:58966,63672:58967,63673:58968,63674:58969,63675:58970,63676:58971,63677:58972,63678:58973,63679:58974,63680:58975,63681:58976,63682:58977,63683:58978,63684:58979,63685:58980,63686:58981,63687:58982,63688:58983,63689:58984,63690:58985,63691:58986,63692:58987,63693:58988,63694:58989,63695:58990,63696:58991,63697:58992,63698:58993,63699:58994,63700:58995,63701:58996,63702:58997,63703:58998,63704:58999,63705:59e3,63706:59001,63707:59002,63708:59003,63709:59004,63710:59005,63711:59006,63712:59007,63713:59008,63714:59009,63715:59010,63716:59011,63717:59012,63718:59013,63719:59014,63720:59015,63721:59016,63722:59017,63723:59018,63724:59019,63725:59020,63726:59021,63727:59022,63728:59023,63729:59024,63730:59025,63731:59026,63732:59027,63733:59028,63734:59029,63735:59030,63736:59031,63737:59032,63738:59033,63739:59034,63740:59035,64064:8560,64065:8561,64066:8562,64067:8563,64068:8564,64069:8565,64070:8566,64071:8567,64072:8568,64073:8569,64074:8544,64075:8545,64076:8546,64077:8547,64078:8548,64079:8549,64080:8550,64081:8551,64082:8552,64083:8553,64084:65506,64085:65508,64086:65287,64087:65282,64088:12849,64089:8470,64090:8481,64091:8757,64092:32394,64093:35100,64094:37704,64095:37512,64096:34012,64097:20425,64098:28859,64099:26161,64100:26824,64101:37625,64102:26363,64103:24389,64104:20008,64105:20193,64106:20220,64107:20224,64108:20227,64109:20281,64110:20310,64111:20370,64112:20362,64113:20378,64114:20372,64115:20429,64116:20544,64117:20514,64118:20479,64119:20510,64120:20550,64121:20592,64122:20546,64123:20628,64124:20724,64125:20696,64126:20810,64128:20836,64129:20893,64130:20926,64131:20972,64132:21013,64133:21148,64134:21158,64135:21184,64136:21211,64137:21248,64138:21255,64139:21284,64140:21362,64141:21395,64142:21426,64143:21469,64144:64014,64145:21660,64146:21642,64147:21673,64148:21759,64149:21894,64150:22361,64151:22373,64152:22444,64153:22472,64154:22471,64155:64015,64156:64016,64157:22686,64158:22706,64159:22795,64160:22867,64161:22875,64162:22877,64163:22883,64164:22948,64165:22970,64166:23382,64167:23488,64168:29999,64169:23512,64170:23532,64171:23582,64172:23718,64173:23738,64174:23797,64175:23847,64176:23891,64177:64017,64178:23874,64179:23917,64180:23992,64181:23993,64182:24016,64183:24353,64184:24372,64185:24423,64186:24503,64187:24542,64188:24669,64189:24709,64190:24714,64191:24798,64192:24789,64193:24864,64194:24818,64195:24849,64196:24887,64197:24880,64198:24984,64199:25107,64200:25254,64201:25589,64202:25696,64203:25757,64204:25806,64205:25934,64206:26112,64207:26133,64208:26171,64209:26121,64210:26158,64211:26142,64212:26148,64213:26213,64214:26199,64215:26201,64216:64018,64217:26227,64218:26265,64219:26272,64220:26290,64221:26303,64222:26362,64223:26382,64224:63785,64225:26470,64226:26555,64227:26706,64228:26560,64229:26625,64230:26692,64231:26831,64232:64019,64233:26984,64234:64020,64235:27032,64236:27106,64237:27184,64238:27243,64239:27206,64240:27251,64241:27262,64242:27362,64243:27364,64244:27606,64245:27711,64246:27740,64247:27782,64248:27759,64249:27866,64250:27908,64251:28039,64252:28015,64320:28054,64321:28076,64322:28111,64323:28152,64324:28146,64325:28156,64326:28217,64327:28252,64328:28199,64329:28220,64330:28351,64331:28552,64332:28597,64333:28661,64334:28677,64335:28679,64336:28712,64337:28805,64338:28843,64339:28943,64340:28932,64341:29020,64342:28998,64343:28999,64344:64021,64345:29121,64346:29182,64347:29361,64348:29374,64349:29476,64350:64022,64351:29559,64352:29629,64353:29641,64354:29654,64355:29667,64356:29650,64357:29703,64358:29685,64359:29734,64360:29738,64361:29737,64362:29742,64363:29794,64364:29833,64365:29855,64366:29953,64367:30063,64368:30338,64369:30364,64370:30366,64371:30363,64372:30374,64373:64023,64374:30534,64375:21167,64376:30753,64377:30798,64378:30820,64379:30842,64380:31024,64381:64024,64382:64025,64384:64026,64385:31124,64386:64027,64387:31131,64388:31441,64389:31463,64390:64028,64391:31467,64392:31646,64393:64029,64394:32072,64395:32092,64396:32183,64397:32160,64398:32214,64399:32338,64400:32583,64401:32673,64402:64030,64403:33537,64404:33634,64405:33663,64406:33735,64407:33782,64408:33864,64409:33972,64410:34131,64411:34137,64412:34155,64413:64031,64414:34224,64415:64032,64416:64033,64417:34823,64418:35061,64419:35346,64420:35383,64421:35449,64422:35495,64423:35518,64424:35551,64425:64034,64426:35574,64427:35667,64428:35711,64429:36080,64430:36084,64431:36114,64432:36214,64433:64035,64434:36559,64435:64036,64436:64037,64437:36967,64438:37086,64439:64038,64440:37141,64441:37159,64442:37338,64443:37335,64444:37342,64445:37357,64446:37358,64447:37348,64448:37349,64449:37382,64450:37392,64451:37386,64452:37434,64453:37440,64454:37436,64455:37454,64456:37465,64457:37457,64458:37433,64459:37479,64460:37543,64461:37495,64462:37496,64463:37607,64464:37591,64465:37593,64466:37584,64467:64039,64468:37589,64469:37600,64470:37587,64471:37669,64472:37665,64473:37627,64474:64040,64475:37662,64476:37631,64477:37661,64478:37634,64479:37744,64480:37719,64481:37796,64482:37830,64483:37854,64484:37880,64485:37937,64486:37957,64487:37960,64488:38290,64489:63964,64490:64041,64491:38557,64492:38575,64493:38707,64494:38715,64495:38723,64496:38733,64497:38735,64498:38737,64499:38741,64500:38999,64501:39013,64502:64042,64503:64043,64504:39207,64505:64044,64506:39326,64507:39502,64508:39641,64576:39644,64577:39797,64578:39794,64579:39823,64580:39857,64581:39867,64582:39936,64583:40304,64584:40299,64585:64045,64586:40473,64587:40657};function Jl(t,e){this.dv=new DataView(t),this.offset=0,this.littleEndian=e!==void 0?e:!0,this.encoder=new Pa}Jl.prototype={constructor:Jl,getInt8:function(){var t=this.dv.getInt8(this.offset);return this.offset+=1,t},getInt8Array:function(t){for(var e=[],n=0;n<t;n++)e.push(this.getInt8());return e},getUint8:function(){var t=this.dv.getUint8(this.offset);return this.offset+=1,t},getUint8Array:function(t){for(var e=[],n=0;n<t;n++)e.push(this.getUint8());return e},getInt16:function(){var t=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,t},getInt16Array:function(t){for(var e=[],n=0;n<t;n++)e.push(this.getInt16());return e},getUint16:function(){var t=this.dv.getUint16(this.offset,this.littleEndian);return this.offset+=2,t},getUint16Array:function(t){for(var e=[],n=0;n<t;n++)e.push(this.getUint16());return e},getInt32:function(){var t=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,t},getInt32Array:function(t){for(var e=[],n=0;n<t;n++)e.push(this.getInt32());return e},getUint32:function(){var t=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,t},getUint32Array:function(t){for(var e=[],n=0;n<t;n++)e.push(this.getUint32());return e},getFloat32:function(){var t=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,t},getFloat32Array:function(t){for(var e=[],n=0;n<t;n++)e.push(this.getFloat32());return e},getFloat64:function(){var t=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,t},getFloat64Array:function(t){for(var e=[],n=0;n<t;n++)e.push(this.getFloat64());return e},getIndex:function(t,e){switch(t){case 1:return e===!0?this.getUint8():this.getInt8();case 2:return e===!0?this.getUint16():this.getInt16();case 4:return this.getInt32();default:throw"unknown number type "+t+" exception."}},getIndexArray:function(t,e,n){for(var r=[],i=0;i<e;i++)r.push(this.getIndex(t,n));return r},getChars:function(t){for(var e="";t>0;){var n=this.getUint8();if(t--,n===0)break;e+=String.fromCharCode(n)}for(;t>0;)this.getUint8(),t--;return e},getSjisStringsAsUnicode:function(t){for(var e=[];t>0;){var n=this.getUint8();if(t--,n===0)break;e.push(n)}for(;t>0;)this.getUint8(),t--;return this.encoder.s2u(new Uint8Array(e))},getUnicodeStrings:function(t){for(var e="";t>0;){var n=this.getUint16();if(t-=2,n===0)break;e+=String.fromCharCode(n)}for(;t>0;)this.getUint8(),t--;return e},getTextBuffer:function(){var t=this.getUint32();return this.getUnicodeStrings(t)}};function Hl(){}Hl.prototype={constructor:Hl,leftToRightVector3:function(t){t[2]=-t[2]},leftToRightQuaternion:function(t){t[0]=-t[0],t[1]=-t[1]},leftToRightEuler:function(t){t[0]=-t[0],t[1]=-t[1]},leftToRightIndexOrder:function(t){var e=t[2];t[2]=t[0],t[0]=e},leftToRightVector3Range:function(t,e){var n=-e[2];e[2]=-t[2],t[2]=n},leftToRightEulerRange:function(t,e){var n=-e[0],r=-e[1];e[0]=-t[0],e[1]=-t[1],t[0]=n,t[1]=r}};const $l=0,_2=2,E2=0,T2=0,M2=2,D2=0,L2=0,P2=1,Fa=2,F2=1,k2=64,ec=0,tc=9,ka=15,nc=16,Oa=22,rc=37,Ra=43,ic=76,sc=83,ac=97,oc=100,lc=103,cc=109;class O2{constructor(){this.vkFormat=ec,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=$l,this.levels=[],this.dataFormatDescriptor=[{vendorId:T2,descriptorType:E2,descriptorBlockSize:0,versionNumber:M2,colorModel:D2,colorPrimaries:F2,transferFunction:Fa,flags:L2,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null}}class Xr{constructor(e,n,r,i){this._dataView=void 0,this._littleEndian=void 0,this._offset=void 0,this._dataView=new DataView(e.buffer,e.byteOffset+n,r),this._littleEndian=i,this._offset=0}_nextUint8(){const e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){const e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){const e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){const e=this._dataView.getUint32(this._offset,this._littleEndian),n=this._dataView.getUint32(this._offset+4,this._littleEndian),r=e+2**32*n;return this._offset+=8,r}_nextInt32(){const e=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,e}_skip(e){return this._offset+=e,this}_scan(e,n=0){const r=this._offset;let i=0;for(;this._dataView.getUint8(this._offset)!==n&&i<e;)i++,this._offset++;return i<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+r,i)}}const at=[171,75,84,88,32,50,48,187,13,10,26,10];function hc(t){return typeof TextDecoder<"u"?new TextDecoder().decode(t):Buffer.from(t).toString("utf8")}function R2(t){const e=new Uint8Array(t.buffer,t.byteOffset,at.length);if(e[0]!==at[0]||e[1]!==at[1]||e[2]!==at[2]||e[3]!==at[3]||e[4]!==at[4]||e[5]!==at[5]||e[6]!==at[6]||e[7]!==at[7]||e[8]!==at[8]||e[9]!==at[9]||e[10]!==at[10]||e[11]!==at[11])throw new Error("Missing KTX 2.0 identifier.");const n=new O2,r=17*Uint32Array.BYTES_PER_ELEMENT,i=new Xr(t,at.length,r,!0);n.vkFormat=i._nextUint32(),n.typeSize=i._nextUint32(),n.pixelWidth=i._nextUint32(),n.pixelHeight=i._nextUint32(),n.pixelDepth=i._nextUint32(),n.layerCount=i._nextUint32(),n.faceCount=i._nextUint32();const s=i._nextUint32();n.supercompressionScheme=i._nextUint32();const a=i._nextUint32(),o=i._nextUint32(),l=i._nextUint32(),h=i._nextUint32(),u=i._nextUint64(),A=i._nextUint64(),f=s*3*8,d=new Xr(t,at.length+r,f,!0);for(let Z=0;Z<s;Z++)n.levels.push({levelData:new Uint8Array(t.buffer,t.byteOffset+d._nextUint64(),d._nextUint64()),uncompressedByteLength:d._nextUint64()});const m=new Xr(t,a,o,!0),y={vendorId:m._skip(4)._nextUint16(),descriptorType:m._nextUint16(),versionNumber:m._nextUint16(),descriptorBlockSize:m._nextUint16(),colorModel:m._nextUint8(),colorPrimaries:m._nextUint8(),transferFunction:m._nextUint8(),flags:m._nextUint8(),texelBlockDimension:[m._nextUint8(),m._nextUint8(),m._nextUint8(),m._nextUint8()],bytesPlane:[m._nextUint8(),m._nextUint8(),m._nextUint8(),m._nextUint8(),m._nextUint8(),m._nextUint8(),m._nextUint8(),m._nextUint8()],samples:[]},C=6,x=4,I=(y.descriptorBlockSize/4-C)/x;for(let Z=0;Z<I;Z++){const $={bitOffset:m._nextUint16(),bitLength:m._nextUint8(),channelType:m._nextUint8(),samplePosition:[m._nextUint8(),m._nextUint8(),m._nextUint8(),m._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};$.channelType&k2?($.sampleLower=m._nextInt32(),$.sampleUpper=m._nextInt32()):($.sampleLower=m._nextUint32(),$.sampleUpper=m._nextUint32()),y.samples[Z]=$}n.dataFormatDescriptor.length=0,n.dataFormatDescriptor.push(y);const g=new Xr(t,l,h,!0);for(;g._offset<h;){const Z=g._nextUint32(),$=g._scan(Z),O=hc($),F=g._scan(Z-$.byteLength);n.keyValue[O]=O.match(/^ktx/i)?hc(F):F,g._offset%4&&g._skip(4-g._offset%4)}if(A<=0)return n;const v=new Xr(t,u,A,!0),w=v._nextUint16(),b=v._nextUint16(),B=v._nextUint32(),_=v._nextUint32(),E=v._nextUint32(),T=v._nextUint32(),L=[];for(let Z=0;Z<s;Z++)L.push({imageFlags:v._nextUint32(),rgbSliceByteOffset:v._nextUint32(),rgbSliceByteLength:v._nextUint32(),alphaSliceByteOffset:v._nextUint32(),alphaSliceByteLength:v._nextUint32()});const R=u+v._offset,V=R+B,Y=V+_,q=Y+E,ne=new Uint8Array(t.buffer,t.byteOffset+R,B),X=new Uint8Array(t.buffer,t.byteOffset+V,_),G=new Uint8Array(t.buffer,t.byteOffset+Y,E),H=new Uint8Array(t.buffer,t.byteOffset+q,T);return n.globalData={endpointCount:w,selectorCount:b,imageDescs:L,endpointsData:ne,selectorsData:X,tablesData:G,extendedData:H},n}let Ua,pn,Qa;const Na={env:{emscripten_notify_memory_growth:function(t){Qa=new Uint8Array(pn.exports.memory.buffer)}}};class U2{init(){return Ua||(Ua=typeof fetch<"u"?fetch("data:application/wasm;base64,"+uc).then(e=>e.arrayBuffer()).then(e=>WebAssembly.instantiate(e,Na)).then(this._init):WebAssembly.instantiate(Buffer.from(uc,"base64"),Na).then(this._init),Ua)}_init(e){pn=e.instance,Na.env.emscripten_notify_memory_growth(0)}decode(e,n=0){if(!pn)throw new Error("ZSTDDecoder: Await .init() before decoding.");const r=e.byteLength,i=pn.exports.malloc(r);Qa.set(e,i),n=n||Number(pn.exports.ZSTD_findDecompressedSize(i,r));const s=pn.exports.malloc(n),a=pn.exports.ZSTD_decompress(s,n,i,r),o=Qa.slice(s,s+a);return pn.exports.free(i),pn.exports.free(s),o}}const uc="AGFzbQEAAAABpQEVYAF/AX9gAn9/AGADf39/AX9gBX9/f39/AX9gAX8AYAJ/fwF/YAR/f39/AX9gA39/fwBgBn9/f39/fwF/YAd/f39/f39/AX9gAn9/AX5gAn5+AX5gAABgBX9/f39/AGAGf39/f39/AGAIf39/f39/f38AYAl/f39/f39/f38AYAABf2AIf39/f39/f38Bf2ANf39/f39/f39/f39/fwF/YAF/AX4CJwEDZW52H2Vtc2NyaXB0ZW5fbm90aWZ5X21lbW9yeV9ncm93dGgABANpaAEFAAAFAgEFCwACAQABAgIFBQcAAwABDgsBAQcAEhMHAAUBDAQEAAANBwQCAgYCBAgDAwMDBgEACQkHBgICAAYGAgQUBwYGAwIGAAMCAQgBBwUGCgoEEQAEBAEIAwgDBQgDEA8IAAcABAUBcAECAgUEAQCAAgYJAX8BQaCgwAILB2AHBm1lbW9yeQIABm1hbGxvYwAoBGZyZWUAJgxaU1REX2lzRXJyb3IAaBlaU1REX2ZpbmREZWNvbXByZXNzZWRTaXplAFQPWlNURF9kZWNvbXByZXNzAEoGX3N0YXJ0ACQJBwEAQQELASQKussBaA8AIAAgACgCBCABajYCBAsZACAAKAIAIAAoAgRBH3F0QQAgAWtBH3F2CwgAIABBiH9LC34BBH9BAyEBIAAoAgQiA0EgTQRAIAAoAggiASAAKAIQTwRAIAAQDQ8LIAAoAgwiAiABRgRAQQFBAiADQSBJGw8LIAAgASABIAJrIANBA3YiBCABIARrIAJJIgEbIgJrIgQ2AgggACADIAJBA3RrNgIEIAAgBCgAADYCAAsgAQsUAQF/IAAgARACIQIgACABEAEgAgv3AQECfyACRQRAIABCADcCACAAQQA2AhAgAEIANwIIQbh/DwsgACABNgIMIAAgAUEEajYCECACQQRPBEAgACABIAJqIgFBfGoiAzYCCCAAIAMoAAA2AgAgAUF/ai0AACIBBEAgAEEIIAEQFGs2AgQgAg8LIABBADYCBEF/DwsgACABNgIIIAAgAS0AACIDNgIAIAJBfmoiBEEBTQRAIARBAWtFBEAgACABLQACQRB0IANyIgM2AgALIAAgAS0AAUEIdCADajYCAAsgASACakF/ai0AACIBRQRAIABBADYCBEFsDwsgAEEoIAEQFCACQQN0ams2AgQgAgsWACAAIAEpAAA3AAAgACABKQAINwAICy8BAX8gAUECdEGgHWooAgAgACgCAEEgIAEgACgCBGprQR9xdnEhAiAAIAEQASACCyEAIAFCz9bTvtLHq9lCfiAAfEIfiUKHla+vmLbem55/fgsdAQF/IAAoAgggACgCDEYEfyAAKAIEQSBGBUEACwuCBAEDfyACQYDAAE8EQCAAIAEgAhBnIAAPCyAAIAJqIQMCQCAAIAFzQQNxRQRAAkAgAkEBSARAIAAhAgwBCyAAQQNxRQRAIAAhAgwBCyAAIQIDQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADTw0BIAJBA3ENAAsLAkAgA0F8cSIEQcAASQ0AIAIgBEFAaiIFSw0AA0AgAiABKAIANgIAIAIgASgCBDYCBCACIAEoAgg2AgggAiABKAIMNgIMIAIgASgCEDYCECACIAEoAhQ2AhQgAiABKAIYNgIYIAIgASgCHDYCHCACIAEoAiA2AiAgAiABKAIkNgIkIAIgASgCKDYCKCACIAEoAiw2AiwgAiABKAIwNgIwIAIgASgCNDYCNCACIAEoAjg2AjggAiABKAI8NgI8IAFBQGshASACQUBrIgIgBU0NAAsLIAIgBE8NAQNAIAIgASgCADYCACABQQRqIQEgAkEEaiICIARJDQALDAELIANBBEkEQCAAIQIMAQsgA0F8aiIEIABJBEAgACECDAELIAAhAgNAIAIgAS0AADoAACACIAEtAAE6AAEgAiABLQACOgACIAIgAS0AAzoAAyABQQRqIQEgAkEEaiICIARNDQALCyACIANJBEADQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADRw0ACwsgAAsMACAAIAEpAAA3AAALQQECfyAAKAIIIgEgACgCEEkEQEEDDwsgACAAKAIEIgJBB3E2AgQgACABIAJBA3ZrIgE2AgggACABKAAANgIAQQALDAAgACABKAIANgAAC/cCAQJ/AkAgACABRg0AAkAgASACaiAASwRAIAAgAmoiBCABSw0BCyAAIAEgAhALDwsgACABc0EDcSEDAkACQCAAIAFJBEAgAwRAIAAhAwwDCyAAQQNxRQRAIAAhAwwCCyAAIQMDQCACRQ0EIAMgAS0AADoAACABQQFqIQEgAkF/aiECIANBAWoiA0EDcQ0ACwwBCwJAIAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQhBSAGQQR2IQRBICAAdCIAQQFyIQkgASgCACEPQQAhAiADIQYCQANAIAlBAkggAiAPS3JFBEAgAiEHAkAgCARAA0AgBEH//wNxQf//A0YEQCAHQRhqIQcgBiAQSQR/IAZBAmoiBigAACAFdgUgBUEQaiEFIARBEHYLIQQMAQsLA0AgBEEDcSIIQQNGBEAgBUECaiEFIARBAnYhBCAHQQNqIQcMAQsLIAcgCGoiByAPSw0EIAVBAmohBQNAIAIgB0kEQCANIAJBAXRqQQA7AQAgAkEBaiECDAELCyAGIA5LQQAgBiAFQQN1aiIHIAxLG0UEQCAHKAAAIAVBB3EiBXYhBAwCCyAEQQJ2IQQLIAYhBwsCfyALQX9qIAQgAEF/anEiBiAAQQF0QX9qIgggCWsiEUkNABogBCAIcSIEQQAgESAEIABIG2shBiALCyEIIA0gAkEBdGogBkF/aiIEOwEAIAlBASAGayAEIAZBAUgbayEJA0AgCSAASARAIABBAXUhACALQX9qIQsMAQsLAn8gByAOS0EAIAcgBSAIaiIFQQN1aiIGIAxLG0UEQCAFQQdxDAELIAUgDCIGIAdrQQN0awshBSACQQFqIQIgBEUhCCAGKAAAIAVBH3F2IQQMAQsLQWwgCUEBRyAFQSBKcg0BGiABIAJBf2o2AgAgBiAFQQdqQQN1aiADawwBC0FQCyEAIApBEGokACAACwkAQQFBBSAAGwsMACAAIAEoAAA2AAALqgMBCn8jAEHwAGsiCiQAIAJBAWohDiAAQQhqIQtBgIAEIAVBf2p0QRB1IQxBACECQQEhBkEBIAV0IglBf2oiDyEIA0AgAiAORkUEQAJAIAEgAkEBdCINai8BACIHQf//A0YEQCALIAhBA3RqIAI2AgQgCEF/aiEIQQEhBwwBCyAGQQAgDCAHQRB0QRB1ShshBgsgCiANaiAHOwEAIAJBAWohAgwBCwsgACAFNgIEIAAgBjYCACAJQQN2IAlBAXZqQQNqIQxBACEAQQAhBkEAIQIDQCAGIA5GBEADQAJAIAAgCUYNACAKIAsgAEEDdGoiASgCBCIGQQF0aiICIAIvAQAiAkEBajsBACABIAUgAhAUayIIOgADIAEgAiAIQf8BcXQgCWs7AQAgASAEIAZBAnQiAmooAgA6AAIgASACIANqKAIANgIEIABBAWohAAwBCwsFIAEgBkEBdGouAQAhDUEAIQcDQCAHIA1ORQRAIAsgAkEDdGogBjYCBANAIAIgDGogD3EiAiAISw0ACyAHQQFqIQcMAQsLIAZBAWohBgwBCwsgCkHwAGokAAsjAEIAIAEQCSAAhUKHla+vmLbem55/fkLj3MqV/M7y9YV/fAsQACAAQn43AwggACABNgIACyQBAX8gAARAIAEoAgQiAgRAIAEoAgggACACEQEADwsgABAmCwsfACAAIAEgAi8BABAINgIAIAEQBBogACACQQRqNgIEC0oBAX9BoCAoAgAiASAAaiIAQX9MBEBBiCBBMDYCAEF/DwsCQCAAPwBBEHRNDQAgABBmDQBBiCBBMDYCAEF/DwtBoCAgADYCACABC9cBAQh/Qbp/IQoCQCACKAIEIgggAigCACIJaiIOIAEgAGtLDQBBbCEKIAkgBCADKAIAIgtrSw0AIAAgCWoiBCACKAIIIgxrIQ0gACABQWBqIg8gCyAJQQAQKSADIAkgC2o2AgACQAJAIAwgBCAFa00EQCANIQUMAQsgDCAEIAZrSw0CIAcgDSAFayIAaiIBIAhqIAdNBEAgBCABIAgQDxoMAgsgBCABQQAgAGsQDyEBIAIgACAIaiIINgIEIAEgAGshBAsgBCAPIAUgCEEBECkLIA4hCgsgCgubAgEBfyMAQYABayINJAAgDSADNgJ8AkAgAkEDSwRAQX8hCQwBCwJAAkACQAJAIAJBAWsOAwADAgELIAZFBEBBuH8hCQwEC0FsIQkgBS0AACICIANLDQMgACAHIAJBAnQiAmooAgAgAiAIaigCABA7IAEgADYCAEEBIQkMAwsgASAJNgIAQQAhCQwCCyAKRQRAQWwhCQwCC0EAIQkgC0UgDEEZSHINAUEIIAR0QQhqIQBBACECA0AgAiAATw0CIAJBQGshAgwAAAsAC0FsIQkgDSANQfwAaiANQfgAaiAFIAYQFSICEAMNACANKAJ4IgMgBEsNACAAIA0gDSgCfCAHIAggAxAYIAEgADYCACACIQkLIA1BgAFqJAAgCQsLACAAIAEgAhALGgsQACAALwAAIAAtAAJBEHRyCy8AAn9BuH8gAUEISQ0AGkFyIAAoAAQiAEF3Sw0AGkG4fyAAQQhqIgAgACABSxsLCwkAIAAgATsAAAsDAAELigYBBX8gACAAKAIAIgVBfnE2AgBBACAAIAVBAXZqQYQgKAIAIgQgAEYbIQECQAJAIAAoAgQiAkUNACACKAIAIgNBAXENACACQQhqIgUgA0EBdkF4aiIDQQggA0EISxtnQR9zQQJ0QYAfaiIDKAIARgRAIAMgAigCDDYCAAsgAigCCCIDBEAgAyACKAIMNgIECyACKAIMIgMEQCADIAIoAgg2AgALIAIgAigCACAAKAIAQX5xajYCAEGEICEAAkACQCABRQ0AIAEgAjYCBCABKAIAIgNBAXENASADQQF2QXhqIgNBCCADQQhLG2dBH3NBAnRBgB9qIgMoAgAgAUEIakYEQCADIAEoAgw2AgALIAEoAggiAwRAIAMgASgCDDYCBAsgASgCDCIDBEAgAyABKAIINgIAQYQgKAIAIQQLIAIgAigCACABKAIAQX5xajYCACABIARGDQAgASABKAIAQQF2akEEaiEACyAAIAI2AgALIAIoAgBBAXZBeGoiAEEIIABBCEsbZ0Efc0ECdEGAH2oiASgCACEAIAEgBTYCACACIAA2AgwgAkEANgIIIABFDQEgACAFNgIADwsCQCABRQ0AIAEoAgAiAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAigCACABQQhqRgRAIAIgASgCDDYCAAsgASgCCCICBEAgAiABKAIMNgIECyABKAIMIgIEQCACIAEoAgg2AgBBhCAoAgAhBAsgACAAKAIAIAEoAgBBfnFqIgI2AgACQCABIARHBEAgASABKAIAQQF2aiAANgIEIAAoAgAhAgwBC0GEICAANgIACyACQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgIoAgAhASACIABBCGoiAjYCACAAIAE2AgwgAEEANgIIIAFFDQEgASACNgIADwsgBUEBdkF4aiIBQQggAUEISxtnQR9zQQJ0QYAfaiICKAIAIQEgAiAAQQhqIgI2AgAgACABNgIMIABBADYCCCABRQ0AIAEgAjYCAAsLDgAgAARAIABBeGoQJQsLgAIBA38CQCAAQQ9qQXhxQYQgKAIAKAIAQQF2ayICEB1Bf0YNAAJAQYQgKAIAIgAoAgAiAUEBcQ0AIAFBAXZBeGoiAUEIIAFBCEsbZ0Efc0ECdEGAH2oiASgCACAAQQhqRgRAIAEgACgCDDYCAAsgACgCCCIBBEAgASAAKAIMNgIECyAAKAIMIgFFDQAgASAAKAIINgIAC0EBIQEgACAAKAIAIAJBAXRqIgI2AgAgAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAygCACECIAMgAEEIaiIDNgIAIAAgAjYCDCAAQQA2AgggAkUNACACIAM2AgALIAELtwIBA38CQAJAIABBASAAGyICEDgiAA0AAkACQEGEICgCACIARQ0AIAAoAgAiA0EBcQ0AIAAgA0EBcjYCACADQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgAgAEEIakYEQCABIAAoAgw2AgALIAAoAggiAQRAIAEgACgCDDYCBAsgACgCDCIBBEAgASAAKAIINgIACyACECchAkEAIQFBhCAoAgAhACACDQEgACAAKAIAQX5xNgIAQQAPCyACQQ9qQXhxIgMQHSICQX9GDQIgAkEHakF4cSIAIAJHBEAgACACaxAdQX9GDQMLAkBBhCAoAgAiAUUEQEGAICAANgIADAELIAAgATYCBAtBhCAgADYCACAAIANBAXRBAXI2AgAMAQsgAEUNAQsgAEEIaiEBCyABC7kDAQJ/IAAgA2ohBQJAIANBB0wEQANAIAAgBU8NAiAAIAItAAA6AAAgAEEBaiEAIAJBAWohAgwAAAsACyAEQQFGBEACQCAAIAJrIgZBB00EQCAAIAItAAA6AAAgACACLQABOgABIAAgAi0AAjoAAiAAIAItAAM6AAMgAEEEaiACIAZBAnQiBkHAHmooAgBqIgIQFyACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohBAwCCyABIARqLwAAIQIgBEECaiEEDAELIAEgBGooAAAhAiAEQQRqIQQLIAVBAXEhBQJ+AkACQAJAIANBf2oiA0ECTQRAIANBAWsOAgIDAQtCfyAGRQ0DGiABIARqMQAADAMLIAEgBGovAACtQoACfAwCCyABIARqKAAArQwBCyABIARqKQAACyEHIAAgBTYCICAAIAI2AhwgACAHNwMAQQAhAyAAQQA2AhQgACAHIAggBhsiBzcDCCAAIAdCgIAIIAdCgIAIVBs+AhALIAMLWwEBf0G4fyEDIAIQFiICIAFNBH8gACACakF/ai0AACIAQQNxQQJ0QaAeaigCACACaiAAQQZ2IgFBAnRBsB5qKAIAaiAAQSBxIgBFaiABRSAAQQV2cWoFQbh/CwsdACAAKAKQ4gEQWiAAQQA2AqDiASAAQgA3A5DiAQu1AwEFfyMAQZACayIKJABBuH8hBgJAIAVFDQAgBCwAACIIQf8BcSEHAkAgCEF/TARAIAdBgn9qQQF2IgggBU8NAkFsIQYgB0GBf2oiBUGAAk8NAiAEQQFqIQdBACEGA0AgBiAFTwRAIAUhBiAIIQcMAwUgACAGaiAHIAZBAXZqIgQtAABBBHY6AAAgACAGQQFyaiAELQAAQQ9xOgAAIAZBAmohBgwBCwAACwALIAcgBU8NASAAIARBAWogByAKEFMiBhADDQELIAYhBEEAIQYgAUEAQTQQECEJQQAhBQNAIAQgBkcEQCAAIAZqIggtAAAiAUELSwRAQWwhBgwDBSAJIAFBAnRqIgEgASgCAEEBajYCACAGQQFqIQZBASAILQAAdEEBdSAFaiEFDAILAAsLQWwhBiAFRQ0AIAUQFEEBaiIBQQxLDQAgAyABNgIAQQFBASABdCAFayIDEBQiAXQgA0cNACAAIARqIAFBAWoiADoAACAJIABBAnRqIgAgACgCAEEBajYCACAJKAIEIgBBAkkgAEEBcXINACACIARBAWo2AgAgB0EBaiEGCyAKQZACaiQAIAYLxhEBDH8jAEHwAGsiBSQAQWwhCwJAIANBCkkNACACLwAAIQogAi8AAiEJIAIvAAQhByAFQQhqIAQQDgJAIAMgByAJIApqakEGaiIMSQ0AIAUtAAohCCAFQdgAaiACQQZqIgIgChAGIgsQAw0BIAVBQGsgAiAKaiICIAkQBiILEAMNASAFQShqIAIgCWoiAiAHEAYiCxADDQEgBUEQaiACIAdqIAMgDGsQBiILEAMNASAAIAFqIg9BfWohECAEQQRqIQZBASELIAAgAUEDakECdiIDaiIMIANqIgIgA2oiDiEDIAIhBCAMIQcDQCALIAMgEElxBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgCS0AAyELIAcgBiAFQUBrIAgQAkECdGoiCS8BADsAACAFQUBrIAktAAIQASAJLQADIQogBCAGIAVBKGogCBACQQJ0aiIJLwEAOwAAIAVBKGogCS0AAhABIAktAAMhCSADIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgDS0AAyENIAAgC2oiCyAGIAVB2ABqIAgQAkECdGoiAC8BADsAACAFQdgAaiAALQACEAEgAC0AAyEAIAcgCmoiCiAGIAVBQGsgCBACQQJ0aiIHLwEAOwAAIAVBQGsgBy0AAhABIActAAMhByAEIAlqIgkgBiAFQShqIAgQAkECdGoiBC8BADsAACAFQShqIAQtAAIQASAELQADIQQgAyANaiIDIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgACALaiEAIAcgCmohByAEIAlqIQQgAyANLQADaiEDIAVB2ABqEA0gBUFAaxANciAFQShqEA1yIAVBEGoQDXJFIQsMAQsLIAQgDksgByACS3INAEFsIQsgACAMSw0BIAxBfWohCQNAQQAgACAJSSAFQdgAahAEGwRAIAAgBiAFQdgAaiAIEAJBAnRqIgovAQA7AAAgBUHYAGogCi0AAhABIAAgCi0AA2oiACAGIAVB2ABqIAgQAkECdGoiCi8BADsAACAFQdgAaiAKLQACEAEgACAKLQADaiEADAEFIAxBfmohCgNAIAVB2ABqEAQgACAKS3JFBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgACAJLQADaiEADAELCwNAIAAgCk0EQCAAIAYgBUHYAGogCBACQQJ0aiIJLwEAOwAAIAVB2ABqIAktAAIQASAAIAktAANqIQAMAQsLAkAgACAMTw0AIAAgBiAFQdgAaiAIEAIiAEECdGoiDC0AADoAACAMLQADQQFGBEAgBUHYAGogDC0AAhABDAELIAUoAlxBH0sNACAFQdgAaiAGIABBAnRqLQACEAEgBSgCXEEhSQ0AIAVBIDYCXAsgAkF9aiEMA0BBACAHIAxJIAVBQGsQBBsEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiIAIAYgBUFAayAIEAJBAnRqIgcvAQA7AAAgBUFAayAHLQACEAEgACAHLQADaiEHDAEFIAJBfmohDANAIAVBQGsQBCAHIAxLckUEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwNAIAcgDE0EQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwJAIAcgAk8NACAHIAYgBUFAayAIEAIiAEECdGoiAi0AADoAACACLQADQQFGBEAgBUFAayACLQACEAEMAQsgBSgCREEfSw0AIAVBQGsgBiAAQQJ0ai0AAhABIAUoAkRBIUkNACAFQSA2AkQLIA5BfWohAgNAQQAgBCACSSAFQShqEAQbBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2oiACAGIAVBKGogCBACQQJ0aiIELwEAOwAAIAVBKGogBC0AAhABIAAgBC0AA2ohBAwBBSAOQX5qIQIDQCAFQShqEAQgBCACS3JFBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsDQCAEIAJNBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsCQCAEIA5PDQAgBCAGIAVBKGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBKGogAi0AAhABDAELIAUoAixBH0sNACAFQShqIAYgAEECdGotAAIQASAFKAIsQSFJDQAgBUEgNgIsCwNAQQAgAyAQSSAFQRBqEAQbBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2oiACAGIAVBEGogCBACQQJ0aiICLwEAOwAAIAVBEGogAi0AAhABIAAgAi0AA2ohAwwBBSAPQX5qIQIDQCAFQRBqEAQgAyACS3JFBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsDQCADIAJNBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsCQCADIA9PDQAgAyAGIAVBEGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBEGogAi0AAhABDAELIAUoAhRBH0sNACAFQRBqIAYgAEECdGotAAIQASAFKAIUQSFJDQAgBUEgNgIUCyABQWwgBUHYAGoQCiAFQUBrEApxIAVBKGoQCnEgBUEQahAKcRshCwwJCwAACwALAAALAAsAAAsACwAACwALQWwhCwsgBUHwAGokACALC7UEAQ5/IwBBEGsiBiQAIAZBBGogABAOQVQhBQJAIARB3AtJDQAgBi0ABCEHIANB8ARqQQBB7AAQECEIIAdBDEsNACADQdwJaiIJIAggBkEIaiAGQQxqIAEgAhAxIhAQA0UEQCAGKAIMIgQgB0sNASADQdwFaiEPIANBpAVqIREgAEEEaiESIANBqAVqIQEgBCEFA0AgBSICQX9qIQUgCCACQQJ0aigCAEUNAAsgAkEBaiEOQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgASALaiAKNgIAIAVBAWohBSAKIAxqIQoMAQsLIAEgCjYCAEEAIQUgBigCCCELA0AgBSALRkUEQCABIAUgCWotAAAiDEECdGoiDSANKAIAIg1BAWo2AgAgDyANQQF0aiINIAw6AAEgDSAFOgAAIAVBAWohBQwBCwtBACEBIANBADYCqAUgBEF/cyAHaiEJQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgAyALaiABNgIAIAwgBSAJanQgAWohASAFQQFqIQUMAQsLIAcgBEEBaiIBIAJrIgRrQQFqIQgDQEEBIQUgBCAIT0UEQANAIAUgDk9FBEAgBUECdCIJIAMgBEE0bGpqIAMgCWooAgAgBHY2AgAgBUEBaiEFDAELCyAEQQFqIQQMAQsLIBIgByAPIAogESADIAIgARBkIAZBAToABSAGIAc6AAYgACAGKAIENgIACyAQIQULIAZBEGokACAFC8ENAQt/IwBB8ABrIgUkAEFsIQkCQCADQQpJDQAgAi8AACEKIAIvAAIhDCACLwAEIQYgBUEIaiAEEA4CQCADIAYgCiAMampBBmoiDUkNACAFLQAKIQcgBUHYAGogAkEGaiICIAoQBiIJEAMNASAFQUBrIAIgCmoiAiAMEAYiCRADDQEgBUEoaiACIAxqIgIgBhAGIgkQAw0BIAVBEGogAiAGaiADIA1rEAYiCRADDQEgACABaiIOQX1qIQ8gBEEEaiEGQQEhCSAAIAFBA2pBAnYiAmoiCiACaiIMIAJqIg0hAyAMIQQgCiECA0AgCSADIA9JcQRAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAACAGIAVBQGsgBxACQQF0aiIILQAAIQsgBUFAayAILQABEAEgAiALOgAAIAYgBUEoaiAHEAJBAXRqIggtAAAhCyAFQShqIAgtAAEQASAEIAs6AAAgBiAFQRBqIAcQAkEBdGoiCC0AACELIAVBEGogCC0AARABIAMgCzoAACAGIAVB2ABqIAcQAkEBdGoiCC0AACELIAVB2ABqIAgtAAEQASAAIAs6AAEgBiAFQUBrIAcQAkEBdGoiCC0AACELIAVBQGsgCC0AARABIAIgCzoAASAGIAVBKGogBxACQQF0aiIILQAAIQsgBUEoaiAILQABEAEgBCALOgABIAYgBUEQaiAHEAJBAXRqIggtAAAhCyAFQRBqIAgtAAEQASADIAs6AAEgA0ECaiEDIARBAmohBCACQQJqIQIgAEECaiEAIAkgBUHYAGoQDUVxIAVBQGsQDUVxIAVBKGoQDUVxIAVBEGoQDUVxIQkMAQsLIAQgDUsgAiAMS3INAEFsIQkgACAKSw0BIApBfWohCQNAIAVB2ABqEAQgACAJT3JFBEAgBiAFQdgAaiAHEAJBAXRqIggtAAAhCyAFQdgAaiAILQABEAEgACALOgAAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAASAAQQJqIQAMAQsLA0AgBUHYAGoQBCAAIApPckUEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCwNAIAAgCkkEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCyAMQX1qIQADQCAFQUBrEAQgAiAAT3JFBEAgBiAFQUBrIAcQAkEBdGoiCi0AACEJIAVBQGsgCi0AARABIAIgCToAACAGIAVBQGsgBxACQQF0aiIKLQAAIQkgBUFAayAKLQABEAEgAiAJOgABIAJBAmohAgwBCwsDQCAFQUBrEAQgAiAMT3JFBEAgBiAFQUBrIAcQAkEBdGoiAC0AACEKIAVBQGsgAC0AARABIAIgCjoAACACQQFqIQIMAQsLA0AgAiAMSQRAIAYgBUFAayAHEAJBAXRqIgAtAAAhCiAFQUBrIAAtAAEQASACIAo6AAAgAkEBaiECDAELCyANQX1qIQADQCAFQShqEAQgBCAAT3JFBEAgBiAFQShqIAcQAkEBdGoiAi0AACEKIAVBKGogAi0AARABIAQgCjoAACAGIAVBKGogBxACQQF0aiICLQAAIQogBUEoaiACLQABEAEgBCAKOgABIARBAmohBAwBCwsDQCAFQShqEAQgBCANT3JFBEAgBiAFQShqIAcQAkEBdGoiAC0AACECIAVBKGogAC0AARABIAQgAjoAACAEQQFqIQQMAQsLA0AgBCANSQRAIAYgBUEoaiAHEAJBAXRqIgAtAAAhAiAFQShqIAAtAAEQASAEIAI6AAAgBEEBaiEEDAELCwNAIAVBEGoQBCADIA9PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIAYgBUEQaiAHEAJBAXRqIgAtAAAhAiAFQRBqIAAtAAEQASADIAI6AAEgA0ECaiEDDAELCwNAIAVBEGoQBCADIA5PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIANBAWohAwwBCwsDQCADIA5JBEAgBiAFQRBqIAcQAkEBdGoiAC0AACECIAVBEGogAC0AARABIAMgAjoAACADQQFqIQMMAQsLIAFBbCAFQdgAahAKIAVBQGsQCnEgBUEoahAKcSAFQRBqEApxGyEJDAELQWwhCQsgBUHwAGokACAJC8oCAQR/IwBBIGsiBSQAIAUgBBAOIAUtAAIhByAFQQhqIAIgAxAGIgIQA0UEQCAEQQRqIQIgACABaiIDQX1qIQQDQCAFQQhqEAQgACAET3JFBEAgAiAFQQhqIAcQAkEBdGoiBi0AACEIIAVBCGogBi0AARABIAAgCDoAACACIAVBCGogBxACQQF0aiIGLQAAIQggBUEIaiAGLQABEAEgACAIOgABIABBAmohAAwBCwsDQCAFQQhqEAQgACADT3JFBEAgAiAFQQhqIAcQAkEBdGoiBC0AACEGIAVBCGogBC0AARABIAAgBjoAACAAQQFqIQAMAQsLA0AgACADT0UEQCACIAVBCGogBxACQQF0aiIELQAAIQYgBUEIaiAELQABEAEgACAGOgAAIABBAWohAAwBCwsgAUFsIAVBCGoQChshAgsgBUEgaiQAIAILtgMBCX8jAEEQayIGJAAgBkEANgIMIAZBADYCCEFUIQQCQAJAIANBQGsiDCADIAZBCGogBkEMaiABIAIQMSICEAMNACAGQQRqIAAQDiAGKAIMIgcgBi0ABEEBaksNASAAQQRqIQogBkEAOgAFIAYgBzoABiAAIAYoAgQ2AgAgB0EBaiEJQQEhBANAIAQgCUkEQCADIARBAnRqIgEoAgAhACABIAU2AgAgACAEQX9qdCAFaiEFIARBAWohBAwBCwsgB0EBaiEHQQAhBSAGKAIIIQkDQCAFIAlGDQEgAyAFIAxqLQAAIgRBAnRqIgBBASAEdEEBdSILIAAoAgAiAWoiADYCACAHIARrIQhBACEEAkAgC0EDTQRAA0AgBCALRg0CIAogASAEakEBdGoiACAIOgABIAAgBToAACAEQQFqIQQMAAALAAsDQCABIABPDQEgCiABQQF0aiIEIAg6AAEgBCAFOgAAIAQgCDoAAyAEIAU6AAIgBCAIOgAFIAQgBToABCAEIAg6AAcgBCAFOgAGIAFBBGohAQwAAAsACyAFQQFqIQUMAAALAAsgAiEECyAGQRBqJAAgBAutAQECfwJAQYQgKAIAIABHIAAoAgBBAXYiAyABa0F4aiICQXhxQQhHcgR/IAIFIAMQJ0UNASACQQhqC0EQSQ0AIAAgACgCACICQQFxIAAgAWpBD2pBeHEiASAAa0EBdHI2AgAgASAANgIEIAEgASgCAEEBcSAAIAJBAXZqIAFrIgJBAXRyNgIAQYQgIAEgAkH/////B3FqQQRqQYQgKAIAIABGGyABNgIAIAEQJQsLygIBBX8CQAJAAkAgAEEIIABBCEsbZ0EfcyAAaUEBR2oiAUEESSAAIAF2cg0AIAFBAnRB/B5qKAIAIgJFDQADQCACQXhqIgMoAgBBAXZBeGoiBSAATwRAIAIgBUEIIAVBCEsbZ0Efc0ECdEGAH2oiASgCAEYEQCABIAIoAgQ2AgALDAMLIARBHksNASAEQQFqIQQgAigCBCICDQALC0EAIQMgAUEgTw0BA0AgAUECdEGAH2ooAgAiAkUEQCABQR5LIQIgAUEBaiEBIAJFDQEMAwsLIAIgAkF4aiIDKAIAQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgBGBEAgASACKAIENgIACwsgAigCACIBBEAgASACKAIENgIECyACKAIEIgEEQCABIAIoAgA2AgALIAMgAygCAEEBcjYCACADIAAQNwsgAwvhCwINfwV+IwBB8ABrIgckACAHIAAoAvDhASIINgJcIAEgAmohDSAIIAAoAoDiAWohDwJAAkAgBUUEQCABIQQMAQsgACgCxOABIRAgACgCwOABIREgACgCvOABIQ4gAEEBNgKM4QFBACEIA0AgCEEDRwRAIAcgCEECdCICaiAAIAJqQazQAWooAgA2AkQgCEEBaiEIDAELC0FsIQwgB0EYaiADIAQQBhADDQEgB0EsaiAHQRhqIAAoAgAQEyAHQTRqIAdBGGogACgCCBATIAdBPGogB0EYaiAAKAIEEBMgDUFgaiESIAEhBEEAIQwDQCAHKAIwIAcoAixBA3RqKQIAIhRCEIinQf8BcSEIIAcoAkAgBygCPEEDdGopAgAiFUIQiKdB/wFxIQsgBygCOCAHKAI0QQN0aikCACIWQiCIpyEJIBVCIIghFyAUQiCIpyECAkAgFkIQiKdB/wFxIgNBAk8EQAJAIAZFIANBGUlyRQRAIAkgB0EYaiADQSAgBygCHGsiCiAKIANLGyIKEAUgAyAKayIDdGohCSAHQRhqEAQaIANFDQEgB0EYaiADEAUgCWohCQwBCyAHQRhqIAMQBSAJaiEJIAdBGGoQBBoLIAcpAkQhGCAHIAk2AkQgByAYNwNIDAELAkAgA0UEQCACBEAgBygCRCEJDAMLIAcoAkghCQwBCwJAAkAgB0EYakEBEAUgCSACRWpqIgNBA0YEQCAHKAJEQX9qIgMgA0VqIQkMAQsgA0ECdCAHaigCRCIJIAlFaiEJIANBAUYNAQsgByAHKAJINgJMCwsgByAHKAJENgJIIAcgCTYCRAsgF6chAyALBEAgB0EYaiALEAUgA2ohAwsgCCALakEUTwRAIAdBGGoQBBoLIAgEQCAHQRhqIAgQBSACaiECCyAHQRhqEAQaIAcgB0EYaiAUQhiIp0H/AXEQCCAUp0H//wNxajYCLCAHIAdBGGogFUIYiKdB/wFxEAggFadB//8DcWo2AjwgB0EYahAEGiAHIAdBGGogFkIYiKdB/wFxEAggFqdB//8DcWo2AjQgByACNgJgIAcoAlwhCiAHIAk2AmggByADNgJkAkACQAJAIAQgAiADaiILaiASSw0AIAIgCmoiEyAPSw0AIA0gBGsgC0Egak8NAQsgByAHKQNoNwMQIAcgBykDYDcDCCAEIA0gB0EIaiAHQdwAaiAPIA4gESAQEB4hCwwBCyACIARqIQggBCAKEAcgAkERTwRAIARBEGohAgNAIAIgCkEQaiIKEAcgAkEQaiICIAhJDQALCyAIIAlrIQIgByATNgJcIAkgCCAOa0sEQCAJIAggEWtLBEBBbCELDAILIBAgAiAOayICaiIKIANqIBBNBEAgCCAKIAMQDxoMAgsgCCAKQQAgAmsQDyEIIAcgAiADaiIDNgJkIAggAmshCCAOIQILIAlBEE8EQCADIAhqIQMDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALDAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdBKGogACgCBBATQQAhBCAHQeAAaiEMIAdB5ABqIQoDQCAHQShqEARBAksgBCAXTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEJIAcoAkggBygCREEDdGopAgAiH0IgiKchCCAeQiCIISAgHUIgiKchAgJAIB9CEIinQf8BcSIDQQJPBEACQCAGRSADQRlJckUEQCAIIAdBKGogA0EgIAcoAixrIg0gDSADSxsiDRAFIAMgDWsiA3RqIQggB0EoahAEGiADRQ0BIAdBKGogAxAFIAhqIQgMAQsgB0EoaiADEAUgCGohCCAHQShqEAQaCyAHKQJUISEgByAINgJUIAcgITcDWAwBCwJAIANFBEAgAgRAIAcoAlQhCAwDCyAHKAJYIQgMAQsCQAJAIAdBKGpBARAFIAggAkVqaiIDQQNGBEAgBygCVEF/aiIDIANFaiEIDAELIANBAnQgB2ooAlQiCCAIRWohCCADQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAg2AlQLICCnIQMgCQRAIAdBKGogCRAFIANqIQMLIAkgC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgAmohAgsgB0EoahAEGiAHIAcoAmggAmoiCSADajYCaCAKIAwgCCAJSxsoAgAhDSAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogB0EoaiAfQhiIp0H/AXEQCCEOIAdB8ABqIARBBHRqIgsgCSANaiAIazYCDCALIAg2AgggCyADNgIEIAsgAjYCACAHIA4gH6dB//8DcWo2AkQgBEEBaiEEDAELCyAEIBdIDQEgEkFgaiEYIAdB4ABqIRogB0HkAGohGyABIQMDQCAHQShqEARBAksgBCAFTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEIIAcoAkggBygCREEDdGopAgAiH0IgiKchCSAeQiCIISAgHUIgiKchDAJAIB9CEIinQf8BcSICQQJPBEACQCAGRSACQRlJckUEQCAJIAdBKGogAkEgIAcoAixrIgogCiACSxsiChAFIAIgCmsiAnRqIQkgB0EoahAEGiACRQ0BIAdBKGogAhAFIAlqIQkMAQsgB0EoaiACEAUgCWohCSAHQShqEAQaCyAHKQJUISEgByAJNgJUIAcgITcDWAwBCwJAIAJFBEAgDARAIAcoAlQhCQwDCyAHKAJYIQkMAQsCQAJAIAdBKGpBARAFIAkgDEVqaiICQQNGBEAgBygCVEF/aiICIAJFaiEJDAELIAJBAnQgB2ooAlQiCSAJRWohCSACQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAk2AlQLICCnIRQgCARAIAdBKGogCBAFIBRqIRQLIAggC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgDGohDAsgB0EoahAEGiAHIAcoAmggDGoiGSAUajYCaCAbIBogCSAZSxsoAgAhHCAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogByAHQShqIB9CGIinQf8BcRAIIB+nQf//A3FqNgJEIAcgB0HwAGogBEEDcUEEdGoiDSkDCCIdNwPIASAHIA0pAwAiHjcDwAECQAJAAkAgBygCvAEiDiAepyICaiIWIBNLDQAgAyAHKALEASIKIAJqIgtqIBhLDQAgEiADayALQSBqTw0BCyAHIAcpA8gBNwMQIAcgBykDwAE3AwggAyASIAdBCGogB0G8AWogEyAPIBUgERAeIQsMAQsgAiADaiEIIAMgDhAHIAJBEU8EQCADQRBqIQIDQCACIA5BEGoiDhAHIAJBEGoiAiAISQ0ACwsgCCAdpyIOayECIAcgFjYCvAEgDiAIIA9rSwRAIA4gCCAVa0sEQEFsIQsMAgsgESACIA9rIgJqIhYgCmogEU0EQCAIIBYgChAPGgwCCyAIIBZBACACaxAPIQggByACIApqIgo2AsQBIAggAmshCCAPIQILIA5BEE8EQCAIIApqIQoDQCAIIAIQByACQRBqIQIgCEEQaiIIIApJDQALDAELAkAgDkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgDkECdCIKQcAeaigCAGoiAhAXIAIgCkHgHmooAgBrIQIgBygCxAEhCgwBCyAIIAIQDAsgCkEJSQ0AIAggCmohCiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAKSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAKSQ0ACwsgCxADBEAgCyEQDAQFIA0gDDYCACANIBkgHGogCWs2AgwgDSAJNgIIIA0gFDYCBCAEQQFqIQQgAyALaiEDDAILAAsLIAQgBUgNASAEIBdrIQtBACEEA0AgCyAFSARAIAcgB0HwAGogC0EDcUEEdGoiAikDCCIdNwPIASAHIAIpAwAiHjcDwAECQAJAAkAgBygCvAEiDCAepyICaiIKIBNLDQAgAyAHKALEASIJIAJqIhBqIBhLDQAgEiADayAQQSBqTw0BCyAHIAcpA8gBNwMgIAcgBykDwAE3AxggAyASIAdBGGogB0G8AWogEyAPIBUgERAeIRAMAQsgAiADaiEIIAMgDBAHIAJBEU8EQCADQRBqIQIDQCACIAxBEGoiDBAHIAJBEGoiAiAISQ0ACwsgCCAdpyIGayECIAcgCjYCvAEgBiAIIA9rSwRAIAYgCCAVa0sEQEFsIRAMAgsgESACIA9rIgJqIgwgCWogEU0EQCAIIAwgCRAPGgwCCyAIIAxBACACaxAPIQggByACIAlqIgk2AsQBIAggAmshCCAPIQILIAZBEE8EQCAIIAlqIQYDQCAIIAIQByACQRBqIQIgCEEQaiIIIAZJDQALDAELAkAgBkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgBkECdCIGQcAeaigCAGoiAhAXIAIgBkHgHmooAgBrIQIgBygCxAEhCQwBCyAIIAIQDAsgCUEJSQ0AIAggCWohBiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAGSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAGSQ0ACwsgEBADDQMgC0EBaiELIAMgEGohAwwBCwsDQCAEQQNHBEAgACAEQQJ0IgJqQazQAWogAiAHaigCVDYCACAEQQFqIQQMAQsLIAcoArwBIQgLQbp/IRAgEyAIayIAIBIgA2tLDQAgAwR/IAMgCCAAEAsgAGoFQQALIAFrIRALIAdB0AFqJAAgEAslACAAQgA3AgAgAEEAOwEIIABBADoACyAAIAE2AgwgACACOgAKC7QFAQN/IwBBMGsiBCQAIABB/wFqIgVBfWohBgJAIAMvAQIEQCAEQRhqIAEgAhAGIgIQAw0BIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahASOgAAIAMgBEEIaiAEQRhqEBI6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0FIAEgBEEQaiAEQRhqEBI6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWsiAyQAQWIhCAJAIAJBCUkNACAAQZjQAGogAUEIaiIEIAJBeGogAEGY0AAQMyIFEAMiBg0AIANBHzYCfCADIANB/ABqIANB+ABqIAQgBCAFaiAGGyIEIAEgAmoiAiAEaxAVIgUQAw0AIAMoAnwiBkEfSw0AIAMoAngiB0EJTw0AIABBiCBqIAMgBkGAC0GADCAHEBggA0E0NgJ8IAMgA0H8AGogA0H4AGogBCAFaiIEIAIgBGsQFSIFEAMNACADKAJ8IgZBNEsNACADKAJ4IgdBCk8NACAAQZAwaiADIAZBgA1B4A4gBxAYIANBIzYCfCADIANB/ABqIANB+ABqIAQgBWoiBCACIARrEBUiBRADDQAgAygCfCIGQSNLDQAgAygCeCIHQQpPDQAgACADIAZBwBBB0BEgBxAYIAQgBWoiBEEMaiIFIAJLDQAgAiAFayEFQQAhAgNAIAJBA0cEQCAEKAAAIgZBf2ogBU8NAiAAIAJBAnRqQZzQAWogBjYCACACQQFqIQIgBEEEaiEEDAELCyAEIAFrIQgLIANBgAFqJAAgCAtGAQN/IABBCGohAyAAKAIEIQJBACEAA0AgACACdkUEQCABIAMgAEEDdGotAAJBFktqIQEgAEEBaiEADAELCyABQQggAmt0C4YDAQV/Qbh/IQcCQCADRQ0AIAItAAAiBEUEQCABQQA2AgBBAUG4fyADQQFGGw8LAn8gAkEBaiIFIARBGHRBGHUiBkF/Sg0AGiAGQX9GBEAgA0EDSA0CIAUvAABBgP4BaiEEIAJBA2oMAQsgA0ECSA0BIAItAAEgBEEIdHJBgIB+aiEEIAJBAmoLIQUgASAENgIAIAVBAWoiASACIANqIgNLDQBBbCEHIABBEGogACAFLQAAIgVBBnZBI0EJIAEgAyABa0HAEEHQEUHwEiAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBmCBqIABBCGogBUEEdkEDcUEfQQggASABIAZqIAgbIgEgAyABa0GAC0GADEGAFyAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBoDBqIABBBGogBUECdkEDcUE0QQkgASABIAZqIAgbIgEgAyABa0GADUHgDkGQGSAAKAKM4QEgACgCnOIBIAQQHyIAEAMNACAAIAFqIAJrIQcLIAcLrQMBCn8jAEGABGsiCCQAAn9BUiACQf8BSw0AGkFUIANBDEsNABogAkEBaiELIABBBGohCUGAgAQgA0F/anRBEHUhCkEAIQJBASEEQQEgA3QiB0F/aiIMIQUDQCACIAtGRQRAAkAgASACQQF0Ig1qLwEAIgZB//8DRgRAIAkgBUECdGogAjoAAiAFQX9qIQVBASEGDAELIARBACAKIAZBEHRBEHVKGyEECyAIIA1qIAY7AQAgAkEBaiECDAELCyAAIAQ7AQIgACADOwEAIAdBA3YgB0EBdmpBA2ohBkEAIQRBACECA0AgBCALRkUEQCABIARBAXRqLgEAIQpBACEAA0AgACAKTkUEQCAJIAJBAnRqIAQ6AAIDQCACIAZqIAxxIgIgBUsNAAsgAEEBaiEADAELCyAEQQFqIQQMAQsLQX8gAg0AGkEAIQIDfyACIAdGBH9BAAUgCCAJIAJBAnRqIgAtAAJBAXRqIgEgAS8BACIBQQFqOwEAIAAgAyABEBRrIgU6AAMgACABIAVB/wFxdCAHazsBACACQQFqIQIMAQsLCyEFIAhBgARqJAAgBQvjBgEIf0FsIQcCQCACQQNJDQACQAJAAkACQCABLQAAIgNBA3EiCUEBaw4DAwEAAgsgACgCiOEBDQBBYg8LIAJBBUkNAkEDIQYgASgAACEFAn8CQAJAIANBAnZBA3EiCEF+aiIEQQFNBEAgBEEBaw0BDAILIAVBDnZB/wdxIQQgBUEEdkH/B3EhAyAIRQwCCyAFQRJ2IQRBBCEGIAVBBHZB//8AcSEDQQAMAQsgBUEEdkH//w9xIgNBgIAISw0DIAEtAARBCnQgBUEWdnIhBEEFIQZBAAshBSAEIAZqIgogAksNAgJAIANBgQZJDQAgACgCnOIBRQ0AQQAhAgNAIAJBg4ABSw0BIAJBQGshAgwAAAsACwJ/IAlBA0YEQCABIAZqIQEgAEHw4gFqIQIgACgCDCEGIAUEQCACIAMgASAEIAYQXwwCCyACIAMgASAEIAYQXQwBCyAAQbjQAWohAiABIAZqIQEgAEHw4gFqIQYgAEGo0ABqIQggBQRAIAggBiADIAEgBCACEF4MAQsgCCAGIAMgASAEIAIQXAsQAw0CIAAgAzYCgOIBIABBATYCiOEBIAAgAEHw4gFqNgLw4QEgCUECRgRAIAAgAEGo0ABqNgIMCyAAIANqIgBBiOMBakIANwAAIABBgOMBakIANwAAIABB+OIBakIANwAAIABB8OIBakIANwAAIAoPCwJ/AkACQAJAIANBAnZBA3FBf2oiBEECSw0AIARBAWsOAgACAQtBASEEIANBA3YMAgtBAiEEIAEvAABBBHYMAQtBAyEEIAEQIUEEdgsiAyAEaiIFQSBqIAJLBEAgBSACSw0CIABB8OIBaiABIARqIAMQCyEBIAAgAzYCgOIBIAAgATYC8OEBIAEgA2oiAEIANwAYIABCADcAECAAQgA3AAggAEIANwAAIAUPCyAAIAM2AoDiASAAIAEgBGo2AvDhASAFDwsCfwJAAkACQCADQQJ2QQNxQX9qIgRBAksNACAEQQFrDgIAAgELQQEhByADQQN2DAILQQIhByABLwAAQQR2DAELIAJBBEkgARAhIgJBj4CAAUtyDQFBAyEHIAJBBHYLIQIgAEHw4gFqIAEgB2otAAAgAkEgahAQIQEgACACNgKA4gEgACABNgLw4QEgB0EBaiEHCyAHC0sAIABC+erQ0OfJoeThADcDICAAQgA3AxggAELP1tO+0ser2UI3AxAgAELW64Lu6v2J9eAANwMIIABCADcDACAAQShqQQBBKBAQGgviAgICfwV+IABBKGoiASAAKAJIaiECAn4gACkDACIDQiBaBEAgACkDECIEQgeJIAApAwgiBUIBiXwgACkDGCIGQgyJfCAAKQMgIgdCEol8IAUQGSAEEBkgBhAZIAcQGQwBCyAAKQMYQsXP2bLx5brqJ3wLIAN8IQMDQCABQQhqIgAgAk0EQEIAIAEpAAAQCSADhUIbiUKHla+vmLbem55/fkLj3MqV/M7y9YV/fCEDIAAhAQwBCwsCQCABQQRqIgAgAksEQCABIQAMAQsgASgAAK1Ch5Wvr5i23puef34gA4VCF4lCz9bTvtLHq9lCfkL5893xmfaZqxZ8IQMLA0AgACACSQRAIAAxAABCxc/ZsvHluuonfiADhUILiUKHla+vmLbem55/fiEDIABBAWohAAwBCwsgA0IhiCADhULP1tO+0ser2UJ+IgNCHYggA4VC+fPd8Zn2masWfiIDQiCIIAOFC+8CAgJ/BH4gACAAKQMAIAKtfDcDAAJAAkAgACgCSCIDIAJqIgRBH00EQCABRQ0BIAAgA2pBKGogASACECAgACgCSCACaiEEDAELIAEgAmohAgJ/IAMEQCAAQShqIgQgA2ogAUEgIANrECAgACAAKQMIIAQpAAAQCTcDCCAAIAApAxAgACkAMBAJNwMQIAAgACkDGCAAKQA4EAk3AxggACAAKQMgIABBQGspAAAQCTcDICAAKAJIIQMgAEEANgJIIAEgA2tBIGohAQsgAUEgaiACTQsEQCACQWBqIQMgACkDICEFIAApAxghBiAAKQMQIQcgACkDCCEIA0AgCCABKQAAEAkhCCAHIAEpAAgQCSEHIAYgASkAEBAJIQYgBSABKQAYEAkhBSABQSBqIgEgA00NAAsgACAFNwMgIAAgBjcDGCAAIAc3AxAgACAINwMICyABIAJPDQEgAEEoaiABIAIgAWsiBBAgCyAAIAQ2AkgLCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQEBogAwVBun8LCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQCxogAwVBun8LC6gCAQZ/IwBBEGsiByQAIABB2OABaikDAEKAgIAQViEIQbh/IQUCQCAEQf//B0sNACAAIAMgBBBCIgUQAyIGDQAgACgCnOIBIQkgACAHQQxqIAMgAyAFaiAGGyIKIARBACAFIAYbayIGEEAiAxADBEAgAyEFDAELIAcoAgwhBCABRQRAQbp/IQUgBEEASg0BCyAGIANrIQUgAyAKaiEDAkAgCQRAIABBADYCnOIBDAELAkACQAJAIARBBUgNACAAQdjgAWopAwBCgICACFgNAAwBCyAAQQA2ApziAQwBCyAAKAIIED8hBiAAQQA2ApziASAGQRRPDQELIAAgASACIAMgBSAEIAgQOSEFDAELIAAgASACIAMgBSAEIAgQOiEFCyAHQRBqJAAgBQtnACAAQdDgAWogASACIAAoAuzhARAuIgEQAwRAIAEPC0G4fyECAkAgAQ0AIABB7OABaigCACIBBEBBYCECIAAoApjiASABRw0BC0EAIQIgAEHw4AFqKAIARQ0AIABBkOEBahBDCyACCycBAX8QVyIERQRAQUAPCyAEIAAgASACIAMgBBBLEE8hACAEEFYgAAs/AQF/AkACQAJAIAAoAqDiAUEBaiIBQQJLDQAgAUEBaw4CAAECCyAAEDBBAA8LIABBADYCoOIBCyAAKAKU4gELvAMCB38BfiMAQRBrIgkkAEG4fyEGAkAgBCgCACIIQQVBCSAAKALs4QEiBRtJDQAgAygCACIHQQFBBSAFGyAFEC8iBRADBEAgBSEGDAELIAggBUEDakkNACAAIAcgBRBJIgYQAw0AIAEgAmohCiAAQZDhAWohCyAIIAVrIQIgBSAHaiEHIAEhBQNAIAcgAiAJECwiBhADDQEgAkF9aiICIAZJBEBBuH8hBgwCCyAJKAIAIghBAksEQEFsIQYMAgsgB0EDaiEHAn8CQAJAAkAgCEEBaw4CAgABCyAAIAUgCiAFayAHIAYQSAwCCyAFIAogBWsgByAGEEcMAQsgBSAKIAVrIActAAAgCSgCCBBGCyIIEAMEQCAIIQYMAgsgACgC8OABBEAgCyAFIAgQRQsgAiAGayECIAYgB2ohByAFIAhqIQUgCSgCBEUNAAsgACkD0OABIgxCf1IEQEFsIQYgDCAFIAFrrFINAQsgACgC8OABBEBBaiEGIAJBBEkNASALEEQhDCAHKAAAIAynRw0BIAdBBGohByACQXxqIQILIAMgBzYCACAEIAI2AgAgBSABayEGCyAJQRBqJAAgBgsuACAAECsCf0EAQQAQAw0AGiABRSACRXJFBEBBYiAAIAEgAhA9EAMNARoLQQALCzcAIAEEQCAAIAAoAsTgASABKAIEIAEoAghqRzYCnOIBCyAAECtBABADIAFFckUEQCAAIAEQWwsL0QIBB38jAEEQayIGJAAgBiAENgIIIAYgAzYCDCAFBEAgBSgCBCEKIAUoAgghCQsgASEIAkACQANAIAAoAuzhARAWIQsCQANAIAQgC0kNASADKAAAQXBxQdDUtMIBRgRAIAMgBBAiIgcQAw0EIAQgB2shBCADIAdqIQMMAQsLIAYgAzYCDCAGIAQ2AggCQCAFBEAgACAFEE5BACEHQQAQA0UNAQwFCyAAIAogCRBNIgcQAw0ECyAAIAgQUCAMQQFHQQAgACAIIAIgBkEMaiAGQQhqEEwiByIDa0EAIAMQAxtBCkdyRQRAQbh/IQcMBAsgBxADDQMgAiAHayECIAcgCGohCEEBIQwgBigCDCEDIAYoAgghBAwBCwsgBiADNgIMIAYgBDYCCEG4fyEHIAQNASAIIAFrIQcMAQsgBiADNgIMIAYgBDYCCAsgBkEQaiQAIAcLRgECfyABIAAoArjgASICRwRAIAAgAjYCxOABIAAgATYCuOABIAAoArzgASEDIAAgATYCvOABIAAgASADIAJrajYCwOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACAFQQhqIAQQDgJ/IAUtAAkEQCAAIAEgAiADIAQQYgwBCyAAIAEgAiADIAQQNQshACAFQRBqJAAgAAtZAQF/QQ8hAiABIABJBEAgAUEEdCAAbiECCyAAQQh2IgEgAkEYbCIAQYwIaigCAGwgAEGICGooAgBqIgJBA3YgAmogAEGACGooAgAgAEGECGooAgAgAWxqSQs3ACAAIAMgBCAFQYAQEDMiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQMgVBuH8LC78DAQN/IwBBIGsiBSQAIAVBCGogAiADEAYiAhADRQRAIAAgAWoiB0F9aiEGIAUgBBAOIARBBGohAiAFLQACIQMDQEEAIAAgBkkgBUEIahAEGwRAIAAgAiAFQQhqIAMQAkECdGoiBC8BADsAACAFQQhqIAQtAAIQASAAIAQtAANqIgQgAiAFQQhqIAMQAkECdGoiAC8BADsAACAFQQhqIAAtAAIQASAEIAAtAANqIQAMAQUgB0F+aiEEA0AgBUEIahAEIAAgBEtyRQRAIAAgAiAFQQhqIAMQAkECdGoiBi8BADsAACAFQQhqIAYtAAIQASAAIAYtAANqIQAMAQsLA0AgACAES0UEQCAAIAIgBUEIaiADEAJBAnRqIgYvAQA7AAAgBUEIaiAGLQACEAEgACAGLQADaiEADAELCwJAIAAgB08NACAAIAIgBUEIaiADEAIiA0ECdGoiAC0AADoAACAALQADQQFGBEAgBUEIaiAALQACEAEMAQsgBSgCDEEfSw0AIAVBCGogAiADQQJ0ai0AAhABIAUoAgxBIUkNACAFQSA2AgwLIAFBbCAFQQhqEAobIQILCwsgBUEgaiQAIAILkgIBBH8jAEFAaiIJJAAgCSADQTQQCyEDAkAgBEECSA0AIAMgBEECdGooAgAhCSADQTxqIAgQIyADQQE6AD8gAyACOgA+QQAhBCADKAI8IQoDQCAEIAlGDQEgACAEQQJ0aiAKNgEAIARBAWohBAwAAAsAC0EAIQkDQCAGIAlGRQRAIAMgBSAJQQF0aiIKLQABIgtBAnRqIgwoAgAhBCADQTxqIAotAABBCHQgCGpB//8DcRAjIANBAjoAPyADIAcgC2siCiACajoAPiAEQQEgASAKa3RqIQogAygCPCELA0AgACAEQQJ0aiALNgEAIARBAWoiBCAKSQ0ACyAMIAo2AgAgCUEBaiEJDAELCyADQUBrJAALowIBCX8jAEHQAGsiCSQAIAlBEGogBUE0EAsaIAcgBmshDyAHIAFrIRADQAJAIAMgCkcEQEEBIAEgByACIApBAXRqIgYtAAEiDGsiCGsiC3QhDSAGLQAAIQ4gCUEQaiAMQQJ0aiIMKAIAIQYgCyAPTwRAIAAgBkECdGogCyAIIAUgCEE0bGogCCAQaiIIQQEgCEEBShsiCCACIAQgCEECdGooAgAiCEEBdGogAyAIayAHIA4QYyAGIA1qIQgMAgsgCUEMaiAOECMgCUEBOgAPIAkgCDoADiAGIA1qIQggCSgCDCELA0AgBiAITw0CIAAgBkECdGogCzYBACAGQQFqIQYMAAALAAsgCUHQAGokAA8LIAwgCDYCACAKQQFqIQoMAAALAAs0ACAAIAMgBCAFEDYiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQNAVBuH8LCyMAIAA/AEEQdGtB//8DakEQdkAAQX9GBEBBAA8LQQAQAEEBCzsBAX8gAgRAA0AgACABIAJBgCAgAkGAIEkbIgMQCyEAIAFBgCBqIQEgAEGAIGohACACIANrIgINAAsLCwYAIAAQAwsLqBUJAEGICAsNAQAAAAEAAAACAAAAAgBBoAgLswYBAAAAAQAAAAIAAAACAAAAJgAAAIIAAAAhBQAASgAAAGcIAAAmAAAAwAEAAIAAAABJBQAASgAAAL4IAAApAAAALAIAAIAAAABJBQAASgAAAL4IAAAvAAAAygIAAIAAAACKBQAASgAAAIQJAAA1AAAAcwMAAIAAAACdBQAASgAAAKAJAAA9AAAAgQMAAIAAAADrBQAASwAAAD4KAABEAAAAngMAAIAAAABNBgAASwAAAKoKAABLAAAAswMAAIAAAADBBgAATQAAAB8NAABNAAAAUwQAAIAAAAAjCAAAUQAAAKYPAABUAAAAmQQAAIAAAABLCQAAVwAAALESAABYAAAA2gQAAIAAAABvCQAAXQAAACMUAABUAAAARQUAAIAAAABUCgAAagAAAIwUAABqAAAArwUAAIAAAAB2CQAAfAAAAE4QAAB8AAAA0gIAAIAAAABjBwAAkQAAAJAHAACSAAAAAAAAAAEAAAABAAAABQAAAA0AAAAdAAAAPQAAAH0AAAD9AAAA/QEAAP0DAAD9BwAA/Q8AAP0fAAD9PwAA/X8AAP3/AAD9/wEA/f8DAP3/BwD9/w8A/f8fAP3/PwD9/38A/f//AP3//wH9//8D/f//B/3//w/9//8f/f//P/3//38AAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABEAAAASAAAAEwAAABQAAAAVAAAAFgAAABcAAAAYAAAAGQAAABoAAAAbAAAAHAAAAB0AAAAeAAAAHwAAAAMAAAAEAAAABQAAAAYAAAAHAAAACAAAAAkAAAAKAAAACwAAAAwAAAANAAAADgAAAA8AAAAQAAAAEQAAABIAAAATAAAAFAAAABUAAAAWAAAAFwAAABgAAAAZAAAAGgAAABsAAAAcAAAAHQAAAB4AAAAfAAAAIAAAACEAAAAiAAAAIwAAACUAAAAnAAAAKQAAACsAAAAvAAAAMwAAADsAAABDAAAAUwAAAGMAAACDAAAAAwEAAAMCAAADBAAAAwgAAAMQAAADIAAAA0AAAAOAAAADAAEAQeAPC1EBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAEAAAABQAAAAcAAAAIAAAACQAAAAoAAAALAAAADAAAAA0AAAAOAAAADwAAABAAQcQQC4sBAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABIAAAAUAAAAFgAAABgAAAAcAAAAIAAAACgAAAAwAAAAQAAAAIAAAAAAAQAAAAIAAAAEAAAACAAAABAAAAAgAAAAQAAAAIAAAAAAAQBBkBIL5gQBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAAAEAAAAEAAAACAAAAAAAAAABAAEBBgAAAAAAAAQAAAAAEAAABAAAAAAgAAAFAQAAAAAAAAUDAAAAAAAABQQAAAAAAAAFBgAAAAAAAAUHAAAAAAAABQkAAAAAAAAFCgAAAAAAAAUMAAAAAAAABg4AAAAAAAEFEAAAAAAAAQUUAAAAAAABBRYAAAAAAAIFHAAAAAAAAwUgAAAAAAAEBTAAAAAgAAYFQAAAAAAABwWAAAAAAAAIBgABAAAAAAoGAAQAAAAADAYAEAAAIAAABAAAAAAAAAAEAQAAAAAAAAUCAAAAIAAABQQAAAAAAAAFBQAAACAAAAUHAAAAAAAABQgAAAAgAAAFCgAAAAAAAAULAAAAAAAABg0AAAAgAAEFEAAAAAAAAQUSAAAAIAABBRYAAAAAAAIFGAAAACAAAwUgAAAAAAADBSgAAAAAAAYEQAAAABAABgRAAAAAIAAHBYAAAAAAAAkGAAIAAAAACwYACAAAMAAABAAAAAAQAAAEAQAAACAAAAUCAAAAIAAABQMAAAAgAAAFBQAAACAAAAUGAAAAIAAABQgAAAAgAAAFCQAAACAAAAULAAAAIAAABQwAAAAAAAAGDwAAACAAAQUSAAAAIAABBRQAAAAgAAIFGAAAACAAAgUcAAAAIAADBSgAAAAgAAQFMAAAAAAAEAYAAAEAAAAPBgCAAAAAAA4GAEAAAAAADQYAIABBgBcLhwIBAAEBBQAAAAAAAAUAAAAAAAAGBD0AAAAAAAkF/QEAAAAADwX9fwAAAAAVBf3/HwAAAAMFBQAAAAAABwR9AAAAAAAMBf0PAAAAABIF/f8DAAAAFwX9/38AAAAFBR0AAAAAAAgE/QAAAAAADgX9PwAAAAAUBf3/DwAAAAIFAQAAABAABwR9AAAAAAALBf0HAAAAABEF/f8BAAAAFgX9/z8AAAAEBQ0AAAAQAAgE/QAAAAAADQX9HwAAAAATBf3/BwAAAAEFAQAAABAABgQ9AAAAAAAKBf0DAAAAABAF/f8AAAAAHAX9//8PAAAbBf3//wcAABoF/f//AwAAGQX9//8BAAAYBf3//wBBkBkLhgQBAAEBBgAAAAAAAAYDAAAAAAAABAQAAAAgAAAFBQAAAAAAAAUGAAAAAAAABQgAAAAAAAAFCQAAAAAAAAULAAAAAAAABg0AAAAAAAAGEAAAAAAAAAYTAAAAAAAABhYAAAAAAAAGGQAAAAAAAAYcAAAAAAAABh8AAAAAAAAGIgAAAAAAAQYlAAAAAAABBikAAAAAAAIGLwAAAAAAAwY7AAAAAAAEBlMAAAAAAAcGgwAAAAAACQYDAgAAEAAABAQAAAAAAAAEBQAAACAAAAUGAAAAAAAABQcAAAAgAAAFCQAAAAAAAAUKAAAAAAAABgwAAAAAAAAGDwAAAAAAAAYSAAAAAAAABhUAAAAAAAAGGAAAAAAAAAYbAAAAAAAABh4AAAAAAAAGIQAAAAAAAQYjAAAAAAABBicAAAAAAAIGKwAAAAAAAwYzAAAAAAAEBkMAAAAAAAUGYwAAAAAACAYDAQAAIAAABAQAAAAwAAAEBAAAABAAAAQFAAAAIAAABQcAAAAgAAAFCAAAACAAAAUKAAAAIAAABQsAAAAAAAAGDgAAAAAAAAYRAAAAAAAABhQAAAAAAAAGFwAAAAAAAAYaAAAAAAAABh0AAAAAAAAGIAAAAAAAEAYDAAEAAAAPBgOAAAAAAA4GA0AAAAAADQYDIAAAAAAMBgMQAAAAAAsGAwgAAAAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/AAAA/wAAAP8BAAD/AwAA/wcAAP8PAAD/HwAA/z8AAP9/AAD//wAA//8BAP//AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ";/*! https://mths.be/codepointat v0.2.0 by @mathias */String.prototype.codePointAt||function(){var t=function(){try{var n={},r=Object.defineProperty,i=r(n,n,n)&&r}catch{}return i}(),e=function(n){if(this==null)throw TypeError();var r=String(this),i=r.length,s=n?Number(n):0;if(s!=s&&(s=0),!(s<0||s>=i)){var a=r.charCodeAt(s),o;return a>=55296&&a<=56319&&i>s+1&&(o=r.charCodeAt(s+1),o>=56320&&o<=57343)?(a-55296)*1024+o-56320+65536:a}};t?t(String.prototype,"codePointAt",{value:e,configurable:!0,writable:!0}):String.prototype.codePointAt=e}();function Ac(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}var Q2=new Ac,N2=new Ac,fc=new Uint8Array(30),dc=new Uint16Array(30),G2=new Uint8Array(30),V2=new Uint16Array(30);function pc(t,e,n,r){var i,s;for(i=0;i<n;++i)t[i]=0;for(i=0;i<30-n;++i)t[i+n]=i/n|0;for(s=r,i=0;i<30;++i)e[i]=s,s+=1<<t[i]}function z2(t,e){var n;for(n=0;n<7;++n)t.table[n]=0;for(t.table[7]=24,t.table[8]=152,t.table[9]=112,n=0;n<24;++n)t.trans[n]=256+n;for(n=0;n<144;++n)t.trans[24+n]=n;for(n=0;n<8;++n)t.trans[24+144+n]=280+n;for(n=0;n<112;++n)t.trans[24+144+8+n]=144+n;for(n=0;n<5;++n)e.table[n]=0;for(e.table[5]=32,n=0;n<32;++n)e.trans[n]=n}z2(Q2,N2),pc(fc,dc,4,3),pc(G2,V2,2,1),fc[28]=0,dc[28]=258;function wr(t,e,n,r,i){return Math.pow(1-i,3)*t+3*Math.pow(1-i,2)*i*e+3*(1-i)*Math.pow(i,2)*n+Math.pow(i,3)*r}function Ln(){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN}Ln.prototype.isEmpty=function(){return isNaN(this.x1)||isNaN(this.y1)||isNaN(this.x2)||isNaN(this.y2)},Ln.prototype.addPoint=function(t,e){typeof t=="number"&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=t,this.x2=t),t<this.x1&&(this.x1=t),t>this.x2&&(this.x2=t)),typeof e=="number"&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=e,this.y2=e),e<this.y1&&(this.y1=e),e>this.y2&&(this.y2=e))},Ln.prototype.addX=function(t){this.addPoint(t,null)},Ln.prototype.addY=function(t){this.addPoint(null,t)},Ln.prototype.addBezier=function(t,e,n,r,i,s,a,o){var l=[t,e],h=[n,r],u=[i,s],A=[a,o];this.addPoint(t,e),this.addPoint(a,o);for(var f=0;f<=1;f++){var d=6*l[f]-12*h[f]+6*u[f],m=-3*l[f]+9*h[f]-9*u[f]+3*A[f],y=3*h[f]-3*l[f];if(m===0){if(d===0)continue;var C=-y/d;0<C&&C<1&&(f===0&&this.addX(wr(l[f],h[f],u[f],A[f],C)),f===1&&this.addY(wr(l[f],h[f],u[f],A[f],C)));continue}var x=Math.pow(d,2)-4*y*m;if(!(x<0)){var I=(-d+Math.sqrt(x))/(2*m);0<I&&I<1&&(f===0&&this.addX(wr(l[f],h[f],u[f],A[f],I)),f===1&&this.addY(wr(l[f],h[f],u[f],A[f],I)));var g=(-d-Math.sqrt(x))/(2*m);0<g&&g<1&&(f===0&&this.addX(wr(l[f],h[f],u[f],A[f],g)),f===1&&this.addY(wr(l[f],h[f],u[f],A[f],g)))}}},Ln.prototype.addQuad=function(t,e,n,r,i,s){var a=t+.6666666666666666*(n-t),o=e+2/3*(r-e),l=a+1/3*(i-t),h=o+1/3*(s-e);this.addBezier(t,e,a,o,l,h,i,s)};function Ke(){this.commands=[],this.fill="black",this.stroke=null,this.strokeWidth=1}Ke.prototype.moveTo=function(t,e){this.commands.push({type:"M",x:t,y:e})},Ke.prototype.lineTo=function(t,e){this.commands.push({type:"L",x:t,y:e})},Ke.prototype.curveTo=Ke.prototype.bezierCurveTo=function(t,e,n,r,i,s){this.commands.push({type:"C",x1:t,y1:e,x2:n,y2:r,x:i,y:s})},Ke.prototype.quadTo=Ke.prototype.quadraticCurveTo=function(t,e,n,r){this.commands.push({type:"Q",x1:t,y1:e,x:n,y:r})},Ke.prototype.close=Ke.prototype.closePath=function(){this.commands.push({type:"Z"})},Ke.prototype.extend=function(t){if(t.commands)t=t.commands;else if(t instanceof Ln){var e=t;this.moveTo(e.x1,e.y1),this.lineTo(e.x2,e.y1),this.lineTo(e.x2,e.y2),this.lineTo(e.x1,e.y2),this.close();return}Array.prototype.push.apply(this.commands,t)},Ke.prototype.getBoundingBox=function(){for(var t=new Ln,e=0,n=0,r=0,i=0,s=0;s<this.commands.length;s++){var a=this.commands[s];switch(a.type){case"M":t.addPoint(a.x,a.y),e=r=a.x,n=i=a.y;break;case"L":t.addPoint(a.x,a.y),r=a.x,i=a.y;break;case"Q":t.addQuad(r,i,a.x1,a.y1,a.x,a.y),r=a.x,i=a.y;break;case"C":t.addBezier(r,i,a.x1,a.y1,a.x2,a.y2,a.x,a.y),r=a.x,i=a.y;break;case"Z":r=e,i=n;break;default:throw new Error("Unexpected path command "+a.type)}}return t.isEmpty()&&t.addPoint(0,0),t},Ke.prototype.draw=function(t){t.beginPath();for(var e=0;e<this.commands.length;e+=1){var n=this.commands[e];n.type==="M"?t.moveTo(n.x,n.y):n.type==="L"?t.lineTo(n.x,n.y):n.type==="C"?t.bezierCurveTo(n.x1,n.y1,n.x2,n.y2,n.x,n.y):n.type==="Q"?t.quadraticCurveTo(n.x1,n.y1,n.x,n.y):n.type==="Z"&&t.closePath()}this.fill&&(t.fillStyle=this.fill,t.fill()),this.stroke&&(t.strokeStyle=this.stroke,t.lineWidth=this.strokeWidth,t.stroke())},Ke.prototype.toPathData=function(t){t=t!==void 0?t:2;function e(a){return Math.round(a)===a?""+Math.round(a):a.toFixed(t)}function n(){for(var a=arguments,o="",l=0;l<arguments.length;l+=1){var h=a[l];h>=0&&l>0&&(o+=" "),o+=e(h)}return o}for(var r="",i=0;i<this.commands.length;i+=1){var s=this.commands[i];s.type==="M"?r+="M"+n(s.x,s.y):s.type==="L"?r+="L"+n(s.x,s.y):s.type==="C"?r+="C"+n(s.x1,s.y1,s.x2,s.y2,s.x,s.y):s.type==="Q"?r+="Q"+n(s.x1,s.y1,s.x,s.y):s.type==="Z"&&(r+="Z")}return r},Ke.prototype.toSVG=function(t){var e='<path d="';return e+=this.toPathData(t),e+='"',this.fill&&this.fill!=="black"&&(this.fill===null?e+=' fill="none"':e+=' fill="'+this.fill+'"'),this.stroke&&(e+=' stroke="'+this.stroke+'" stroke-width="'+this.strokeWidth+'"'),e+="/>",e},Ke.prototype.toDOMElement=function(t){var e=this.toPathData(t),n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d",e),n};function gc(t){throw new Error(t)}function mc(t,e){t||gc(e)}var Ie={fail:gc,argument:mc,assert:mc},vc=32768,yc=2147483648,br={},ae={},ye={};function kt(t){return function(){return t}}ae.BYTE=function(t){return Ie.argument(t>=0&&t<=255,"Byte value should be between 0 and 255."),[t]},ye.BYTE=kt(1),ae.CHAR=function(t){return[t.charCodeAt(0)]},ye.CHAR=kt(1),ae.CHARARRAY=function(t){typeof t>"u"&&(t="",console.warn("Undefined CHARARRAY encountered and treated as an empty string. This is probably caused by a missing glyph name."));for(var e=[],n=0;n<t.length;n+=1)e[n]=t.charCodeAt(n);return e},ye.CHARARRAY=function(t){return typeof t>"u"?0:t.length},ae.USHORT=function(t){return[t>>8&255,t&255]},ye.USHORT=kt(2),ae.SHORT=function(t){return t>=vc&&(t=-(2*vc-t)),[t>>8&255,t&255]},ye.SHORT=kt(2),ae.UINT24=function(t){return[t>>16&255,t>>8&255,t&255]},ye.UINT24=kt(3),ae.ULONG=function(t){return[t>>24&255,t>>16&255,t>>8&255,t&255]},ye.ULONG=kt(4),ae.LONG=function(t){return t>=yc&&(t=-(2*yc-t)),[t>>24&255,t>>16&255,t>>8&255,t&255]},ye.LONG=kt(4),ae.FIXED=ae.ULONG,ye.FIXED=ye.ULONG,ae.FWORD=ae.SHORT,ye.FWORD=ye.SHORT,ae.UFWORD=ae.USHORT,ye.UFWORD=ye.USHORT,ae.LONGDATETIME=function(t){return[0,0,0,0,t>>24&255,t>>16&255,t>>8&255,t&255]},ye.LONGDATETIME=kt(8),ae.TAG=function(t){return Ie.argument(t.length===4,"Tag should be exactly 4 ASCII characters."),[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]},ye.TAG=kt(4),ae.Card8=ae.BYTE,ye.Card8=ye.BYTE,ae.Card16=ae.USHORT,ye.Card16=ye.USHORT,ae.OffSize=ae.BYTE,ye.OffSize=ye.BYTE,ae.SID=ae.USHORT,ye.SID=ye.USHORT,ae.NUMBER=function(t){return t>=-107&&t<=107?[t+139]:t>=108&&t<=1131?(t=t-108,[(t>>8)+247,t&255]):t>=-1131&&t<=-108?(t=-t-108,[(t>>8)+251,t&255]):t>=-32768&&t<=32767?ae.NUMBER16(t):ae.NUMBER32(t)},ye.NUMBER=function(t){return ae.NUMBER(t).length},ae.NUMBER16=function(t){return[28,t>>8&255,t&255]},ye.NUMBER16=kt(3),ae.NUMBER32=function(t){return[29,t>>24&255,t>>16&255,t>>8&255,t&255]},ye.NUMBER32=kt(5),ae.REAL=function(t){var e=t.toString(),n=/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(e);if(n){var r=parseFloat("1e"+((n[2]?+n[2]:0)+n[1].length));e=(Math.round(t*r)/r).toString()}for(var i="",s=0,a=e.length;s<a;s+=1){var o=e[s];o==="e"?i+=e[++s]==="-"?"c":"b":o==="."?i+="a":o==="-"?i+="e":i+=o}i+=i.length&1?"f":"ff";for(var l=[30],h=0,u=i.length;h<u;h+=2)l.push(parseInt(i.substr(h,2),16));return l},ye.REAL=function(t){return ae.REAL(t).length},ae.NAME=ae.CHARARRAY,ye.NAME=ye.CHARARRAY,ae.STRING=ae.CHARARRAY,ye.STRING=ye.CHARARRAY,br.UTF8=function(t,e,n){for(var r=[],i=n,s=0;s<i;s++,e+=1)r[s]=t.getUint8(e);return String.fromCharCode.apply(null,r)},br.UTF16=function(t,e,n){for(var r=[],i=n/2,s=0;s<i;s++,e+=2)r[s]=t.getUint16(e);return String.fromCharCode.apply(null,r)},ae.UTF16=function(t){for(var e=[],n=0;n<t.length;n+=1){var r=t.charCodeAt(n);e[e.length]=r>>8&255,e[e.length]=r&255}return e},ye.UTF16=function(t){return t.length*2};var Ga={"x-mac-croatian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®Š™´¨≠ŽØ∞±≤≥∆µ∂∑∏š∫ªºΩžø¿¡¬√ƒ≈ƫȅ ÀÃÕŒœĐ—“”‘’÷◊©⁄€‹›Æ»–·‚„‰ÂćÁčÈÍÎÏÌÓÔđÒÚÛÙıˆ˜¯πË˚¸Êæˇ","x-mac-cyrillic":"АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°Ґ£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµґЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю","x-mac-gaelic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØḂ±≤≥ḃĊċḊḋḞḟĠġṀæøṁṖṗɼƒſṠ«»… ÀÃÕŒœ–—“”‘’ṡẛÿŸṪ€‹›Ŷŷṫ·Ỳỳ⁊ÂÊÁËÈÍÎÏÌÓÔ♣ÒÚÛÙıÝýŴŵẄẅẀẁẂẃ","x-mac-greek":"Ĺ²É³ÖÜ΅àâä΄¨çéèê룙î‰ôö¦€ùûü†ΓΔΘΛΞΠß®©ΣΪ§≠°·Α±≤≥¥ΒΕΖΗΙΚΜΦΫΨΩάΝ¬ΟΡ≈Τ«»… ΥΧΆΈœ–―“”‘’÷ΉΊΌΎέήίόΏύαβψδεφγηιξκλμνοπώρστθωςχυζϊϋΐΰ","x-mac-icelandic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûüݰ¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€ÐðÞþý·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-inuit":"ᐃᐄᐅᐆᐊᐋᐱᐲᐳᐴᐸᐹᑉᑎᑏᑐᑑᑕᑖᑦᑭᑮᑯᑰᑲᑳᒃᒋᒌᒍᒎᒐᒑ°ᒡᒥᒦ•¶ᒧ®©™ᒨᒪᒫᒻᓂᓃᓄᓅᓇᓈᓐᓯᓰᓱᓲᓴᓵᔅᓕᓖᓗᓘᓚᓛᓪᔨᔩᔪᔫᔭ… ᔮᔾᕕᕖᕗ–—“”‘’ᕘᕙᕚᕝᕆᕇᕈᕉᕋᕌᕐᕿᖀᖁᖂᖃᖄᖅᖏᖐᖑᖒᖓᖔᖕᙱᙲᙳᙴᙵᙶᖖᖠᖡᖢᖣᖤᖥᖦᕼŁł","x-mac-ce":"ÄĀāÉĄÖÜáąČäčĆć鏟ĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅņѬ√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ",macintosh:"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-romanian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ĂȘ∞±≤≥¥µ∂∑∏π∫ªºΩăș¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›Țț‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-turkish":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ"};br.MACSTRING=function(t,e,n,r){var i=Ga[r];if(i!==void 0){for(var s="",a=0;a<n;a++){var o=t.getUint8(e+a);o<=127?s+=String.fromCharCode(o):s+=i[o&127]}return s}};var Ki=typeof WeakMap=="function"&&new WeakMap,Xi,W2=function(t){if(!Xi){Xi={};for(var e in Ga)Xi[e]=new String(e)}var n=Xi[t];if(n!==void 0){if(Ki){var r=Ki.get(n);if(r!==void 0)return r}var i=Ga[t];if(i!==void 0){for(var s={},a=0;a<i.length;a++)s[i.charCodeAt(a)]=a+128;return Ki&&Ki.set(n,s),s}}};ae.MACSTRING=function(t,e){var n=W2(e);if(n!==void 0){for(var r=[],i=0;i<t.length;i++){var s=t.charCodeAt(i);if(s>=128&&(s=n[s],s===void 0))return;r[i]=s}return r}},ye.MACSTRING=function(t,e){var n=ae.MACSTRING(t,e);return n!==void 0?n.length:0};function Va(t){return t>=-128&&t<=127}function Y2(t,e,n){for(var r=0,i=t.length;e<i&&r<64&&t[e]===0;)++e,++r;return n.push(128|r-1),e}function j2(t,e,n){for(var r=0,i=t.length,s=e;s<i&&r<64;){var a=t[s];if(!Va(a)||a===0&&s+1<i&&t[s+1]===0)break;++s,++r}n.push(r-1);for(var o=e;o<s;++o)n.push(t[o]+256&255);return s}function q2(t,e,n){for(var r=0,i=t.length,s=e;s<i&&r<64;){var a=t[s];if(a===0||Va(a)&&s+1<i&&Va(t[s+1]))break;++s,++r}n.push(64|r-1);for(var o=e;o<s;++o){var l=t[o];n.push(l+65536>>8&255,l+256&255)}return s}ae.VARDELTAS=function(t){for(var e=0,n=[];e<t.length;){var r=t[e];r===0?e=Y2(t,e,n):r>=-128&&r<=127?e=j2(t,e,n):e=q2(t,e,n)}return n},ae.INDEX=function(t){for(var e=1,n=[e],r=[],i=0;i<t.length;i+=1){var s=ae.OBJECT(t[i]);Array.prototype.push.apply(r,s),e+=s.length,n.push(e)}if(r.length===0)return[0,0];for(var a=[],o=1+Math.floor(Math.log(e)/Math.log(2))/8|0,l=[void 0,ae.BYTE,ae.USHORT,ae.UINT24,ae.ULONG][o],h=0;h<n.length;h+=1){var u=l(n[h]);Array.prototype.push.apply(a,u)}return Array.prototype.concat(ae.Card16(t.length),ae.OffSize(o),a,r)},ye.INDEX=function(t){return ae.INDEX(t).length},ae.DICT=function(t){for(var e=[],n=Object.keys(t),r=n.length,i=0;i<r;i+=1){var s=parseInt(n[i],0),a=t[s];e=e.concat(ae.OPERAND(a.value,a.type)),e=e.concat(ae.OPERATOR(s))}return e},ye.DICT=function(t){return ae.DICT(t).length},ae.OPERATOR=function(t){return t<1200?[t]:[12,t-1200]},ae.OPERAND=function(t,e){var n=[];if(Array.isArray(e))for(var r=0;r<e.length;r+=1)Ie.argument(t.length===e.length,"Not enough arguments given for type"+e),n=n.concat(ae.OPERAND(t[r],e[r]));else if(e==="SID")n=n.concat(ae.NUMBER(t));else if(e==="offset")n=n.concat(ae.NUMBER32(t));else if(e==="number")n=n.concat(ae.NUMBER(t));else if(e==="real")n=n.concat(ae.REAL(t));else throw new Error("Unknown operand type "+e);return n},ae.OP=ae.BYTE,ye.OP=ye.BYTE;var Zi=typeof WeakMap=="function"&&new WeakMap;ae.CHARSTRING=function(t){if(Zi){var e=Zi.get(t);if(e!==void 0)return e}for(var n=[],r=t.length,i=0;i<r;i+=1){var s=t[i];n=n.concat(ae[s.type](s.value))}return Zi&&Zi.set(t,n),n},ye.CHARSTRING=function(t){return ae.CHARSTRING(t).length},ae.OBJECT=function(t){var e=ae[t.type];return Ie.argument(e!==void 0,"No encoding function for type "+t.type),e(t.value)},ye.OBJECT=function(t){var e=ye[t.type];return Ie.argument(e!==void 0,"No sizeOf function for type "+t.type),e(t.value)},ae.TABLE=function(t){for(var e=[],n=t.fields.length,r=[],i=[],s=0;s<n;s+=1){var a=t.fields[s],o=ae[a.type];Ie.argument(o!==void 0,"No encoding function for field type "+a.type+" ("+a.name+")");var l=t[a.name];l===void 0&&(l=a.value);var h=o(l);a.type==="TABLE"?(i.push(e.length),e=e.concat([0,0]),r.push(h)):e=e.concat(h)}for(var u=0;u<r.length;u+=1){var A=i[u],f=e.length;Ie.argument(f<65536,"Table "+t.tableName+" too big."),e[A]=f>>8,e[A+1]=f&255,e=e.concat(r[u])}return e},ye.TABLE=function(t){for(var e=0,n=t.fields.length,r=0;r<n;r+=1){var i=t.fields[r],s=ye[i.type];Ie.argument(s!==void 0,"No sizeOf function for field type "+i.type+" ("+i.name+")");var a=t[i.name];a===void 0&&(a=i.value),e+=s(a),i.type==="TABLE"&&(e+=2)}return e},ae.RECORD=ae.TABLE,ye.RECORD=ye.TABLE,ae.LITERAL=function(t){return t},ye.LITERAL=function(t){return t.length};function He(t,e,n){if(e.length&&(e[0].name!=="coverageFormat"||e[0].value===1))for(var r=0;r<e.length;r+=1){var i=e[r];this[i.name]=i.value}if(this.tableName=t,this.fields=e,n)for(var s=Object.keys(n),a=0;a<s.length;a+=1){var o=s[a],l=n[o];this[o]!==void 0&&(this[o]=l)}}He.prototype.encode=function(){return ae.TABLE(this)},He.prototype.sizeOf=function(){return ye.TABLE(this)};function Zr(t,e,n){n===void 0&&(n=e.length);var r=new Array(e.length+1);r[0]={name:t+"Count",type:"USHORT",value:n};for(var i=0;i<e.length;i++)r[i+1]={name:t+i,type:"USHORT",value:e[i]};return r}function za(t,e,n){var r=e.length,i=new Array(r+1);i[0]={name:t+"Count",type:"USHORT",value:r};for(var s=0;s<r;s++)i[s+1]={name:t+s,type:"TABLE",value:n(e[s],s)};return i}function Jr(t,e,n){var r=e.length,i=[];i[0]={name:t+"Count",type:"USHORT",value:r};for(var s=0;s<r;s++)i=i.concat(n(e[s],s));return i}function Ji(t){t.format===1?He.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:1}].concat(Zr("glyph",t.glyphs))):t.format===2?He.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:2}].concat(Jr("rangeRecord",t.ranges,function(e){return[{name:"startGlyphID",type:"USHORT",value:e.start},{name:"endGlyphID",type:"USHORT",value:e.end},{name:"startCoverageIndex",type:"USHORT",value:e.index}]}))):Ie.assert(!1,"Coverage format must be 1 or 2.")}Ji.prototype=Object.create(He.prototype),Ji.prototype.constructor=Ji;function Hi(t){He.call(this,"scriptListTable",Jr("scriptRecord",t,function(e,n){var r=e.script,i=r.defaultLangSys;return Ie.assert(!!i,"Unable to write GSUB: script "+e.tag+" has no default language system."),[{name:"scriptTag"+n,type:"TAG",value:e.tag},{name:"script"+n,type:"TABLE",value:new He("scriptTable",[{name:"defaultLangSys",type:"TABLE",value:new He("defaultLangSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:i.reqFeatureIndex}].concat(Zr("featureIndex",i.featureIndexes)))}].concat(Jr("langSys",r.langSysRecords,function(s,a){var o=s.langSys;return[{name:"langSysTag"+a,type:"TAG",value:s.tag},{name:"langSys"+a,type:"TABLE",value:new He("langSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:o.reqFeatureIndex}].concat(Zr("featureIndex",o.featureIndexes)))}]})))}]}))}Hi.prototype=Object.create(He.prototype),Hi.prototype.constructor=Hi;function $i(t){He.call(this,"featureListTable",Jr("featureRecord",t,function(e,n){var r=e.feature;return[{name:"featureTag"+n,type:"TAG",value:e.tag},{name:"feature"+n,type:"TABLE",value:new He("featureTable",[{name:"featureParams",type:"USHORT",value:r.featureParams}].concat(Zr("lookupListIndex",r.lookupListIndexes)))}]}))}$i.prototype=Object.create(He.prototype),$i.prototype.constructor=$i;function es(t,e){He.call(this,"lookupListTable",za("lookup",t,function(n){var r=e[n.lookupType];return Ie.assert(!!r,"Unable to write GSUB lookup type "+n.lookupType+" tables."),new He("lookupTable",[{name:"lookupType",type:"USHORT",value:n.lookupType},{name:"lookupFlag",type:"USHORT",value:n.lookupFlag}].concat(za("subtable",n.subtables,r)))}))}es.prototype=Object.create(He.prototype),es.prototype.constructor=es;var he={Table:He,Record:He,Coverage:Ji,ScriptList:Hi,FeatureList:$i,LookupList:es,ushortList:Zr,tableList:za,recordList:Jr};function Cc(t,e){return t.getUint8(e)}function ts(t,e){return t.getUint16(e,!1)}function K2(t,e){return t.getInt16(e,!1)}function Wa(t,e){return t.getUint32(e,!1)}function Ic(t,e){var n=t.getInt16(e,!1),r=t.getUint16(e+2,!1);return n+r/65535}function X2(t,e){for(var n="",r=e;r<e+4;r+=1)n+=String.fromCharCode(t.getInt8(r));return n}function Z2(t,e,n){for(var r=0,i=0;i<n;i+=1)r<<=8,r+=t.getUint8(e+i);return r}function J2(t,e,n){for(var r=[],i=e;i<n;i+=1)r.push(t.getUint8(i));return r}function H2(t){for(var e="",n=0;n<t.length;n+=1)e+=String.fromCharCode(t[n]);return e}var $2={byte:1,uShort:2,short:2,uLong:4,fixed:4,longDateTime:8,tag:4};function W(t,e){this.data=t,this.offset=e,this.relativeOffset=0}W.prototype.parseByte=function(){var t=this.data.getUint8(this.offset+this.relativeOffset);return this.relativeOffset+=1,t},W.prototype.parseChar=function(){var t=this.data.getInt8(this.offset+this.relativeOffset);return this.relativeOffset+=1,t},W.prototype.parseCard8=W.prototype.parseByte,W.prototype.parseUShort=function(){var t=this.data.getUint16(this.offset+this.relativeOffset);return this.relativeOffset+=2,t},W.prototype.parseCard16=W.prototype.parseUShort,W.prototype.parseSID=W.prototype.parseUShort,W.prototype.parseOffset16=W.prototype.parseUShort,W.prototype.parseShort=function(){var t=this.data.getInt16(this.offset+this.relativeOffset);return this.relativeOffset+=2,t},W.prototype.parseF2Dot14=function(){var t=this.data.getInt16(this.offset+this.relativeOffset)/16384;return this.relativeOffset+=2,t},W.prototype.parseULong=function(){var t=Wa(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,t},W.prototype.parseOffset32=W.prototype.parseULong,W.prototype.parseFixed=function(){var t=Ic(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,t},W.prototype.parseString=function(t){var e=this.data,n=this.offset+this.relativeOffset,r="";this.relativeOffset+=t;for(var i=0;i<t;i++)r+=String.fromCharCode(e.getUint8(n+i));return r},W.prototype.parseTag=function(){return this.parseString(4)},W.prototype.parseLongDateTime=function(){var t=Wa(this.data,this.offset+this.relativeOffset+4);return t-=2082844800,this.relativeOffset+=8,t},W.prototype.parseVersion=function(t){var e=ts(this.data,this.offset+this.relativeOffset),n=ts(this.data,this.offset+this.relativeOffset+2);return this.relativeOffset+=4,t===void 0&&(t=4096),e+n/t/10},W.prototype.skip=function(t,e){e===void 0&&(e=1),this.relativeOffset+=$2[t]*e},W.prototype.parseULongList=function(t){t===void 0&&(t=this.parseULong());for(var e=new Array(t),n=this.data,r=this.offset+this.relativeOffset,i=0;i<t;i++)e[i]=n.getUint32(r),r+=4;return this.relativeOffset+=t*4,e},W.prototype.parseOffset16List=W.prototype.parseUShortList=function(t){t===void 0&&(t=this.parseUShort());for(var e=new Array(t),n=this.data,r=this.offset+this.relativeOffset,i=0;i<t;i++)e[i]=n.getUint16(r),r+=2;return this.relativeOffset+=t*2,e},W.prototype.parseShortList=function(t){for(var e=new Array(t),n=this.data,r=this.offset+this.relativeOffset,i=0;i<t;i++)e[i]=n.getInt16(r),r+=2;return this.relativeOffset+=t*2,e},W.prototype.parseByteList=function(t){for(var e=new Array(t),n=this.data,r=this.offset+this.relativeOffset,i=0;i<t;i++)e[i]=n.getUint8(r++);return this.relativeOffset+=t,e},W.prototype.parseList=function(t,e){e||(e=t,t=this.parseUShort());for(var n=new Array(t),r=0;r<t;r++)n[r]=e.call(this);return n},W.prototype.parseList32=function(t,e){e||(e=t,t=this.parseULong());for(var n=new Array(t),r=0;r<t;r++)n[r]=e.call(this);return n},W.prototype.parseRecordList=function(t,e){e||(e=t,t=this.parseUShort());for(var n=new Array(t),r=Object.keys(e),i=0;i<t;i++){for(var s={},a=0;a<r.length;a++){var o=r[a],l=e[o];s[o]=l.call(this)}n[i]=s}return n},W.prototype.parseRecordList32=function(t,e){e||(e=t,t=this.parseULong());for(var n=new Array(t),r=Object.keys(e),i=0;i<t;i++){for(var s={},a=0;a<r.length;a++){var o=r[a],l=e[o];s[o]=l.call(this)}n[i]=s}return n},W.prototype.parseStruct=function(t){if(typeof t=="function")return t.call(this);for(var e=Object.keys(t),n={},r=0;r<e.length;r++){var i=e[r],s=t[i];n[i]=s.call(this)}return n},W.prototype.parseValueRecord=function(t){if(t===void 0&&(t=this.parseUShort()),t!==0){var e={};return t&1&&(e.xPlacement=this.parseShort()),t&2&&(e.yPlacement=this.parseShort()),t&4&&(e.xAdvance=this.parseShort()),t&8&&(e.yAdvance=this.parseShort()),t&16&&(e.xPlaDevice=void 0,this.parseShort()),t&32&&(e.yPlaDevice=void 0,this.parseShort()),t&64&&(e.xAdvDevice=void 0,this.parseShort()),t&128&&(e.yAdvDevice=void 0,this.parseShort()),e}},W.prototype.parseValueRecordList=function(){for(var t=this.parseUShort(),e=this.parseUShort(),n=new Array(e),r=0;r<e;r++)n[r]=this.parseValueRecord(t);return n},W.prototype.parsePointer=function(t){var e=this.parseOffset16();if(e>0)return new W(this.data,this.offset+e).parseStruct(t)},W.prototype.parsePointer32=function(t){var e=this.parseOffset32();if(e>0)return new W(this.data,this.offset+e).parseStruct(t)},W.prototype.parseListOfLists=function(t){for(var e=this.parseOffset16List(),n=e.length,r=this.relativeOffset,i=new Array(n),s=0;s<n;s++){var a=e[s];if(a===0){i[s]=void 0;continue}if(this.relativeOffset=a,t){for(var o=this.parseOffset16List(),l=new Array(o.length),h=0;h<o.length;h++)this.relativeOffset=a+o[h],l[h]=t.call(this);i[s]=l}else i[s]=this.parseUShortList()}return this.relativeOffset=r,i},W.prototype.parseCoverage=function(){var t=this.offset+this.relativeOffset,e=this.parseUShort(),n=this.parseUShort();if(e===1)return{format:1,glyphs:this.parseUShortList(n)};if(e===2){for(var r=new Array(n),i=0;i<n;i++)r[i]={start:this.parseUShort(),end:this.parseUShort(),index:this.parseUShort()};return{format:2,ranges:r}}throw new Error("0x"+t.toString(16)+": Coverage format must be 1 or 2.")},W.prototype.parseClassDef=function(){var t=this.offset+this.relativeOffset,e=this.parseUShort();if(e===1)return{format:1,startGlyph:this.parseUShort(),classes:this.parseUShortList()};if(e===2)return{format:2,ranges:this.parseRecordList({start:W.uShort,end:W.uShort,classId:W.uShort})};throw new Error("0x"+t.toString(16)+": ClassDef format must be 1 or 2.")},W.list=function(t,e){return function(){return this.parseList(t,e)}},W.list32=function(t,e){return function(){return this.parseList32(t,e)}},W.recordList=function(t,e){return function(){return this.parseRecordList(t,e)}},W.recordList32=function(t,e){return function(){return this.parseRecordList32(t,e)}},W.pointer=function(t){return function(){return this.parsePointer(t)}},W.pointer32=function(t){return function(){return this.parsePointer32(t)}},W.tag=W.prototype.parseTag,W.byte=W.prototype.parseByte,W.uShort=W.offset16=W.prototype.parseUShort,W.uShortList=W.prototype.parseUShortList,W.uLong=W.offset32=W.prototype.parseULong,W.uLongList=W.prototype.parseULongList,W.struct=W.prototype.parseStruct,W.coverage=W.prototype.parseCoverage,W.classDef=W.prototype.parseClassDef;var xc={reserved:W.uShort,reqFeatureIndex:W.uShort,featureIndexes:W.uShortList};W.prototype.parseScriptList=function(){return this.parsePointer(W.recordList({tag:W.tag,script:W.pointer({defaultLangSys:W.pointer(xc),langSysRecords:W.recordList({tag:W.tag,langSys:W.pointer(xc)})})}))||[]},W.prototype.parseFeatureList=function(){return this.parsePointer(W.recordList({tag:W.tag,feature:W.pointer({featureParams:W.offset16,lookupListIndexes:W.uShortList})}))||[]},W.prototype.parseLookupList=function(t){return this.parsePointer(W.list(W.pointer(function(){var e=this.parseUShort();Ie.argument(1<=e&&e<=9,"GPOS/GSUB lookup type "+e+" unknown.");var n=this.parseUShort(),r=n&16;return{lookupType:e,lookupFlag:n,subtables:this.parseList(W.pointer(t[e])),markFilteringSet:r?this.parseUShort():void 0}})))||[]},W.prototype.parseFeatureVariationsList=function(){return this.parsePointer32(function(){var t=this.parseUShort(),e=this.parseUShort();Ie.argument(t===1&&e<1,"GPOS/GSUB feature variations table unknown.");var n=this.parseRecordList32({conditionSetOffset:W.offset32,featureTableSubstitutionOffset:W.offset32});return n})||[]};var xe={getByte:Cc,getCard8:Cc,getUShort:ts,getCard16:ts,getShort:K2,getULong:Wa,getFixed:Ic,getTag:X2,getOffset:Z2,getBytes:J2,bytesToString:H2,Parser:W};function eA(t,e){e.parseUShort(),t.length=e.parseULong(),t.language=e.parseULong();var n;t.groupCount=n=e.parseULong(),t.glyphIndexMap={};for(var r=0;r<n;r+=1)for(var i=e.parseULong(),s=e.parseULong(),a=e.parseULong(),o=i;o<=s;o+=1)t.glyphIndexMap[o]=a,a++}function tA(t,e,n,r,i){t.length=e.parseUShort(),t.language=e.parseUShort();var s;t.segCount=s=e.parseUShort()>>1,e.skip("uShort",3),t.glyphIndexMap={};for(var a=new xe.Parser(n,r+i+14),o=new xe.Parser(n,r+i+16+s*2),l=new xe.Parser(n,r+i+16+s*4),h=new xe.Parser(n,r+i+16+s*6),u=r+i+16+s*8,A=0;A<s-1;A+=1)for(var f=void 0,d=a.parseUShort(),m=o.parseUShort(),y=l.parseShort(),C=h.parseUShort(),x=m;x<=d;x+=1)C!==0?(u=h.offset+h.relativeOffset-2,u+=C,u+=(x-m)*2,f=xe.getUShort(n,u),f!==0&&(f=f+y&65535)):f=x+y&65535,t.glyphIndexMap[x]=f}function nA(t,e){var n={};n.version=xe.getUShort(t,e),Ie.argument(n.version===0,"cmap table version should be 0."),n.numTables=xe.getUShort(t,e+2);for(var r=-1,i=n.numTables-1;i>=0;i-=1){var s=xe.getUShort(t,e+4+i*8),a=xe.getUShort(t,e+4+i*8+2);if(s===3&&(a===0||a===1||a===10)||s===0&&(a===0||a===1||a===2||a===3||a===4)){r=xe.getULong(t,e+4+i*8+4);break}}if(r===-1)throw new Error("No valid cmap sub-tables found.");var o=new xe.Parser(t,e+r);if(n.format=o.parseUShort(),n.format===12)eA(n,o);else if(n.format===4)tA(n,o,t,e,r);else throw new Error("Only format 4 and 12 cmap tables are supported (found format "+n.format+").");return n}function rA(t,e,n){t.segments.push({end:e,start:e,delta:-(e-n),offset:0,glyphIndex:n})}function iA(t){t.segments.push({end:65535,start:65535,delta:1,offset:0})}function sA(t){var e=!0,n;for(n=t.length-1;n>0;n-=1){var r=t.get(n);if(r.unicode>65535){console.log("Adding CMAP format 12 (needed!)"),e=!1;break}}var i=[{name:"version",type:"USHORT",value:0},{name:"numTables",type:"USHORT",value:e?1:2},{name:"platformID",type:"USHORT",value:3},{name:"encodingID",type:"USHORT",value:1},{name:"offset",type:"ULONG",value:e?12:12+8}];e||(i=i.concat([{name:"cmap12PlatformID",type:"USHORT",value:3},{name:"cmap12EncodingID",type:"USHORT",value:10},{name:"cmap12Offset",type:"ULONG",value:0}])),i=i.concat([{name:"format",type:"USHORT",value:4},{name:"cmap4Length",type:"USHORT",value:0},{name:"language",type:"USHORT",value:0},{name:"segCountX2",type:"USHORT",value:0},{name:"searchRange",type:"USHORT",value:0},{name:"entrySelector",type:"USHORT",value:0},{name:"rangeShift",type:"USHORT",value:0}]);var s=new he.Table("cmap",i);for(s.segments=[],n=0;n<t.length;n+=1){for(var a=t.get(n),o=0;o<a.unicodes.length;o+=1)rA(s,a.unicodes[o],n);s.segments=s.segments.sort(function(I,g){return I.start-g.start})}iA(s);var l=s.segments.length,h=0,u=[],A=[],f=[],d=[],m=[],y=[];for(n=0;n<l;n+=1){var C=s.segments[n];C.end<=65535&&C.start<=65535?(u=u.concat({name:"end_"+n,type:"USHORT",value:C.end}),A=A.concat({name:"start_"+n,type:"USHORT",value:C.start}),f=f.concat({name:"idDelta_"+n,type:"SHORT",value:C.delta}),d=d.concat({name:"idRangeOffset_"+n,type:"USHORT",value:C.offset}),C.glyphId!==void 0&&(m=m.concat({name:"glyph_"+n,type:"USHORT",value:C.glyphId}))):h+=1,!e&&C.glyphIndex!==void 0&&(y=y.concat({name:"cmap12Start_"+n,type:"ULONG",value:C.start}),y=y.concat({name:"cmap12End_"+n,type:"ULONG",value:C.end}),y=y.concat({name:"cmap12Glyph_"+n,type:"ULONG",value:C.glyphIndex}))}if(s.segCountX2=(l-h)*2,s.searchRange=Math.pow(2,Math.floor(Math.log(l-h)/Math.log(2)))*2,s.entrySelector=Math.log(s.searchRange/2)/Math.log(2),s.rangeShift=s.segCountX2-s.searchRange,s.fields=s.fields.concat(u),s.fields.push({name:"reservedPad",type:"USHORT",value:0}),s.fields=s.fields.concat(A),s.fields=s.fields.concat(f),s.fields=s.fields.concat(d),s.fields=s.fields.concat(m),s.cmap4Length=14+u.length*2+2+A.length*2+f.length*2+d.length*2+m.length*2,!e){var x=16+y.length*4;s.cmap12Offset=12+2*2+4+s.cmap4Length,s.fields=s.fields.concat([{name:"cmap12Format",type:"USHORT",value:12},{name:"cmap12Reserved",type:"USHORT",value:0},{name:"cmap12Length",type:"ULONG",value:x},{name:"cmap12Language",type:"ULONG",value:0},{name:"cmap12nGroups",type:"ULONG",value:y.length/3}]),s.fields=s.fields.concat(y)}return s}var aA={parse:nA,make:sA},ns=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","266 ff","onedotenleader","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall","001.000","001.001","001.002","001.003","Black","Bold","Book","Light","Medium","Regular","Roman","Semibold"],oA=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","","endash","dagger","daggerdbl","periodcentered","","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","","questiondown","","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","","ring","cedilla","","hungarumlaut","ogonek","caron","emdash","","","","","","","","","","","","","","","","","AE","","ordfeminine","","","","","Lslash","Oslash","OE","ordmasculine","","","","","","ae","","","","dotlessi","","","lslash","oslash","oe","germandbls"],lA=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],Sc=[".notdef",".null","nonmarkingreturn","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","Adieresis","Aring","Ccedilla","Eacute","Ntilde","Odieresis","Udieresis","aacute","agrave","acircumflex","adieresis","atilde","aring","ccedilla","eacute","egrave","ecircumflex","edieresis","iacute","igrave","icircumflex","idieresis","ntilde","oacute","ograve","ocircumflex","odieresis","otilde","uacute","ugrave","ucircumflex","udieresis","dagger","degree","cent","sterling","section","bullet","paragraph","germandbls","registered","copyright","trademark","acute","dieresis","notequal","AE","Oslash","infinity","plusminus","lessequal","greaterequal","yen","mu","partialdiff","summation","product","pi","integral","ordfeminine","ordmasculine","Omega","ae","oslash","questiondown","exclamdown","logicalnot","radical","florin","approxequal","Delta","guillemotleft","guillemotright","ellipsis","nonbreakingspace","Agrave","Atilde","Otilde","OE","oe","endash","emdash","quotedblleft","quotedblright","quoteleft","quoteright","divide","lozenge","ydieresis","Ydieresis","fraction","currency","guilsinglleft","guilsinglright","fi","fl","daggerdbl","periodcentered","quotesinglbase","quotedblbase","perthousand","Acircumflex","Ecircumflex","Aacute","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Oacute","Ocircumflex","apple","Ograve","Uacute","Ucircumflex","Ugrave","dotlessi","circumflex","tilde","macron","breve","dotaccent","ring","cedilla","hungarumlaut","ogonek","caron","Lslash","lslash","Scaron","scaron","Zcaron","zcaron","brokenbar","Eth","eth","Yacute","yacute","Thorn","thorn","minus","multiply","onesuperior","twosuperior","threesuperior","onehalf","onequarter","threequarters","franc","Gbreve","gbreve","Idotaccent","Scedilla","scedilla","Cacute","cacute","Ccaron","ccaron","dcroat"];function Bc(t){this.font=t}Bc.prototype.charToGlyphIndex=function(t){var e=t.codePointAt(0),n=this.font.glyphs;if(n){for(var r=0;r<n.length;r+=1)for(var i=n.get(r),s=0;s<i.unicodes.length;s+=1)if(i.unicodes[s]===e)return r}return null};function rs(t,e){this.encoding=t,this.charset=e}rs.prototype.charToGlyphIndex=function(t){var e=t.codePointAt(0),n=this.encoding[e];return this.charset.indexOf(n)};function cA(t,e,n,r,i){t.beginPath(),t.moveTo(e,n),t.lineTo(r,i),t.stroke()}var er={line:cA};function hA(t,e){var n=e||new Ke;return{configurable:!0,get:function(){return typeof n=="function"&&(n=n()),n},set:function(r){n=r}}}function wt(t){this.bindConstructorValues(t)}wt.prototype.bindConstructorValues=function(t){this.index=t.index||0,this.name=t.name||null,this.unicode=t.unicode||void 0,this.unicodes=t.unicodes||t.unicode!==void 0?[t.unicode]:[],"xMin"in t&&(this.xMin=t.xMin),"yMin"in t&&(this.yMin=t.yMin),"xMax"in t&&(this.xMax=t.xMax),"yMax"in t&&(this.yMax=t.yMax),"advanceWidth"in t&&(this.advanceWidth=t.advanceWidth),Object.defineProperty(this,"path",hA(this,t.path))},wt.prototype.addUnicode=function(t){this.unicodes.length===0&&(this.unicode=t),this.unicodes.push(t)},wt.prototype.getBoundingBox=function(){return this.path.getBoundingBox()},wt.prototype.getPath=function(t,e,n,r,i){t=t!==void 0?t:0,e=e!==void 0?e:0,n=n!==void 0?n:72;var s,a;r||(r={});var o=r.xScale,l=r.yScale;if(r.hinting&&i&&i.hinting&&(a=this.path&&i.hinting.exec(this,n)),a)s=i.hinting.getCommands(a),t=Math.round(t),e=Math.round(e),o=l=1;else{s=this.path.commands;var h=1/(this.path.unitsPerEm||1e3)*n;o===void 0&&(o=h),l===void 0&&(l=h)}for(var u=new Ke,A=0;A<s.length;A+=1){var f=s[A];f.type==="M"?u.moveTo(t+f.x*o,e+-f.y*l):f.type==="L"?u.lineTo(t+f.x*o,e+-f.y*l):f.type==="Q"?u.quadraticCurveTo(t+f.x1*o,e+-f.y1*l,t+f.x*o,e+-f.y*l):f.type==="C"?u.curveTo(t+f.x1*o,e+-f.y1*l,t+f.x2*o,e+-f.y2*l,t+f.x*o,e+-f.y*l):f.type==="Z"&&u.closePath()}return u},wt.prototype.getContours=function(){if(this.points===void 0)return[];for(var t=[],e=[],n=0;n<this.points.length;n+=1){var r=this.points[n];e.push(r),r.lastPointOfContour&&(t.push(e),e=[])}return Ie.argument(e.length===0,"There are still points left in the current contour."),t},wt.prototype.getMetrics=function(){for(var t=this.path.commands,e=[],n=[],r=0;r<t.length;r+=1){var i=t[r];i.type!=="Z"&&(e.push(i.x),n.push(i.y)),(i.type==="Q"||i.type==="C")&&(e.push(i.x1),n.push(i.y1)),i.type==="C"&&(e.push(i.x2),n.push(i.y2))}var s={xMin:Math.min.apply(null,e),yMin:Math.min.apply(null,n),xMax:Math.max.apply(null,e),yMax:Math.max.apply(null,n),leftSideBearing:this.leftSideBearing};return isFinite(s.xMin)||(s.xMin=0),isFinite(s.xMax)||(s.xMax=this.advanceWidth),isFinite(s.yMin)||(s.yMin=0),isFinite(s.yMax)||(s.yMax=0),s.rightSideBearing=this.advanceWidth-s.leftSideBearing-(s.xMax-s.xMin),s},wt.prototype.draw=function(t,e,n,r,i){this.getPath(e,n,r,i).draw(t)},wt.prototype.drawPoints=function(t,e,n,r){function i(A,f,d,m){t.beginPath();for(var y=0;y<A.length;y+=1)t.moveTo(f+A[y].x*m,d+A[y].y*m),t.arc(f+A[y].x*m,d+A[y].y*m,2,0,Math.PI*2,!1);t.closePath(),t.fill()}e=e!==void 0?e:0,n=n!==void 0?n:0,r=r!==void 0?r:24;for(var s=1/this.path.unitsPerEm*r,a=[],o=[],l=this.path,h=0;h<l.commands.length;h+=1){var u=l.commands[h];u.x!==void 0&&a.push({x:u.x,y:-u.y}),u.x1!==void 0&&o.push({x:u.x1,y:-u.y1}),u.x2!==void 0&&o.push({x:u.x2,y:-u.y2})}t.fillStyle="blue",i(a,e,n,s),t.fillStyle="red",i(o,e,n,s)},wt.prototype.drawMetrics=function(t,e,n,r){var i;e=e!==void 0?e:0,n=n!==void 0?n:0,r=r!==void 0?r:24,i=1/this.path.unitsPerEm*r,t.lineWidth=1,t.strokeStyle="black",er.line(t,e,-1e4,e,1e4),er.line(t,-1e4,n,1e4,n);var s=this.xMin||0,a=this.yMin||0,o=this.xMax||0,l=this.yMax||0,h=this.advanceWidth||0;t.strokeStyle="blue",er.line(t,e+s*i,-1e4,e+s*i,1e4),er.line(t,e+o*i,-1e4,e+o*i,1e4),er.line(t,-1e4,n+-a*i,1e4,n+-a*i),er.line(t,-1e4,n+-l*i,1e4,n+-l*i),t.strokeStyle="green",er.line(t,e+h*i,-1e4,e+h*i,1e4)};function is(t,e,n){Object.defineProperty(t,e,{get:function(){return t.path,t[n]},set:function(r){t[n]=r},enumerable:!0,configurable:!0})}function Ya(t,e){if(this.font=t,this.glyphs={},Array.isArray(e))for(var n=0;n<e.length;n++){var r=e[n];r.path.unitsPerEm=t.unitsPerEm,this.glyphs[n]=r}this.length=e&&e.length||0}Ya.prototype.get=function(t){if(this.glyphs[t]===void 0){this.font._push(t),typeof this.glyphs[t]=="function"&&(this.glyphs[t]=this.glyphs[t]());var e=this.glyphs[t],n=this.font._IndexToUnicodeMap[t];if(n)for(var r=0;r<n.unicodes.length;r++)e.addUnicode(n.unicodes[r]);this.font.cffEncoding?this.font.isCIDFont?e.name="gid"+t:e.name=this.font.cffEncoding.charset[t]:this.font.glyphNames.names&&(e.name=this.font.glyphNames.glyphIndexToName(t)),this.glyphs[t].advanceWidth=this.font._hmtxTableData[t].advanceWidth,this.glyphs[t].leftSideBearing=this.font._hmtxTableData[t].leftSideBearing}else typeof this.glyphs[t]=="function"&&(this.glyphs[t]=this.glyphs[t]());return this.glyphs[t]},Ya.prototype.push=function(t,e){this.glyphs[t]=e,this.length++};function uA(t,e){return new wt({index:e,font:t})}function AA(t,e,n,r,i,s){return function(){var a=new wt({index:e,font:t});return a.path=function(){n(a,r,i);var o=s(t.glyphs,a);return o.unitsPerEm=t.unitsPerEm,o},is(a,"xMin","_xMin"),is(a,"xMax","_xMax"),is(a,"yMin","_yMin"),is(a,"yMax","_yMax"),a}}function fA(t,e,n,r){return function(){var i=new wt({index:e,font:t});return i.path=function(){var s=n(t,i,r);return s.unitsPerEm=t.unitsPerEm,s},i}}var Kt={GlyphSet:Ya,glyphLoader:uA,ttfGlyphLoader:AA,cffGlyphLoader:fA};function wc(t,e){if(t===e)return!0;if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return!1;for(var n=0;n<t.length;n+=1)if(!wc(t[n],e[n]))return!1;return!0}else return!1}function ja(t){var e;return t.length<1240?e=107:t.length<33900?e=1131:e=32768,e}function Pn(t,e,n){var r=[],i=[],s=xe.getCard16(t,e),a,o;if(s!==0){var l=xe.getByte(t,e+2);a=e+(s+1)*l+2;for(var h=e+3,u=0;u<s+1;u+=1)r.push(xe.getOffset(t,h,l)),h+=l;o=a+r[s]}else o=e+2;for(var A=0;A<r.length-1;A+=1){var f=xe.getBytes(t,a+r[A],a+r[A+1]);n&&(f=n(f)),i.push(f)}return{objects:i,startOffset:e,endOffset:o}}function dA(t,e){var n=[],r=xe.getCard16(t,e),i,s;if(r!==0){var a=xe.getByte(t,e+2);i=e+(r+1)*a+2;for(var o=e+3,l=0;l<r+1;l+=1)n.push(xe.getOffset(t,o,a)),o+=a;s=i+n[r]}else s=e+2;return{offsets:n,startOffset:e,endOffset:s}}function pA(t,e,n,r,i){var s=xe.getCard16(n,r),a=0;if(s!==0){var o=xe.getByte(n,r+2);a=r+(s+1)*o+2}var l=xe.getBytes(n,a+e[t],a+e[t+1]);return i&&(l=i(l)),l}function gA(t){for(var e="",n=15,r=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];;){var i=t.parseByte(),s=i>>4,a=i&15;if(s===n||(e+=r[s],a===n))break;e+=r[a]}return parseFloat(e)}function mA(t,e){var n,r,i,s;if(e===28)return n=t.parseByte(),r=t.parseByte(),n<<8|r;if(e===29)return n=t.parseByte(),r=t.parseByte(),i=t.parseByte(),s=t.parseByte(),n<<24|r<<16|i<<8|s;if(e===30)return gA(t);if(e>=32&&e<=246)return e-139;if(e>=247&&e<=250)return n=t.parseByte(),(e-247)*256+n+108;if(e>=251&&e<=254)return n=t.parseByte(),-(e-251)*256-n-108;throw new Error("Invalid b0 "+e)}function vA(t){for(var e={},n=0;n<t.length;n+=1){var r=t[n][0],i=t[n][1],s=void 0;if(i.length===1?s=i[0]:s=i,e.hasOwnProperty(r)&&!isNaN(e[r]))throw new Error("Object "+e+" already has key "+r);e[r]=s}return e}function bc(t,e,n){e=e!==void 0?e:0;var r=new xe.Parser(t,e),i=[],s=[];for(n=n!==void 0?n:t.length;r.relativeOffset<n;){var a=r.parseByte();a<=21?(a===12&&(a=1200+r.parseByte()),i.push([a,s]),s=[]):s.push(mA(r,a))}return vA(i)}function Hr(t,e){return e<=390?e=ns[e]:e=t[e-391],e}function _c(t,e,n){for(var r={},i,s=0;s<e.length;s+=1){var a=e[s];if(Array.isArray(a.type)){var o=[];o.length=a.type.length;for(var l=0;l<a.type.length;l++)i=t[a.op]!==void 0?t[a.op][l]:void 0,i===void 0&&(i=a.value!==void 0&&a.value[l]!==void 0?a.value[l]:null),a.type[l]==="SID"&&(i=Hr(n,i)),o[l]=i;r[a.name]=o}else i=t[a.op],i===void 0&&(i=a.value!==void 0?a.value:null),a.type==="SID"&&(i=Hr(n,i)),r[a.name]=i}return r}function yA(t,e){var n={};return n.formatMajor=xe.getCard8(t,e),n.formatMinor=xe.getCard8(t,e+1),n.size=xe.getCard8(t,e+2),n.offsetSize=xe.getCard8(t,e+3),n.startOffset=e,n.endOffset=e+4,n}var Ec=[{name:"version",op:0,type:"SID"},{name:"notice",op:1,type:"SID"},{name:"copyright",op:1200,type:"SID"},{name:"fullName",op:2,type:"SID"},{name:"familyName",op:3,type:"SID"},{name:"weight",op:4,type:"SID"},{name:"isFixedPitch",op:1201,type:"number",value:0},{name:"italicAngle",op:1202,type:"number",value:0},{name:"underlinePosition",op:1203,type:"number",value:-100},{name:"underlineThickness",op:1204,type:"number",value:50},{name:"paintType",op:1205,type:"number",value:0},{name:"charstringType",op:1206,type:"number",value:2},{name:"fontMatrix",op:1207,type:["real","real","real","real","real","real"],value:[.001,0,0,.001,0,0]},{name:"uniqueId",op:13,type:"number"},{name:"fontBBox",op:5,type:["number","number","number","number"],value:[0,0,0,0]},{name:"strokeWidth",op:1208,type:"number",value:0},{name:"xuid",op:14,type:[],value:null},{name:"charset",op:15,type:"offset",value:0},{name:"encoding",op:16,type:"offset",value:0},{name:"charStrings",op:17,type:"offset",value:0},{name:"private",op:18,type:["number","offset"],value:[0,0]},{name:"ros",op:1230,type:["SID","SID","number"]},{name:"cidFontVersion",op:1231,type:"number",value:0},{name:"cidFontRevision",op:1232,type:"number",value:0},{name:"cidFontType",op:1233,type:"number",value:0},{name:"cidCount",op:1234,type:"number",value:8720},{name:"uidBase",op:1235,type:"number"},{name:"fdArray",op:1236,type:"offset"},{name:"fdSelect",op:1237,type:"offset"},{name:"fontName",op:1238,type:"SID"}],Tc=[{name:"subrs",op:19,type:"offset",value:0},{name:"defaultWidthX",op:20,type:"number",value:0},{name:"nominalWidthX",op:21,type:"number",value:0}];function CA(t,e){var n=bc(t,0,t.byteLength);return _c(n,Ec,e)}function Mc(t,e,n,r){var i=bc(t,e,n);return _c(i,Tc,r)}function Dc(t,e,n,r){for(var i=[],s=0;s<n.length;s+=1){var a=new DataView(new Uint8Array(n[s]).buffer),o=CA(a,r);o._subrs=[],o._subrsBias=0,o._defaultWidthX=0,o._nominalWidthX=0;var l=o.private[0],h=o.private[1];if(l!==0&&h!==0){var u=Mc(t,h+e,l,r);if(o._defaultWidthX=u.defaultWidthX,o._nominalWidthX=u.nominalWidthX,u.subrs!==0){var A=h+u.subrs,f=Pn(t,A+e);o._subrs=f.objects,o._subrsBias=ja(o._subrs)}o._privateDict=u}i.push(o)}return i}function IA(t,e,n,r){var i,s,a=new xe.Parser(t,e);n-=1;var o=[".notdef"],l=a.parseCard8();if(l===0)for(var h=0;h<n;h+=1)i=a.parseSID(),o.push(Hr(r,i));else if(l===1)for(;o.length<=n;){i=a.parseSID(),s=a.parseCard8();for(var u=0;u<=s;u+=1)o.push(Hr(r,i)),i+=1}else if(l===2)for(;o.length<=n;){i=a.parseSID(),s=a.parseCard16();for(var A=0;A<=s;A+=1)o.push(Hr(r,i)),i+=1}else throw new Error("Unknown charset format "+l);return o}function xA(t,e,n){var r,i={},s=new xe.Parser(t,e),a=s.parseCard8();if(a===0)for(var o=s.parseCard8(),l=0;l<o;l+=1)r=s.parseCard8(),i[r]=l;else if(a===1){var h=s.parseCard8();r=1;for(var u=0;u<h;u+=1)for(var A=s.parseCard8(),f=s.parseCard8(),d=A;d<=A+f;d+=1)i[d]=r,r+=1}else throw new Error("Unknown encoding format "+a);return new rs(i,n)}function Lc(t,e,n){var r,i,s,a,o=new Ke,l=[],h=0,u=!1,A=!1,f=0,d=0,m,y,C,x;if(t.isCIDFont){var I=t.tables.cff.topDict._fdSelect[e.index],g=t.tables.cff.topDict._fdArray[I];m=g._subrs,y=g._subrsBias,C=g._defaultWidthX,x=g._nominalWidthX}else m=t.tables.cff.topDict._subrs,y=t.tables.cff.topDict._subrsBias,C=t.tables.cff.topDict._defaultWidthX,x=t.tables.cff.topDict._nominalWidthX;var v=C;function w(_,E){A&&o.closePath(),o.moveTo(_,E),A=!0}function b(){var _;_=l.length%2!==0,_&&!u&&(v=l.shift()+x),h+=l.length>>1,l.length=0,u=!0}function B(_){for(var E,T,L,R,V,Y,q,ne,X,G,H,Z,$=0;$<_.length;){var O=_[$];switch($+=1,O){case 1:b();break;case 3:b();break;case 4:l.length>1&&!u&&(v=l.shift()+x,u=!0),d+=l.pop(),w(f,d);break;case 5:for(;l.length>0;)f+=l.shift(),d+=l.shift(),o.lineTo(f,d);break;case 6:for(;l.length>0&&(f+=l.shift(),o.lineTo(f,d),l.length!==0);)d+=l.shift(),o.lineTo(f,d);break;case 7:for(;l.length>0&&(d+=l.shift(),o.lineTo(f,d),l.length!==0);)f+=l.shift(),o.lineTo(f,d);break;case 8:for(;l.length>0;)r=f+l.shift(),i=d+l.shift(),s=r+l.shift(),a=i+l.shift(),f=s+l.shift(),d=a+l.shift(),o.curveTo(r,i,s,a,f,d);break;case 10:V=l.pop()+y,Y=m[V],Y&&B(Y);break;case 11:return;case 12:switch(O=_[$],$+=1,O){case 35:r=f+l.shift(),i=d+l.shift(),s=r+l.shift(),a=i+l.shift(),q=s+l.shift(),ne=a+l.shift(),X=q+l.shift(),G=ne+l.shift(),H=X+l.shift(),Z=G+l.shift(),f=H+l.shift(),d=Z+l.shift(),l.shift(),o.curveTo(r,i,s,a,q,ne),o.curveTo(X,G,H,Z,f,d);break;case 34:r=f+l.shift(),i=d,s=r+l.shift(),a=i+l.shift(),q=s+l.shift(),ne=a,X=q+l.shift(),G=a,H=X+l.shift(),Z=d,f=H+l.shift(),o.curveTo(r,i,s,a,q,ne),o.curveTo(X,G,H,Z,f,d);break;case 36:r=f+l.shift(),i=d+l.shift(),s=r+l.shift(),a=i+l.shift(),q=s+l.shift(),ne=a,X=q+l.shift(),G=a,H=X+l.shift(),Z=G+l.shift(),f=H+l.shift(),o.curveTo(r,i,s,a,q,ne),o.curveTo(X,G,H,Z,f,d);break;case 37:r=f+l.shift(),i=d+l.shift(),s=r+l.shift(),a=i+l.shift(),q=s+l.shift(),ne=a+l.shift(),X=q+l.shift(),G=ne+l.shift(),H=X+l.shift(),Z=G+l.shift(),Math.abs(H-f)>Math.abs(Z-d)?f=H+l.shift():d=Z+l.shift(),o.curveTo(r,i,s,a,q,ne),o.curveTo(X,G,H,Z,f,d);break;default:console.log("Glyph "+e.index+": unknown operator 1200"+O),l.length=0}break;case 14:l.length>0&&!u&&(v=l.shift()+x,u=!0),A&&(o.closePath(),A=!1);break;case 18:b();break;case 19:case 20:b(),$+=h+7>>3;break;case 21:l.length>2&&!u&&(v=l.shift()+x,u=!0),d+=l.pop(),f+=l.pop(),w(f,d);break;case 22:l.length>1&&!u&&(v=l.shift()+x,u=!0),f+=l.pop(),w(f,d);break;case 23:b();break;case 24:for(;l.length>2;)r=f+l.shift(),i=d+l.shift(),s=r+l.shift(),a=i+l.shift(),f=s+l.shift(),d=a+l.shift(),o.curveTo(r,i,s,a,f,d);f+=l.shift(),d+=l.shift(),o.lineTo(f,d);break;case 25:for(;l.length>6;)f+=l.shift(),d+=l.shift(),o.lineTo(f,d);r=f+l.shift(),i=d+l.shift(),s=r+l.shift(),a=i+l.shift(),f=s+l.shift(),d=a+l.shift(),o.curveTo(r,i,s,a,f,d);break;case 26:for(l.length%2&&(f+=l.shift());l.length>0;)r=f,i=d+l.shift(),s=r+l.shift(),a=i+l.shift(),f=s,d=a+l.shift(),o.curveTo(r,i,s,a,f,d);break;case 27:for(l.length%2&&(d+=l.shift());l.length>0;)r=f+l.shift(),i=d,s=r+l.shift(),a=i+l.shift(),f=s+l.shift(),d=a,o.curveTo(r,i,s,a,f,d);break;case 28:E=_[$],T=_[$+1],l.push((E<<24|T<<16)>>16),$+=2;break;case 29:V=l.pop()+t.gsubrsBias,Y=t.gsubrs[V],Y&&B(Y);break;case 30:for(;l.length>0&&(r=f,i=d+l.shift(),s=r+l.shift(),a=i+l.shift(),f=s+l.shift(),d=a+(l.length===1?l.shift():0),o.curveTo(r,i,s,a,f,d),l.length!==0);)r=f+l.shift(),i=d,s=r+l.shift(),a=i+l.shift(),d=a+l.shift(),f=s+(l.length===1?l.shift():0),o.curveTo(r,i,s,a,f,d);break;case 31:for(;l.length>0&&(r=f+l.shift(),i=d,s=r+l.shift(),a=i+l.shift(),d=a+l.shift(),f=s+(l.length===1?l.shift():0),o.curveTo(r,i,s,a,f,d),l.length!==0);)r=f,i=d+l.shift(),s=r+l.shift(),a=i+l.shift(),f=s+l.shift(),d=a+(l.length===1?l.shift():0),o.curveTo(r,i,s,a,f,d);break;default:O<32?console.log("Glyph "+e.index+": unknown operator "+O):O<247?l.push(O-139):O<251?(E=_[$],$+=1,l.push((O-247)*256+E+108)):O<255?(E=_[$],$+=1,l.push(-(O-251)*256-E-108)):(E=_[$],T=_[$+1],L=_[$+2],R=_[$+3],$+=4,l.push((E<<24|T<<16|L<<8|R)/65536))}}}return B(n),e.advanceWidth=v,o}function SA(t,e,n,r){var i=[],s,a=new xe.Parser(t,e),o=a.parseCard8();if(o===0)for(var l=0;l<n;l++){if(s=a.parseCard8(),s>=r)throw new Error("CFF table CID Font FDSelect has bad FD index value "+s+" (FD count "+r+")");i.push(s)}else if(o===3){var h=a.parseCard16(),u=a.parseCard16();if(u!==0)throw new Error("CFF Table CID Font FDSelect format 3 range has bad initial GID "+u);for(var A,f=0;f<h;f++){if(s=a.parseCard8(),A=a.parseCard16(),s>=r)throw new Error("CFF table CID Font FDSelect has bad FD index value "+s+" (FD count "+r+")");if(A>n)throw new Error("CFF Table CID Font FDSelect format 3 range has bad GID "+A);for(;u<A;u++)i.push(s);u=A}if(A!==n)throw new Error("CFF Table CID Font FDSelect format 3 range has bad final GID "+A)}else throw new Error("CFF Table CID Font FDSelect table has unsupported format "+o);return i}function BA(t,e,n,r){n.tables.cff={};var i=yA(t,e),s=Pn(t,i.endOffset,xe.bytesToString),a=Pn(t,s.endOffset),o=Pn(t,a.endOffset,xe.bytesToString),l=Pn(t,o.endOffset);n.gsubrs=l.objects,n.gsubrsBias=ja(n.gsubrs);var h=Dc(t,e,a.objects,o.objects);if(h.length!==1)throw new Error("CFF table has too many fonts in 'FontSet' - count of fonts NameIndex.length = "+h.length);var u=h[0];if(n.tables.cff.topDict=u,u._privateDict&&(n.defaultWidthX=u._privateDict.defaultWidthX,n.nominalWidthX=u._privateDict.nominalWidthX),u.ros[0]!==void 0&&u.ros[1]!==void 0&&(n.isCIDFont=!0),n.isCIDFont){var A=u.fdArray,f=u.fdSelect;if(A===0||f===0)throw new Error("Font is marked as a CID font, but FDArray and/or FDSelect information is missing");A+=e;var d=Pn(t,A),m=Dc(t,e,d.objects,o.objects);u._fdArray=m,f+=e,u._fdSelect=SA(t,f,n.numGlyphs,m.length)}var y=e+u.private[1],C=Mc(t,y,u.private[0],o.objects);if(n.defaultWidthX=C.defaultWidthX,n.nominalWidthX=C.nominalWidthX,C.subrs!==0){var x=y+C.subrs,I=Pn(t,x);n.subrs=I.objects,n.subrsBias=ja(n.subrs)}else n.subrs=[],n.subrsBias=0;var g;r.lowMemory?(g=dA(t,e+u.charStrings),n.nGlyphs=g.offsets.length):(g=Pn(t,e+u.charStrings),n.nGlyphs=g.objects.length);var v=IA(t,e+u.charset,n.nGlyphs,o.objects);if(u.encoding===0?n.cffEncoding=new rs(oA,v):u.encoding===1?n.cffEncoding=new rs(lA,v):n.cffEncoding=xA(t,e+u.encoding,v),n.encoding=n.encoding||n.cffEncoding,n.glyphs=new Kt.GlyphSet(n),r.lowMemory)n._push=function(B){var _=pA(B,g.offsets,t,e+u.charStrings);n.glyphs.push(B,Kt.cffGlyphLoader(n,B,Lc,_))};else for(var w=0;w<n.nGlyphs;w+=1){var b=g.objects[w];n.glyphs.push(w,Kt.cffGlyphLoader(n,w,Lc,b))}}function Pc(t,e){var n,r=ns.indexOf(t);return r>=0&&(n=r),r=e.indexOf(t),r>=0?n=r+ns.length:(n=ns.length+e.length,e.push(t)),n}function wA(){return new he.Record("Header",[{name:"major",type:"Card8",value:1},{name:"minor",type:"Card8",value:0},{name:"hdrSize",type:"Card8",value:4},{name:"major",type:"Card8",value:1}])}function bA(t){var e=new he.Record("Name INDEX",[{name:"names",type:"INDEX",value:[]}]);e.names=[];for(var n=0;n<t.length;n+=1)e.names.push({name:"name_"+n,type:"NAME",value:t[n]});return e}function Fc(t,e,n){for(var r={},i=0;i<t.length;i+=1){var s=t[i],a=e[s.name];a!==void 0&&!wc(a,s.value)&&(s.type==="SID"&&(a=Pc(a,n)),r[s.op]={name:s.name,type:s.type,value:a})}return r}function kc(t,e){var n=new he.Record("Top DICT",[{name:"dict",type:"DICT",value:{}}]);return n.dict=Fc(Ec,t,e),n}function Oc(t){var e=new he.Record("Top DICT INDEX",[{name:"topDicts",type:"INDEX",value:[]}]);return e.topDicts=[{name:"topDict_0",type:"TABLE",value:t}],e}function _A(t){var e=new he.Record("String INDEX",[{name:"strings",type:"INDEX",value:[]}]);e.strings=[];for(var n=0;n<t.length;n+=1)e.strings.push({name:"string_"+n,type:"STRING",value:t[n]});return e}function EA(){return new he.Record("Global Subr INDEX",[{name:"subrs",type:"INDEX",value:[]}])}function TA(t,e){for(var n=new he.Record("Charsets",[{name:"format",type:"Card8",value:0}]),r=0;r<t.length;r+=1){var i=t[r],s=Pc(i,e);n.fields.push({name:"glyph_"+r,type:"SID",value:s})}return n}function MA(t){var e=[],n=t.path;e.push({name:"width",type:"NUMBER",value:t.advanceWidth});for(var r=0,i=0,s=0;s<n.commands.length;s+=1){var a=void 0,o=void 0,l=n.commands[s];if(l.type==="Q"){var h=.3333333333333333,u=2/3;l={type:"C",x:l.x,y:l.y,x1:Math.round(h*r+u*l.x1),y1:Math.round(h*i+u*l.y1),x2:Math.round(h*l.x+u*l.x1),y2:Math.round(h*l.y+u*l.y1)}}if(l.type==="M")a=Math.round(l.x-r),o=Math.round(l.y-i),e.push({name:"dx",type:"NUMBER",value:a}),e.push({name:"dy",type:"NUMBER",value:o}),e.push({name:"rmoveto",type:"OP",value:21}),r=Math.round(l.x),i=Math.round(l.y);else if(l.type==="L")a=Math.round(l.x-r),o=Math.round(l.y-i),e.push({name:"dx",type:"NUMBER",value:a}),e.push({name:"dy",type:"NUMBER",value:o}),e.push({name:"rlineto",type:"OP",value:5}),r=Math.round(l.x),i=Math.round(l.y);else if(l.type==="C"){var A=Math.round(l.x1-r),f=Math.round(l.y1-i),d=Math.round(l.x2-l.x1),m=Math.round(l.y2-l.y1);a=Math.round(l.x-l.x2),o=Math.round(l.y-l.y2),e.push({name:"dx1",type:"NUMBER",value:A}),e.push({name:"dy1",type:"NUMBER",value:f}),e.push({name:"dx2",type:"NUMBER",value:d}),e.push({name:"dy2",type:"NUMBER",value:m}),e.push({name:"dx",type:"NUMBER",value:a}),e.push({name:"dy",type:"NUMBER",value:o}),e.push({name:"rrcurveto",type:"OP",value:8}),r=Math.round(l.x),i=Math.round(l.y)}}return e.push({name:"endchar",type:"OP",value:14}),e}function DA(t){for(var e=new he.Record("CharStrings INDEX",[{name:"charStrings",type:"INDEX",value:[]}]),n=0;n<t.length;n+=1){var r=t.get(n),i=MA(r);e.charStrings.push({name:r.name,type:"CHARSTRING",value:i})}return e}function LA(t,e){var n=new he.Record("Private DICT",[{name:"dict",type:"DICT",value:{}}]);return n.dict=Fc(Tc,t,e),n}function PA(t,e){for(var n=new he.Table("CFF ",[{name:"header",type:"RECORD"},{name:"nameIndex",type:"RECORD"},{name:"topDictIndex",type:"RECORD"},{name:"stringIndex",type:"RECORD"},{name:"globalSubrIndex",type:"RECORD"},{name:"charsets",type:"RECORD"},{name:"charStringsIndex",type:"RECORD"},{name:"privateDict",type:"RECORD"}]),r=1/e.unitsPerEm,i={version:e.version,fullName:e.fullName,familyName:e.familyName,weight:e.weightName,fontBBox:e.fontBBox||[0,0,0,0],fontMatrix:[r,0,0,r,0,0],charset:999,encoding:0,charStrings:999,private:[0,999]},s={},a=[],o,l=1;l<t.length;l+=1)o=t.get(l),a.push(o.name);var h=[];n.header=wA(),n.nameIndex=bA([e.postScriptName]);var u=kc(i,h);n.topDictIndex=Oc(u),n.globalSubrIndex=EA(),n.charsets=TA(a,h),n.charStringsIndex=DA(t),n.privateDict=LA(s,h),n.stringIndex=_A(h);var A=n.header.sizeOf()+n.nameIndex.sizeOf()+n.topDictIndex.sizeOf()+n.stringIndex.sizeOf()+n.globalSubrIndex.sizeOf();return i.charset=A,i.encoding=0,i.charStrings=i.charset+n.charsets.sizeOf(),i.private[1]=i.charStrings+n.charStringsIndex.sizeOf(),u=kc(i,h),n.topDictIndex=Oc(u),n}var FA={parse:BA,make:PA};function kA(t,e){var n={},r=new xe.Parser(t,e);return n.version=r.parseVersion(),n.fontRevision=Math.round(r.parseFixed()*1e3)/1e3,n.checkSumAdjustment=r.parseULong(),n.magicNumber=r.parseULong(),Ie.argument(n.magicNumber===1594834165,"Font header has wrong magic number."),n.flags=r.parseUShort(),n.unitsPerEm=r.parseUShort(),n.created=r.parseLongDateTime(),n.modified=r.parseLongDateTime(),n.xMin=r.parseShort(),n.yMin=r.parseShort(),n.xMax=r.parseShort(),n.yMax=r.parseShort(),n.macStyle=r.parseUShort(),n.lowestRecPPEM=r.parseUShort(),n.fontDirectionHint=r.parseShort(),n.indexToLocFormat=r.parseShort(),n.glyphDataFormat=r.parseShort(),n}function OA(t){var e=Math.round(new Date().getTime()/1e3)+2082844800,n=e;return t.createdTimestamp&&(n=t.createdTimestamp+2082844800),new he.Table("head",[{name:"version",type:"FIXED",value:65536},{name:"fontRevision",type:"FIXED",value:65536},{name:"checkSumAdjustment",type:"ULONG",value:0},{name:"magicNumber",type:"ULONG",value:1594834165},{name:"flags",type:"USHORT",value:0},{name:"unitsPerEm",type:"USHORT",value:1e3},{name:"created",type:"LONGDATETIME",value:n},{name:"modified",type:"LONGDATETIME",value:e},{name:"xMin",type:"SHORT",value:0},{name:"yMin",type:"SHORT",value:0},{name:"xMax",type:"SHORT",value:0},{name:"yMax",type:"SHORT",value:0},{name:"macStyle",type:"USHORT",value:0},{name:"lowestRecPPEM",type:"USHORT",value:0},{name:"fontDirectionHint",type:"SHORT",value:2},{name:"indexToLocFormat",type:"SHORT",value:0},{name:"glyphDataFormat",type:"SHORT",value:0}],t)}var RA={parse:kA,make:OA};function UA(t,e){var n={},r=new xe.Parser(t,e);return n.version=r.parseVersion(),n.ascender=r.parseShort(),n.descender=r.parseShort(),n.lineGap=r.parseShort(),n.advanceWidthMax=r.parseUShort(),n.minLeftSideBearing=r.parseShort(),n.minRightSideBearing=r.parseShort(),n.xMaxExtent=r.parseShort(),n.caretSlopeRise=r.parseShort(),n.caretSlopeRun=r.parseShort(),n.caretOffset=r.parseShort(),r.relativeOffset+=8,n.metricDataFormat=r.parseShort(),n.numberOfHMetrics=r.parseUShort(),n}function QA(t){return new he.Table("hhea",[{name:"version",type:"FIXED",value:65536},{name:"ascender",type:"FWORD",value:0},{name:"descender",type:"FWORD",value:0},{name:"lineGap",type:"FWORD",value:0},{name:"advanceWidthMax",type:"UFWORD",value:0},{name:"minLeftSideBearing",type:"FWORD",value:0},{name:"minRightSideBearing",type:"FWORD",value:0},{name:"xMaxExtent",type:"FWORD",value:0},{name:"caretSlopeRise",type:"SHORT",value:1},{name:"caretSlopeRun",type:"SHORT",value:0},{name:"caretOffset",type:"SHORT",value:0},{name:"reserved1",type:"SHORT",value:0},{name:"reserved2",type:"SHORT",value:0},{name:"reserved3",type:"SHORT",value:0},{name:"reserved4",type:"SHORT",value:0},{name:"metricDataFormat",type:"SHORT",value:0},{name:"numberOfHMetrics",type:"USHORT",value:0}],t)}var NA={parse:UA,make:QA};function GA(t,e,n,r,i){for(var s,a,o=new xe.Parser(t,e),l=0;l<r;l+=1){l<n&&(s=o.parseUShort(),a=o.parseShort());var h=i.get(l);h.advanceWidth=s,h.leftSideBearing=a}}function VA(t,e,n,r,i){t._hmtxTableData={};for(var s,a,o=new xe.Parser(e,n),l=0;l<i;l+=1)l<r&&(s=o.parseUShort(),a=o.parseShort()),t._hmtxTableData[l]={advanceWidth:s,leftSideBearing:a}}function zA(t,e,n,r,i,s,a){a.lowMemory?VA(t,e,n,r,i):GA(e,n,r,i,s)}function WA(t){for(var e=new he.Table("hmtx",[]),n=0;n<t.length;n+=1){var r=t.get(n),i=r.advanceWidth||0,s=r.leftSideBearing||0;e.fields.push({name:"advanceWidth_"+n,type:"USHORT",value:i}),e.fields.push({name:"leftSideBearing_"+n,type:"SHORT",value:s})}return e}var YA={parse:zA,make:WA};function jA(t){for(var e=new he.Table("ltag",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"numTags",type:"ULONG",value:t.length}]),n="",r=12+t.length*4,i=0;i<t.length;++i){var s=n.indexOf(t[i]);s<0&&(s=n.length,n+=t[i]),e.fields.push({name:"offset "+i,type:"USHORT",value:r+s}),e.fields.push({name:"length "+i,type:"USHORT",value:t[i].length})}return e.fields.push({name:"stringPool",type:"CHARARRAY",value:n}),e}function qA(t,e){var n=new xe.Parser(t,e),r=n.parseULong();Ie.argument(r===1,"Unsupported ltag table version."),n.skip("uLong",1);for(var i=n.parseULong(),s=[],a=0;a<i;a++){for(var o="",l=e+n.parseUShort(),h=n.parseUShort(),u=l;u<l+h;++u)o+=String.fromCharCode(t.getInt8(u));s.push(o)}return s}var KA={make:jA,parse:qA};function XA(t,e){var n={},r=new xe.Parser(t,e);return n.version=r.parseVersion(),n.numGlyphs=r.parseUShort(),n.version===1&&(n.maxPoints=r.parseUShort(),n.maxContours=r.parseUShort(),n.maxCompositePoints=r.parseUShort(),n.maxCompositeContours=r.parseUShort(),n.maxZones=r.parseUShort(),n.maxTwilightPoints=r.parseUShort(),n.maxStorage=r.parseUShort(),n.maxFunctionDefs=r.parseUShort(),n.maxInstructionDefs=r.parseUShort(),n.maxStackElements=r.parseUShort(),n.maxSizeOfInstructions=r.parseUShort(),n.maxComponentElements=r.parseUShort(),n.maxComponentDepth=r.parseUShort()),n}function ZA(t){return new he.Table("maxp",[{name:"version",type:"FIXED",value:20480},{name:"numGlyphs",type:"USHORT",value:t}])}var JA={parse:XA,make:ZA},Rc=["copyright","fontFamily","fontSubfamily","uniqueID","fullName","version","postScriptName","trademark","manufacturer","designer","description","manufacturerURL","designerURL","license","licenseURL","reserved","preferredFamily","preferredSubfamily","compatibleFullName","sampleText","postScriptFindFontName","wwsFamily","wwsSubfamily"],Uc={0:"en",1:"fr",2:"de",3:"it",4:"nl",5:"sv",6:"es",7:"da",8:"pt",9:"no",10:"he",11:"ja",12:"ar",13:"fi",14:"el",15:"is",16:"mt",17:"tr",18:"hr",19:"zh-Hant",20:"ur",21:"hi",22:"th",23:"ko",24:"lt",25:"pl",26:"hu",27:"es",28:"lv",29:"se",30:"fo",31:"fa",32:"ru",33:"zh",34:"nl-BE",35:"ga",36:"sq",37:"ro",38:"cz",39:"sk",40:"si",41:"yi",42:"sr",43:"mk",44:"bg",45:"uk",46:"be",47:"uz",48:"kk",49:"az-Cyrl",50:"az-Arab",51:"hy",52:"ka",53:"mo",54:"ky",55:"tg",56:"tk",57:"mn-CN",58:"mn",59:"ps",60:"ks",61:"ku",62:"sd",63:"bo",64:"ne",65:"sa",66:"mr",67:"bn",68:"as",69:"gu",70:"pa",71:"or",72:"ml",73:"kn",74:"ta",75:"te",76:"si",77:"my",78:"km",79:"lo",80:"vi",81:"id",82:"tl",83:"ms",84:"ms-Arab",85:"am",86:"ti",87:"om",88:"so",89:"sw",90:"rw",91:"rn",92:"ny",93:"mg",94:"eo",128:"cy",129:"eu",130:"ca",131:"la",132:"qu",133:"gn",134:"ay",135:"tt",136:"ug",137:"dz",138:"jv",139:"su",140:"gl",141:"af",142:"br",143:"iu",144:"gd",145:"gv",146:"ga",147:"to",148:"el-polyton",149:"kl",150:"az",151:"nn"},HA={0:0,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:5,11:1,12:4,13:0,14:6,15:0,16:0,17:0,18:0,19:2,20:4,21:9,22:21,23:3,24:29,25:29,26:29,27:29,28:29,29:0,30:0,31:4,32:7,33:25,34:0,35:0,36:0,37:0,38:29,39:29,40:0,41:5,42:7,43:7,44:7,45:7,46:7,47:7,48:7,49:7,50:4,51:24,52:23,53:7,54:7,55:7,56:7,57:27,58:7,59:4,60:4,61:4,62:4,63:26,64:9,65:9,66:9,67:13,68:13,69:11,70:10,71:12,72:17,73:16,74:14,75:15,76:18,77:19,78:20,79:22,80:30,81:0,82:0,83:0,84:4,85:28,86:28,87:28,88:0,89:0,90:0,91:0,92:0,93:0,94:0,128:0,129:0,130:0,131:0,132:0,133:0,134:0,135:7,136:4,137:26,138:0,139:0,140:0,141:0,142:0,143:28,144:0,145:0,146:0,147:0,148:6,149:0,150:0,151:0},Qc={1078:"af",1052:"sq",1156:"gsw",1118:"am",5121:"ar-DZ",15361:"ar-BH",3073:"ar",2049:"ar-IQ",11265:"ar-JO",13313:"ar-KW",12289:"ar-LB",4097:"ar-LY",6145:"ary",8193:"ar-OM",16385:"ar-QA",1025:"ar-SA",10241:"ar-SY",7169:"aeb",14337:"ar-AE",9217:"ar-YE",1067:"hy",1101:"as",2092:"az-Cyrl",1068:"az",1133:"ba",1069:"eu",1059:"be",2117:"bn",1093:"bn-IN",8218:"bs-Cyrl",5146:"bs",1150:"br",1026:"bg",1027:"ca",3076:"zh-HK",5124:"zh-MO",2052:"zh",4100:"zh-SG",1028:"zh-TW",1155:"co",1050:"hr",4122:"hr-BA",1029:"cs",1030:"da",1164:"prs",1125:"dv",2067:"nl-BE",1043:"nl",3081:"en-AU",10249:"en-BZ",4105:"en-CA",9225:"en-029",16393:"en-IN",6153:"en-IE",8201:"en-JM",17417:"en-MY",5129:"en-NZ",13321:"en-PH",18441:"en-SG",7177:"en-ZA",11273:"en-TT",2057:"en-GB",1033:"en",12297:"en-ZW",1061:"et",1080:"fo",1124:"fil",1035:"fi",2060:"fr-BE",3084:"fr-CA",1036:"fr",5132:"fr-LU",6156:"fr-MC",4108:"fr-CH",1122:"fy",1110:"gl",1079:"ka",3079:"de-AT",1031:"de",5127:"de-LI",4103:"de-LU",2055:"de-CH",1032:"el",1135:"kl",1095:"gu",1128:"ha",1037:"he",1081:"hi",1038:"hu",1039:"is",1136:"ig",1057:"id",1117:"iu",2141:"iu-Latn",2108:"ga",1076:"xh",1077:"zu",1040:"it",2064:"it-CH",1041:"ja",1099:"kn",1087:"kk",1107:"km",1158:"quc",1159:"rw",1089:"sw",1111:"kok",1042:"ko",1088:"ky",1108:"lo",1062:"lv",1063:"lt",2094:"dsb",1134:"lb",1071:"mk",2110:"ms-BN",1086:"ms",1100:"ml",1082:"mt",1153:"mi",1146:"arn",1102:"mr",1148:"moh",1104:"mn",2128:"mn-CN",1121:"ne",1044:"nb",2068:"nn",1154:"oc",1096:"or",1123:"ps",1045:"pl",1046:"pt",2070:"pt-PT",1094:"pa",1131:"qu-BO",2155:"qu-EC",3179:"qu",1048:"ro",1047:"rm",1049:"ru",9275:"smn",4155:"smj-NO",5179:"smj",3131:"se-FI",1083:"se",2107:"se-SE",8251:"sms",6203:"sma-NO",7227:"sms",1103:"sa",7194:"sr-Cyrl-BA",3098:"sr",6170:"sr-Latn-BA",2074:"sr-Latn",1132:"nso",1074:"tn",1115:"si",1051:"sk",1060:"sl",11274:"es-AR",16394:"es-BO",13322:"es-CL",9226:"es-CO",5130:"es-CR",7178:"es-DO",12298:"es-EC",17418:"es-SV",4106:"es-GT",18442:"es-HN",2058:"es-MX",19466:"es-NI",6154:"es-PA",15370:"es-PY",10250:"es-PE",20490:"es-PR",3082:"es",1034:"es",21514:"es-US",14346:"es-UY",8202:"es-VE",2077:"sv-FI",1053:"sv",1114:"syr",1064:"tg",2143:"tzm",1097:"ta",1092:"tt",1098:"te",1054:"th",1105:"bo",1055:"tr",1090:"tk",1152:"ug",1058:"uk",1070:"hsb",1056:"ur",2115:"uz-Cyrl",1091:"uz",1066:"vi",1106:"cy",1160:"wo",1157:"sah",1144:"ii",1130:"yo"};function $A(t,e,n){switch(t){case 0:if(e===65535)return"und";if(n)return n[e];break;case 1:return Uc[e];case 3:return Qc[e]}}var qa="utf-16",ef={0:"macintosh",1:"x-mac-japanese",2:"x-mac-chinesetrad",3:"x-mac-korean",6:"x-mac-greek",7:"x-mac-cyrillic",9:"x-mac-devanagai",10:"x-mac-gurmukhi",11:"x-mac-gujarati",12:"x-mac-oriya",13:"x-mac-bengali",14:"x-mac-tamil",15:"x-mac-telugu",16:"x-mac-kannada",17:"x-mac-malayalam",18:"x-mac-sinhalese",19:"x-mac-burmese",20:"x-mac-khmer",21:"x-mac-thai",22:"x-mac-lao",23:"x-mac-georgian",24:"x-mac-armenian",25:"x-mac-chinesesimp",26:"x-mac-tibetan",27:"x-mac-mongolian",28:"x-mac-ethiopic",29:"x-mac-ce",30:"x-mac-vietnamese",31:"x-mac-extarabic"},tf={15:"x-mac-icelandic",17:"x-mac-turkish",18:"x-mac-croatian",24:"x-mac-ce",25:"x-mac-ce",26:"x-mac-ce",27:"x-mac-ce",28:"x-mac-ce",30:"x-mac-icelandic",37:"x-mac-romanian",38:"x-mac-ce",39:"x-mac-ce",40:"x-mac-ce",143:"x-mac-inuit",146:"x-mac-gaelic"};function Nc(t,e,n){switch(t){case 0:return qa;case 1:return tf[n]||ef[e];case 3:if(e===1||e===10)return qa;break}}function nf(t,e,n){for(var r={},i=new xe.Parser(t,e),s=i.parseUShort(),a=i.parseUShort(),o=i.offset+i.parseUShort(),l=0;l<a;l++){var h=i.parseUShort(),u=i.parseUShort(),A=i.parseUShort(),f=i.parseUShort(),d=Rc[f]||f,m=i.parseUShort(),y=i.parseUShort(),C=$A(h,A,n),x=Nc(h,u,A);if(x!==void 0&&C!==void 0){var I=void 0;if(x===qa?I=br.UTF16(t,o+y,m):I=br.MACSTRING(t,o+y,m,x),I){var g=r[d];g===void 0&&(g=r[d]={}),g[C]=I}}}return s===1&&i.parseUShort(),r}function Ka(t){var e={};for(var n in t)e[t[n]]=parseInt(n);return e}function Gc(t,e,n,r,i,s){return new he.Record("NameRecord",[{name:"platformID",type:"USHORT",value:t},{name:"encodingID",type:"USHORT",value:e},{name:"languageID",type:"USHORT",value:n},{name:"nameID",type:"USHORT",value:r},{name:"length",type:"USHORT",value:i},{name:"offset",type:"USHORT",value:s}])}function rf(t,e){var n=t.length,r=e.length-n+1;e:for(var i=0;i<r;i++)for(;i<r;i++){for(var s=0;s<n;s++)if(e[i+s]!==t[s])continue e;return i}return-1}function Vc(t,e){var n=rf(t,e);if(n<0){n=e.length;for(var r=0,i=t.length;r<i;++r)e.push(t[r])}return n}function sf(t,e){var n,r=[],i={},s=Ka(Rc);for(var a in t){var o=s[a];if(o===void 0&&(o=a),n=parseInt(o),isNaN(n))throw new Error('Name table entry "'+a+'" does not exist, see nameTableNames for complete list.');i[n]=t[a],r.push(n)}for(var l=Ka(Uc),h=Ka(Qc),u=[],A=[],f=0;f<r.length;f++){n=r[f];var d=i[n];for(var m in d){var y=d[m],C=1,x=l[m],I=HA[x],g=Nc(C,I,x),v=ae.MACSTRING(y,g);v===void 0&&(C=0,x=e.indexOf(m),x<0&&(x=e.length,e.push(m)),I=4,v=ae.UTF16(y));var w=Vc(v,A);u.push(Gc(C,I,x,n,v.length,w));var b=h[m];if(b!==void 0){var B=ae.UTF16(y),_=Vc(B,A);u.push(Gc(3,1,b,n,B.length,_))}}}u.sort(function(L,R){return L.platformID-R.platformID||L.encodingID-R.encodingID||L.languageID-R.languageID||L.nameID-R.nameID});for(var E=new he.Table("name",[{name:"format",type:"USHORT",value:0},{name:"count",type:"USHORT",value:u.length},{name:"stringOffset",type:"USHORT",value:6+u.length*12}]),T=0;T<u.length;T++)E.fields.push({name:"record_"+T,type:"RECORD",value:u[T]});return E.fields.push({name:"strings",type:"LITERAL",value:A}),E}var af={parse:nf,make:sf},Xa=[{begin:0,end:127},{begin:128,end:255},{begin:256,end:383},{begin:384,end:591},{begin:592,end:687},{begin:688,end:767},{begin:768,end:879},{begin:880,end:1023},{begin:11392,end:11519},{begin:1024,end:1279},{begin:1328,end:1423},{begin:1424,end:1535},{begin:42240,end:42559},{begin:1536,end:1791},{begin:1984,end:2047},{begin:2304,end:2431},{begin:2432,end:2559},{begin:2560,end:2687},{begin:2688,end:2815},{begin:2816,end:2943},{begin:2944,end:3071},{begin:3072,end:3199},{begin:3200,end:3327},{begin:3328,end:3455},{begin:3584,end:3711},{begin:3712,end:3839},{begin:4256,end:4351},{begin:6912,end:7039},{begin:4352,end:4607},{begin:7680,end:7935},{begin:7936,end:8191},{begin:8192,end:8303},{begin:8304,end:8351},{begin:8352,end:8399},{begin:8400,end:8447},{begin:8448,end:8527},{begin:8528,end:8591},{begin:8592,end:8703},{begin:8704,end:8959},{begin:8960,end:9215},{begin:9216,end:9279},{begin:9280,end:9311},{begin:9312,end:9471},{begin:9472,end:9599},{begin:9600,end:9631},{begin:9632,end:9727},{begin:9728,end:9983},{begin:9984,end:10175},{begin:12288,end:12351},{begin:12352,end:12447},{begin:12448,end:12543},{begin:12544,end:12591},{begin:12592,end:12687},{begin:43072,end:43135},{begin:12800,end:13055},{begin:13056,end:13311},{begin:44032,end:55215},{begin:55296,end:57343},{begin:67840,end:67871},{begin:19968,end:40959},{begin:57344,end:63743},{begin:12736,end:12783},{begin:64256,end:64335},{begin:64336,end:65023},{begin:65056,end:65071},{begin:65040,end:65055},{begin:65104,end:65135},{begin:65136,end:65279},{begin:65280,end:65519},{begin:65520,end:65535},{begin:3840,end:4095},{begin:1792,end:1871},{begin:1920,end:1983},{begin:3456,end:3583},{begin:4096,end:4255},{begin:4608,end:4991},{begin:5024,end:5119},{begin:5120,end:5759},{begin:5760,end:5791},{begin:5792,end:5887},{begin:6016,end:6143},{begin:6144,end:6319},{begin:10240,end:10495},{begin:40960,end:42127},{begin:5888,end:5919},{begin:66304,end:66351},{begin:66352,end:66383},{begin:66560,end:66639},{begin:118784,end:119039},{begin:119808,end:120831},{begin:1044480,end:1048573},{begin:65024,end:65039},{begin:917504,end:917631},{begin:6400,end:6479},{begin:6480,end:6527},{begin:6528,end:6623},{begin:6656,end:6687},{begin:11264,end:11359},{begin:11568,end:11647},{begin:19904,end:19967},{begin:43008,end:43055},{begin:65536,end:65663},{begin:65856,end:65935},{begin:66432,end:66463},{begin:66464,end:66527},{begin:66640,end:66687},{begin:66688,end:66735},{begin:67584,end:67647},{begin:68096,end:68191},{begin:119552,end:119647},{begin:73728,end:74751},{begin:119648,end:119679},{begin:7040,end:7103},{begin:7168,end:7247},{begin:7248,end:7295},{begin:43136,end:43231},{begin:43264,end:43311},{begin:43312,end:43359},{begin:43520,end:43615},{begin:65936,end:65999},{begin:66e3,end:66047},{begin:66208,end:66271},{begin:127024,end:127135}];function of(t){for(var e=0;e<Xa.length;e+=1){var n=Xa[e];if(t>=n.begin&&t<n.end)return e}return-1}function lf(t,e){var n={},r=new xe.Parser(t,e);n.version=r.parseUShort(),n.xAvgCharWidth=r.parseShort(),n.usWeightClass=r.parseUShort(),n.usWidthClass=r.parseUShort(),n.fsType=r.parseUShort(),n.ySubscriptXSize=r.parseShort(),n.ySubscriptYSize=r.parseShort(),n.ySubscriptXOffset=r.parseShort(),n.ySubscriptYOffset=r.parseShort(),n.ySuperscriptXSize=r.parseShort(),n.ySuperscriptYSize=r.parseShort(),n.ySuperscriptXOffset=r.parseShort(),n.ySuperscriptYOffset=r.parseShort(),n.yStrikeoutSize=r.parseShort(),n.yStrikeoutPosition=r.parseShort(),n.sFamilyClass=r.parseShort(),n.panose=[];for(var i=0;i<10;i++)n.panose[i]=r.parseByte();return n.ulUnicodeRange1=r.parseULong(),n.ulUnicodeRange2=r.parseULong(),n.ulUnicodeRange3=r.parseULong(),n.ulUnicodeRange4=r.parseULong(),n.achVendID=String.fromCharCode(r.parseByte(),r.parseByte(),r.parseByte(),r.parseByte()),n.fsSelection=r.parseUShort(),n.usFirstCharIndex=r.parseUShort(),n.usLastCharIndex=r.parseUShort(),n.sTypoAscender=r.parseShort(),n.sTypoDescender=r.parseShort(),n.sTypoLineGap=r.parseShort(),n.usWinAscent=r.parseUShort(),n.usWinDescent=r.parseUShort(),n.version>=1&&(n.ulCodePageRange1=r.parseULong(),n.ulCodePageRange2=r.parseULong()),n.version>=2&&(n.sxHeight=r.parseShort(),n.sCapHeight=r.parseShort(),n.usDefaultChar=r.parseUShort(),n.usBreakChar=r.parseUShort(),n.usMaxContent=r.parseUShort()),n}function cf(t){return new he.Table("OS/2",[{name:"version",type:"USHORT",value:3},{name:"xAvgCharWidth",type:"SHORT",value:0},{name:"usWeightClass",type:"USHORT",value:0},{name:"usWidthClass",type:"USHORT",value:0},{name:"fsType",type:"USHORT",value:0},{name:"ySubscriptXSize",type:"SHORT",value:650},{name:"ySubscriptYSize",type:"SHORT",value:699},{name:"ySubscriptXOffset",type:"SHORT",value:0},{name:"ySubscriptYOffset",type:"SHORT",value:140},{name:"ySuperscriptXSize",type:"SHORT",value:650},{name:"ySuperscriptYSize",type:"SHORT",value:699},{name:"ySuperscriptXOffset",type:"SHORT",value:0},{name:"ySuperscriptYOffset",type:"SHORT",value:479},{name:"yStrikeoutSize",type:"SHORT",value:49},{name:"yStrikeoutPosition",type:"SHORT",value:258},{name:"sFamilyClass",type:"SHORT",value:0},{name:"bFamilyType",type:"BYTE",value:0},{name:"bSerifStyle",type:"BYTE",value:0},{name:"bWeight",type:"BYTE",value:0},{name:"bProportion",type:"BYTE",value:0},{name:"bContrast",type:"BYTE",value:0},{name:"bStrokeVariation",type:"BYTE",value:0},{name:"bArmStyle",type:"BYTE",value:0},{name:"bLetterform",type:"BYTE",value:0},{name:"bMidline",type:"BYTE",value:0},{name:"bXHeight",type:"BYTE",value:0},{name:"ulUnicodeRange1",type:"ULONG",value:0},{name:"ulUnicodeRange2",type:"ULONG",value:0},{name:"ulUnicodeRange3",type:"ULONG",value:0},{name:"ulUnicodeRange4",type:"ULONG",value:0},{name:"achVendID",type:"CHARARRAY",value:"XXXX"},{name:"fsSelection",type:"USHORT",value:0},{name:"usFirstCharIndex",type:"USHORT",value:0},{name:"usLastCharIndex",type:"USHORT",value:0},{name:"sTypoAscender",type:"SHORT",value:0},{name:"sTypoDescender",type:"SHORT",value:0},{name:"sTypoLineGap",type:"SHORT",value:0},{name:"usWinAscent",type:"USHORT",value:0},{name:"usWinDescent",type:"USHORT",value:0},{name:"ulCodePageRange1",type:"ULONG",value:0},{name:"ulCodePageRange2",type:"ULONG",value:0},{name:"sxHeight",type:"SHORT",value:0},{name:"sCapHeight",type:"SHORT",value:0},{name:"usDefaultChar",type:"USHORT",value:0},{name:"usBreakChar",type:"USHORT",value:0},{name:"usMaxContext",type:"USHORT",value:0}],t)}var zc={parse:lf,make:cf,unicodeRanges:Xa,getUnicodeRange:of};function hf(t,e){var n={},r=new xe.Parser(t,e);switch(n.version=r.parseVersion(),n.italicAngle=r.parseFixed(),n.underlinePosition=r.parseShort(),n.underlineThickness=r.parseShort(),n.isFixedPitch=r.parseULong(),n.minMemType42=r.parseULong(),n.maxMemType42=r.parseULong(),n.minMemType1=r.parseULong(),n.maxMemType1=r.parseULong(),n.version){case 1:n.names=Sc.slice();break;case 2:n.numberOfGlyphs=r.parseUShort(),n.glyphNameIndex=new Array(n.numberOfGlyphs);for(var i=0;i<n.numberOfGlyphs;i++)n.glyphNameIndex[i]=r.parseUShort();n.names=[];for(var s=0;s<n.numberOfGlyphs;s++)if(n.glyphNameIndex[s]>=Sc.length){var a=r.parseChar();n.names.push(r.parseString(a))}break;case 2.5:n.numberOfGlyphs=r.parseUShort(),n.offset=new Array(n.numberOfGlyphs);for(var o=0;o<n.numberOfGlyphs;o++)n.offset[o]=r.parseChar();break}return n}function uf(){return new he.Table("post",[{name:"version",type:"FIXED",value:196608},{name:"italicAngle",type:"FIXED",value:0},{name:"underlinePosition",type:"FWORD",value:0},{name:"underlineThickness",type:"FWORD",value:0},{name:"isFixedPitch",type:"ULONG",value:0},{name:"minMemType42",type:"ULONG",value:0},{name:"maxMemType42",type:"ULONG",value:0},{name:"minMemType1",type:"ULONG",value:0},{name:"maxMemType1",type:"ULONG",value:0}])}var Af={parse:hf,make:uf},Ot=new Array(9);Ot[1]=function(){var e=this.offset+this.relativeOffset,n=this.parseUShort();if(n===1)return{substFormat:1,coverage:this.parsePointer(W.coverage),deltaGlyphId:this.parseUShort()};if(n===2)return{substFormat:2,coverage:this.parsePointer(W.coverage),substitute:this.parseOffset16List()};Ie.assert(!1,"0x"+e.toString(16)+": lookup type 1 format must be 1 or 2.")},Ot[2]=function(){var e=this.parseUShort();return Ie.argument(e===1,"GSUB Multiple Substitution Subtable identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(W.coverage),sequences:this.parseListOfLists()}},Ot[3]=function(){var e=this.parseUShort();return Ie.argument(e===1,"GSUB Alternate Substitution Subtable identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(W.coverage),alternateSets:this.parseListOfLists()}},Ot[4]=function(){var e=this.parseUShort();return Ie.argument(e===1,"GSUB ligature table identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(W.coverage),ligatureSets:this.parseListOfLists(function(){return{ligGlyph:this.parseUShort(),components:this.parseUShortList(this.parseUShort()-1)}})}};var _r={sequenceIndex:W.uShort,lookupListIndex:W.uShort};Ot[5]=function(){var e=this.offset+this.relativeOffset,n=this.parseUShort();if(n===1)return{substFormat:n,coverage:this.parsePointer(W.coverage),ruleSets:this.parseListOfLists(function(){var s=this.parseUShort(),a=this.parseUShort();return{input:this.parseUShortList(s-1),lookupRecords:this.parseRecordList(a,_r)}})};if(n===2)return{substFormat:n,coverage:this.parsePointer(W.coverage),classDef:this.parsePointer(W.classDef),classSets:this.parseListOfLists(function(){var s=this.parseUShort(),a=this.parseUShort();return{classes:this.parseUShortList(s-1),lookupRecords:this.parseRecordList(a,_r)}})};if(n===3){var r=this.parseUShort(),i=this.parseUShort();return{substFormat:n,coverages:this.parseList(r,W.pointer(W.coverage)),lookupRecords:this.parseRecordList(i,_r)}}Ie.assert(!1,"0x"+e.toString(16)+": lookup type 5 format must be 1, 2 or 3.")},Ot[6]=function(){var e=this.offset+this.relativeOffset,n=this.parseUShort();if(n===1)return{substFormat:1,coverage:this.parsePointer(W.coverage),chainRuleSets:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(_r)}})};if(n===2)return{substFormat:2,coverage:this.parsePointer(W.coverage),backtrackClassDef:this.parsePointer(W.classDef),inputClassDef:this.parsePointer(W.classDef),lookaheadClassDef:this.parsePointer(W.classDef),chainClassSet:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(_r)}})};if(n===3)return{substFormat:3,backtrackCoverage:this.parseList(W.pointer(W.coverage)),inputCoverage:this.parseList(W.pointer(W.coverage)),lookaheadCoverage:this.parseList(W.pointer(W.coverage)),lookupRecords:this.parseRecordList(_r)};Ie.assert(!1,"0x"+e.toString(16)+": lookup type 6 format must be 1, 2 or 3.")},Ot[7]=function(){var e=this.parseUShort();Ie.argument(e===1,"GSUB Extension Substitution subtable identifier-format must be 1");var n=this.parseUShort(),r=new W(this.data,this.offset+this.parseULong());return{substFormat:1,lookupType:n,extension:Ot[n].call(r)}},Ot[8]=function(){var e=this.parseUShort();return Ie.argument(e===1,"GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(W.coverage),backtrackCoverage:this.parseList(W.pointer(W.coverage)),lookaheadCoverage:this.parseList(W.pointer(W.coverage)),substitutes:this.parseUShortList()}};function ff(t,e){e=e||0;var n=new W(t,e),r=n.parseVersion(1);return Ie.argument(r===1||r===1.1,"Unsupported GSUB table version."),r===1?{version:r,scripts:n.parseScriptList(),features:n.parseFeatureList(),lookups:n.parseLookupList(Ot)}:{version:r,scripts:n.parseScriptList(),features:n.parseFeatureList(),lookups:n.parseLookupList(Ot),variations:n.parseFeatureVariationsList()}}var Er=new Array(9);Er[1]=function(e){return e.substFormat===1?new he.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new he.Coverage(e.coverage)},{name:"deltaGlyphID",type:"USHORT",value:e.deltaGlyphId}]):new he.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:2},{name:"coverage",type:"TABLE",value:new he.Coverage(e.coverage)}].concat(he.ushortList("substitute",e.substitute)))},Er[2]=function(e){return Ie.assert(e.substFormat===1,"Lookup type 2 substFormat must be 1."),new he.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new he.Coverage(e.coverage)}].concat(he.tableList("seqSet",e.sequences,function(n){return new he.Table("sequenceSetTable",he.ushortList("sequence",n))})))},Er[3]=function(e){return Ie.assert(e.substFormat===1,"Lookup type 3 substFormat must be 1."),new he.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new he.Coverage(e.coverage)}].concat(he.tableList("altSet",e.alternateSets,function(n){return new he.Table("alternateSetTable",he.ushortList("alternate",n))})))},Er[4]=function(e){return Ie.assert(e.substFormat===1,"Lookup type 4 substFormat must be 1."),new he.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new he.Coverage(e.coverage)}].concat(he.tableList("ligSet",e.ligatureSets,function(n){return new he.Table("ligatureSetTable",he.tableList("ligature",n,function(r){return new he.Table("ligatureTable",[{name:"ligGlyph",type:"USHORT",value:r.ligGlyph}].concat(he.ushortList("component",r.components,r.components.length+1)))}))})))},Er[6]=function(e){if(e.substFormat===1){var n=new he.Table("chainContextTable",[{name:"substFormat",type:"USHORT",value:e.substFormat},{name:"coverage",type:"TABLE",value:new he.Coverage(e.coverage)}].concat(he.tableList("chainRuleSet",e.chainRuleSets,function(s){return new he.Table("chainRuleSetTable",he.tableList("chainRule",s,function(a){var o=he.ushortList("backtrackGlyph",a.backtrack,a.backtrack.length).concat(he.ushortList("inputGlyph",a.input,a.input.length+1)).concat(he.ushortList("lookaheadGlyph",a.lookahead,a.lookahead.length)).concat(he.ushortList("substitution",[],a.lookupRecords.length));return a.lookupRecords.forEach(function(l,h){o=o.concat({name:"sequenceIndex"+h,type:"USHORT",value:l.sequenceIndex}).concat({name:"lookupListIndex"+h,type:"USHORT",value:l.lookupListIndex})}),new he.Table("chainRuleTable",o)}))})));return n}else if(e.substFormat===2)Ie.assert(!1,"lookup type 6 format 2 is not yet supported.");else if(e.substFormat===3){var r=[{name:"substFormat",type:"USHORT",value:e.substFormat}];r.push({name:"backtrackGlyphCount",type:"USHORT",value:e.backtrackCoverage.length}),e.backtrackCoverage.forEach(function(s,a){r.push({name:"backtrackCoverage"+a,type:"TABLE",value:new he.Coverage(s)})}),r.push({name:"inputGlyphCount",type:"USHORT",value:e.inputCoverage.length}),e.inputCoverage.forEach(function(s,a){r.push({name:"inputCoverage"+a,type:"TABLE",value:new he.Coverage(s)})}),r.push({name:"lookaheadGlyphCount",type:"USHORT",value:e.lookaheadCoverage.length}),e.lookaheadCoverage.forEach(function(s,a){r.push({name:"lookaheadCoverage"+a,type:"TABLE",value:new he.Coverage(s)})}),r.push({name:"substitutionCount",type:"USHORT",value:e.lookupRecords.length}),e.lookupRecords.forEach(function(s,a){r=r.concat({name:"sequenceIndex"+a,type:"USHORT",value:s.sequenceIndex}).concat({name:"lookupListIndex"+a,type:"USHORT",value:s.lookupListIndex})});var i=new he.Table("chainContextTable",r);return i}Ie.assert(!1,"lookup type 6 format must be 1, 2 or 3.")};function df(t){return new he.Table("GSUB",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new he.ScriptList(t.scripts)},{name:"features",type:"TABLE",value:new he.FeatureList(t.features)},{name:"lookups",type:"TABLE",value:new he.LookupList(t.lookups,Er)}])}var pf={parse:ff,make:df};function gf(t,e){var n=new xe.Parser(t,e),r=n.parseULong();Ie.argument(r===1,"Unsupported META table version."),n.parseULong(),n.parseULong();for(var i=n.parseULong(),s={},a=0;a<i;a++){var o=n.parseTag(),l=n.parseULong(),h=n.parseULong(),u=br.UTF8(t,e+l,h);s[o]=u}return s}function mf(t){var e=Object.keys(t).length,n="",r=16+e*12,i=new he.Table("meta",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"offset",type:"ULONG",value:r},{name:"numTags",type:"ULONG",value:e}]);for(var s in t){var a=n.length;n+=t[s],i.fields.push({name:"tag "+s,type:"TAG",value:s}),i.fields.push({name:"offset "+s,type:"ULONG",value:r+a}),i.fields.push({name:"length "+s,type:"ULONG",value:t[s].length})}return i.fields.push({name:"stringPool",type:"CHARARRAY",value:n}),i}var vf={parse:gf,make:mf};function Wc(t){return Math.log(t)/Math.log(2)|0}function Za(t){for(;t.length%4!==0;)t.push(0);for(var e=0,n=0;n<t.length;n+=4)e+=(t[n]<<24)+(t[n+1]<<16)+(t[n+2]<<8)+t[n+3];return e%=Math.pow(2,32),e}function Yc(t,e,n,r){return new he.Record("Table Record",[{name:"tag",type:"TAG",value:t!==void 0?t:""},{name:"checkSum",type:"ULONG",value:e!==void 0?e:0},{name:"offset",type:"ULONG",value:n!==void 0?n:0},{name:"length",type:"ULONG",value:r!==void 0?r:0}])}function jc(t){var e=new he.Table("sfnt",[{name:"version",type:"TAG",value:"OTTO"},{name:"numTables",type:"USHORT",value:0},{name:"searchRange",type:"USHORT",value:0},{name:"entrySelector",type:"USHORT",value:0},{name:"rangeShift",type:"USHORT",value:0}]);e.tables=t,e.numTables=t.length;var n=Math.pow(2,Wc(e.numTables));e.searchRange=16*n,e.entrySelector=Wc(n),e.rangeShift=e.numTables*16-e.searchRange;for(var r=[],i=[],s=e.sizeOf()+Yc().sizeOf()*e.numTables;s%4!==0;)s+=1,i.push({name:"padding",type:"BYTE",value:0});for(var a=0;a<t.length;a+=1){var o=t[a];Ie.argument(o.tableName.length===4,"Table name"+o.tableName+" is invalid.");var l=o.sizeOf(),h=Yc(o.tableName,Za(o.encode()),s,l);for(r.push({name:h.tag+" Table Record",type:"RECORD",value:h}),i.push({name:o.tableName+" table",type:"RECORD",value:o}),s+=l,Ie.argument(!isNaN(s),"Something went wrong calculating the offset.");s%4!==0;)s+=1,i.push({name:"padding",type:"BYTE",value:0})}return r.sort(function(u,A){return u.value.tag>A.value.tag?1:-1}),e.fields=e.fields.concat(r),e.fields=e.fields.concat(i),e}function qc(t,e,n){for(var r=0;r<e.length;r+=1){var i=t.charToGlyphIndex(e[r]);if(i>0){var s=t.glyphs.get(i);return s.getMetrics()}}return n}function yf(t){for(var e=0,n=0;n<t.length;n+=1)e+=t[n];return e/t.length}function Cf(t){for(var e=[],n=[],r=[],i=[],s=[],a=[],o=[],l,h=0,u=0,A=0,f=0,d=0,m=0;m<t.glyphs.length;m+=1){var y=t.glyphs.get(m),C=y.unicode|0;if(isNaN(y.advanceWidth))throw new Error("Glyph "+y.name+" ("+m+"): advanceWidth is not a number.");(l>C||l===void 0)&&C>0&&(l=C),h<C&&(h=C);var x=zc.getUnicodeRange(C);if(x<32)u|=1<<x;else if(x<64)A|=1<<x-32;else if(x<96)f|=1<<x-64;else if(x<123)d|=1<<x-96;else throw new Error("Unicode ranges bits > 123 are reserved for internal usage");if(y.name!==".notdef"){var I=y.getMetrics();e.push(I.xMin),n.push(I.yMin),r.push(I.xMax),i.push(I.yMax),a.push(I.leftSideBearing),o.push(I.rightSideBearing),s.push(y.advanceWidth)}}var g={xMin:Math.min.apply(null,e),yMin:Math.min.apply(null,n),xMax:Math.max.apply(null,r),yMax:Math.max.apply(null,i),advanceWidthMax:Math.max.apply(null,s),advanceWidthAvg:yf(s),minLeftSideBearing:Math.min.apply(null,a),maxLeftSideBearing:Math.max.apply(null,a),minRightSideBearing:Math.min.apply(null,o)};g.ascender=t.ascender,g.descender=t.descender;var v=RA.make({flags:3,unitsPerEm:t.unitsPerEm,xMin:g.xMin,yMin:g.yMin,xMax:g.xMax,yMax:g.yMax,lowestRecPPEM:3,createdTimestamp:t.createdTimestamp}),w=NA.make({ascender:g.ascender,descender:g.descender,advanceWidthMax:g.advanceWidthMax,minLeftSideBearing:g.minLeftSideBearing,minRightSideBearing:g.minRightSideBearing,xMaxExtent:g.maxLeftSideBearing+(g.xMax-g.xMin),numberOfHMetrics:t.glyphs.length}),b=JA.make(t.glyphs.length),B=zc.make(Object.assign({xAvgCharWidth:Math.round(g.advanceWidthAvg),usFirstCharIndex:l,usLastCharIndex:h,ulUnicodeRange1:u,ulUnicodeRange2:A,ulUnicodeRange3:f,ulUnicodeRange4:d,sTypoAscender:g.ascender,sTypoDescender:g.descender,sTypoLineGap:0,usWinAscent:g.yMax,usWinDescent:Math.abs(g.yMin),ulCodePageRange1:1,sxHeight:qc(t,"xyvw",{yMax:Math.round(g.ascender/2)}).yMax,sCapHeight:qc(t,"HIKLEFJMNTZBDPRAGOQSUVWXY",g).yMax,usDefaultChar:t.hasChar(" ")?32:0,usBreakChar:t.hasChar(" ")?32:0},t.tables.os2)),_=YA.make(t.glyphs),E=aA.make(t.glyphs),T=t.getEnglishName("fontFamily"),L=t.getEnglishName("fontSubfamily"),R=T+" "+L,V=t.getEnglishName("postScriptName");V||(V=T.replace(/\s/g,"")+"-"+L);var Y={};for(var q in t.names)Y[q]=t.names[q];Y.uniqueID||(Y.uniqueID={en:t.getEnglishName("manufacturer")+":"+R}),Y.postScriptName||(Y.postScriptName={en:V}),Y.preferredFamily||(Y.preferredFamily=t.names.fontFamily),Y.preferredSubfamily||(Y.preferredSubfamily=t.names.fontSubfamily);var ne=[],X=af.make(Y,ne),G=ne.length>0?KA.make(ne):void 0,H=Af.make(),Z=FA.make(t.glyphs,{version:t.getEnglishName("version"),fullName:R,familyName:T,weightName:L,postScriptName:V,unitsPerEm:t.unitsPerEm,fontBBox:[0,g.yMin,g.ascender,g.advanceWidthMax]}),$=t.metas&&Object.keys(t.metas).length>0?vf.make(t.metas):void 0,O=[v,w,b,B,X,E,H,Z,_];G&&O.push(G),t.tables.gsub&&O.push(pf.make(t.tables.gsub)),$&&O.push($);for(var F=jc(O),S=F.encode(),Q=Za(S),z=F.fields,P=!1,K=0;K<z.length;K+=1)if(z[K].name==="head table"){z[K].value.checkSumAdjustment=2981146554-Q,P=!0;break}if(!P)throw new Error("Could not find head table with checkSum to adjust.");return F}var If={make:jc,fontToTable:Cf,computeCheckSum:Za};function Ja(t,e){for(var n=0,r=t.length-1;n<=r;){var i=n+r>>>1,s=t[i].tag;if(s===e)return i;s<e?n=i+1:r=i-1}return-n-1}function Kc(t,e){for(var n=0,r=t.length-1;n<=r;){var i=n+r>>>1,s=t[i];if(s===e)return i;s<e?n=i+1:r=i-1}return-n-1}function Xc(t,e){for(var n,r=0,i=t.length-1;r<=i;){var s=r+i>>>1;n=t[s];var a=n.start;if(a===e)return n;a<e?r=s+1:i=s-1}if(r>0)return n=t[r-1],e>n.end?0:n}function $r(t,e){this.font=t,this.tableName=e}$r.prototype={searchTag:Ja,binSearch:Kc,getTable:function(t){var e=this.font.tables[this.tableName];return!e&&t&&(e=this.font.tables[this.tableName]=this.createDefaultTable()),e},getScriptNames:function(){var t=this.getTable();return t?t.scripts.map(function(e){return e.tag}):[]},getDefaultScriptName:function(){var t=this.getTable();if(t){for(var e=!1,n=0;n<t.scripts.length;n++){var r=t.scripts[n].tag;if(r==="DFLT")return r;r==="latn"&&(e=!0)}if(e)return"latn"}},getScriptTable:function(t,e){var n=this.getTable(e);if(n){t=t||"DFLT";var r=n.scripts,i=Ja(n.scripts,t);if(i>=0)return r[i].script;if(e){var s={tag:t,script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}};return r.splice(-1-i,0,s),s.script}}},getLangSysTable:function(t,e,n){var r=this.getScriptTable(t,n);if(r){if(!e||e==="dflt"||e==="DFLT")return r.defaultLangSys;var i=Ja(r.langSysRecords,e);if(i>=0)return r.langSysRecords[i].langSys;if(n){var s={tag:e,langSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]}};return r.langSysRecords.splice(-1-i,0,s),s.langSys}}},getFeatureTable:function(t,e,n,r){var i=this.getLangSysTable(t,e,r);if(i){for(var s,a=i.featureIndexes,o=this.font.tables[this.tableName].features,l=0;l<a.length;l++)if(s=o[a[l]],s.tag===n)return s.feature;if(r){var h=o.length;return Ie.assert(h===0||n>=o[h-1].tag,"Features must be added in alphabetical order."),s={tag:n,feature:{params:0,lookupListIndexes:[]}},o.push(s),a.push(h),s.feature}}},getLookupTables:function(t,e,n,r,i){var s=this.getFeatureTable(t,e,n,i),a=[];if(s){for(var o,l=s.lookupListIndexes,h=this.font.tables[this.tableName].lookups,u=0;u<l.length;u++)o=h[l[u]],o.lookupType===r&&a.push(o);if(a.length===0&&i){o={lookupType:r,lookupFlag:0,subtables:[],markFilteringSet:void 0};var A=h.length;return h.push(o),l.push(A),[o]}}return a},getGlyphClass:function(t,e){switch(t.format){case 1:return t.startGlyph<=e&&e<t.startGlyph+t.classes.length?t.classes[e-t.startGlyph]:0;case 2:var n=Xc(t.ranges,e);return n?n.classId:0}},getCoverageIndex:function(t,e){switch(t.format){case 1:var n=Kc(t.glyphs,e);return n>=0?n:-1;case 2:var r=Xc(t.ranges,e);return r?r.index+e-r.start:-1}},expandCoverage:function(t){if(t.format===1)return t.glyphs;for(var e=[],n=t.ranges,r=0;r<n.length;r++)for(var i=n[r],s=i.start,a=i.end,o=s;o<=a;o++)e.push(o);return e}};function ei(t){$r.call(this,t,"gpos")}ei.prototype=$r.prototype,ei.prototype.init=function(){var t=this.getDefaultScriptName();this.defaultKerningTables=this.getKerningTables(t)},ei.prototype.getKerningValue=function(t,e,n){for(var r=0;r<t.length;r++)for(var i=t[r].subtables,s=0;s<i.length;s++){var a=i[s],o=this.getCoverageIndex(a.coverage,e);if(!(o<0))switch(a.posFormat){case 1:for(var l=a.pairSets[o],h=0;h<l.length;h++){var u=l[h];if(u.secondGlyph===n)return u.value1&&u.value1.xAdvance||0}break;case 2:var A=this.getGlyphClass(a.classDef1,e),f=this.getGlyphClass(a.classDef2,n),d=a.classRecords[A][f];return d.value1&&d.value1.xAdvance||0}}return 0},ei.prototype.getKerningTables=function(t,e){if(this.font.tables.gpos)return this.getLookupTables(t,e,"kern",2)};function vt(t){$r.call(this,t,"gsub")}function xf(t,e){var n=t.length;if(n!==e.length)return!1;for(var r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}function Ha(t,e,n){for(var r=t.subtables,i=0;i<r.length;i++){var s=r[i];if(s.substFormat===e)return s}if(n)return r.push(n),n}vt.prototype=$r.prototype,vt.prototype.createDefaultTable=function(){return{version:1,scripts:[{tag:"DFLT",script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}}],features:[],lookups:[]}},vt.prototype.getSingle=function(t,e,n){for(var r=[],i=this.getLookupTables(e,n,t,1),s=0;s<i.length;s++)for(var a=i[s].subtables,o=0;o<a.length;o++){var l=a[o],h=this.expandCoverage(l.coverage),u=void 0;if(l.substFormat===1){var A=l.deltaGlyphId;for(u=0;u<h.length;u++){var f=h[u];r.push({sub:f,by:f+A})}}else{var d=l.substitute;for(u=0;u<h.length;u++)r.push({sub:h[u],by:d[u]})}}return r},vt.prototype.getMultiple=function(t,e,n){for(var r=[],i=this.getLookupTables(e,n,t,2),s=0;s<i.length;s++)for(var a=i[s].subtables,o=0;o<a.length;o++){var l=a[o],h=this.expandCoverage(l.coverage),u=void 0;for(u=0;u<h.length;u++){var A=h[u],f=l.sequences[u];r.push({sub:A,by:f})}}return r},vt.prototype.getAlternates=function(t,e,n){for(var r=[],i=this.getLookupTables(e,n,t,3),s=0;s<i.length;s++)for(var a=i[s].subtables,o=0;o<a.length;o++)for(var l=a[o],h=this.expandCoverage(l.coverage),u=l.alternateSets,A=0;A<h.length;A++)r.push({sub:h[A],by:u[A]});return r},vt.prototype.getLigatures=function(t,e,n){for(var r=[],i=this.getLookupTables(e,n,t,4),s=0;s<i.length;s++)for(var a=i[s].subtables,o=0;o<a.length;o++)for(var l=a[o],h=this.expandCoverage(l.coverage),u=l.ligatureSets,A=0;A<h.length;A++)for(var f=h[A],d=u[A],m=0;m<d.length;m++){var y=d[m];r.push({sub:[f].concat(y.components),by:y.ligGlyph})}return r},vt.prototype.addSingle=function(t,e,n,r){var i=this.getLookupTables(n,r,t,1,!0)[0],s=Ha(i,2,{substFormat:2,coverage:{format:1,glyphs:[]},substitute:[]});Ie.assert(s.coverage.format===1,"Single: unable to modify coverage table format "+s.coverage.format);var a=e.sub,o=this.binSearch(s.coverage.glyphs,a);o<0&&(o=-1-o,s.coverage.glyphs.splice(o,0,a),s.substitute.splice(o,0,0)),s.substitute[o]=e.by},vt.prototype.addMultiple=function(t,e,n,r){Ie.assert(e.by instanceof Array&&e.by.length>1,'Multiple: "by" must be an array of two or more ids');var i=this.getLookupTables(n,r,t,2,!0)[0],s=Ha(i,1,{substFormat:1,coverage:{format:1,glyphs:[]},sequences:[]});Ie.assert(s.coverage.format===1,"Multiple: unable to modify coverage table format "+s.coverage.format);var a=e.sub,o=this.binSearch(s.coverage.glyphs,a);o<0&&(o=-1-o,s.coverage.glyphs.splice(o,0,a),s.sequences.splice(o,0,0)),s.sequences[o]=e.by},vt.prototype.addAlternate=function(t,e,n,r){var i=this.getLookupTables(n,r,t,3,!0)[0],s=Ha(i,1,{substFormat:1,coverage:{format:1,glyphs:[]},alternateSets:[]});Ie.assert(s.coverage.format===1,"Alternate: unable to modify coverage table format "+s.coverage.format);var a=e.sub,o=this.binSearch(s.coverage.glyphs,a);o<0&&(o=-1-o,s.coverage.glyphs.splice(o,0,a),s.alternateSets.splice(o,0,0)),s.alternateSets[o]=e.by},vt.prototype.addLigature=function(t,e,n,r){var i=this.getLookupTables(n,r,t,4,!0)[0],s=i.subtables[0];s||(s={substFormat:1,coverage:{format:1,glyphs:[]},ligatureSets:[]},i.subtables[0]=s),Ie.assert(s.coverage.format===1,"Ligature: unable to modify coverage table format "+s.coverage.format);var a=e.sub[0],o=e.sub.slice(1),l={ligGlyph:e.by,components:o},h=this.binSearch(s.coverage.glyphs,a);if(h>=0){for(var u=s.ligatureSets[h],A=0;A<u.length;A++)if(xf(u[A].components,o))return;u.push(l)}else h=-1-h,s.coverage.glyphs.splice(h,0,a),s.ligatureSets.splice(h,0,[l])},vt.prototype.getFeature=function(t,e,n){if(/ss\d\d/.test(t))return this.getSingle(t,e,n);switch(t){case"aalt":case"salt":return this.getSingle(t,e,n).concat(this.getAlternates(t,e,n));case"dlig":case"liga":case"rlig":return this.getLigatures(t,e,n);case"ccmp":return this.getMultiple(t,e,n).concat(this.getLigatures(t,e,n));case"stch":return this.getMultiple(t,e,n)}},vt.prototype.add=function(t,e,n,r){if(/ss\d\d/.test(t))return this.addSingle(t,e,n,r);switch(t){case"aalt":case"salt":return typeof e.by=="number"?this.addSingle(t,e,n,r):this.addAlternate(t,e,n,r);case"dlig":case"liga":case"rlig":return this.addLigature(t,e,n,r);case"ccmp":return e.by instanceof Array?this.addMultiple(t,e,n,r):this.addLigature(t,e,n,r)}};function Sf(){return typeof window<"u"}function Bf(t){for(var e=new Buffer(t.byteLength),n=new Uint8Array(t),r=0;r<e.length;++r)e[r]=n[r];return e}function ti(t,e){if(!t)throw e}function Zc(t,e,n,r,i){var s;return(e&r)>0?(s=t.parseByte(),e&i||(s=-s),s=n+s):(e&i)>0?s=n:s=n+t.parseShort(),s}function Jc(t,e,n){var r=new xe.Parser(e,n);t.numberOfContours=r.parseShort(),t._xMin=r.parseShort(),t._yMin=r.parseShort(),t._xMax=r.parseShort(),t._yMax=r.parseShort();var i,s;if(t.numberOfContours>0){for(var a=t.endPointIndices=[],o=0;o<t.numberOfContours;o+=1)a.push(r.parseUShort());t.instructionLength=r.parseUShort(),t.instructions=[];for(var l=0;l<t.instructionLength;l+=1)t.instructions.push(r.parseByte());var h=a[a.length-1]+1;i=[];for(var u=0;u<h;u+=1)if(s=r.parseByte(),i.push(s),(s&8)>0)for(var A=r.parseByte(),f=0;f<A;f+=1)i.push(s),u+=1;if(Ie.argument(i.length===h,"Bad flags."),a.length>0){var d=[],m;if(h>0){for(var y=0;y<h;y+=1)s=i[y],m={},m.onCurve=!!(s&1),m.lastPointOfContour=a.indexOf(y)>=0,d.push(m);for(var C=0,x=0;x<h;x+=1)s=i[x],m=d[x],m.x=Zc(r,s,C,2,16),C=m.x;for(var I=0,g=0;g<h;g+=1)s=i[g],m=d[g],m.y=Zc(r,s,I,4,32),I=m.y}t.points=d}else t.points=[]}else if(t.numberOfContours===0)t.points=[];else{t.isComposite=!0,t.points=[],t.components=[];for(var v=!0;v;){i=r.parseUShort();var w={glyphIndex:r.parseUShort(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(i&1)>0?(i&2)>0?(w.dx=r.parseShort(),w.dy=r.parseShort()):w.matchedPoints=[r.parseUShort(),r.parseUShort()]:(i&2)>0?(w.dx=r.parseChar(),w.dy=r.parseChar()):w.matchedPoints=[r.parseByte(),r.parseByte()],(i&8)>0?w.xScale=w.yScale=r.parseF2Dot14():(i&64)>0?(w.xScale=r.parseF2Dot14(),w.yScale=r.parseF2Dot14()):(i&128)>0&&(w.xScale=r.parseF2Dot14(),w.scale01=r.parseF2Dot14(),w.scale10=r.parseF2Dot14(),w.yScale=r.parseF2Dot14()),t.components.push(w),v=!!(i&32)}if(i&256){t.instructionLength=r.parseUShort(),t.instructions=[];for(var b=0;b<t.instructionLength;b+=1)t.instructions.push(r.parseByte())}}}function $a(t,e){for(var n=[],r=0;r<t.length;r+=1){var i=t[r],s={x:e.xScale*i.x+e.scale01*i.y+e.dx,y:e.scale10*i.x+e.yScale*i.y+e.dy,onCurve:i.onCurve,lastPointOfContour:i.lastPointOfContour};n.push(s)}return n}function wf(t){for(var e=[],n=[],r=0;r<t.length;r+=1){var i=t[r];n.push(i),i.lastPointOfContour&&(e.push(n),n=[])}return Ie.argument(n.length===0,"There are still points left in the current contour."),e}function Hc(t){var e=new Ke;if(!t)return e;for(var n=wf(t),r=0;r<n.length;++r){var i=n[r],s=null,a=i[i.length-1],o=i[0];if(a.onCurve)e.moveTo(a.x,a.y);else if(o.onCurve)e.moveTo(o.x,o.y);else{var l={x:(a.x+o.x)*.5,y:(a.y+o.y)*.5};e.moveTo(l.x,l.y)}for(var h=0;h<i.length;++h)if(s=a,a=o,o=i[(h+1)%i.length],a.onCurve)e.lineTo(a.x,a.y);else{var u=o;s.onCurve||((a.x+s.x)*.5,(a.y+s.y)*.5),o.onCurve||(u={x:(a.x+o.x)*.5,y:(a.y+o.y)*.5}),e.quadraticCurveTo(a.x,a.y,u.x,u.y)}e.closePath()}return e}function $c(t,e){if(e.isComposite)for(var n=0;n<e.components.length;n+=1){var r=e.components[n],i=t.get(r.glyphIndex);if(i.getPath(),i.points){var s=void 0;if(r.matchedPoints===void 0)s=$a(i.points,r);else{if(r.matchedPoints[0]>e.points.length-1||r.matchedPoints[1]>i.points.length-1)throw Error("Matched points out of range in "+e.name);var a=e.points[r.matchedPoints[0]],o=i.points[r.matchedPoints[1]],l={xScale:r.xScale,scale01:r.scale01,scale10:r.scale10,yScale:r.yScale,dx:0,dy:0};o=$a([o],l)[0],l.dx=a.x-o.x,l.dy=a.y-o.y,s=$a(i.points,l)}e.points=e.points.concat(s)}}return Hc(e.points)}function bf(t,e,n,r){for(var i=new Kt.GlyphSet(r),s=0;s<n.length-1;s+=1){var a=n[s],o=n[s+1];a!==o?i.push(s,Kt.ttfGlyphLoader(r,s,Jc,t,e+a,$c)):i.push(s,Kt.glyphLoader(r,s))}return i}function _f(t,e,n,r){var i=new Kt.GlyphSet(r);return r._push=function(s){var a=n[s],o=n[s+1];a!==o?i.push(s,Kt.ttfGlyphLoader(r,s,Jc,t,e+a,$c)):i.push(s,Kt.glyphLoader(r,s))},i}function Ef(t,e,n,r,i){return i.lowMemory?_f(t,e,n,r):bf(t,e,n,r)}var Tf={getPath:Hc,parse:Ef},e3,tr,t3,eo;function n3(t){this.font=t,this.getCommands=function(e){return Tf.getPath(e).commands},this._fpgmState=this._prepState=void 0,this._errorState=0}function Mf(t){return t}function r3(t){return Math.sign(t)*Math.round(Math.abs(t))}function Df(t){return Math.sign(t)*Math.round(Math.abs(t*2))/2}function Lf(t){return Math.sign(t)*(Math.round(Math.abs(t)+.5)-.5)}function Pf(t){return Math.sign(t)*Math.ceil(Math.abs(t))}function Ff(t){return Math.sign(t)*Math.floor(Math.abs(t))}var i3=function(t){var e=this.srPeriod,n=this.srPhase,r=this.srThreshold,i=1;return t<0&&(t=-t,i=-1),t+=r-n,t=Math.trunc(t/e)*e,t+=n,t<0?n*i:t*i},Xt={x:1,y:0,axis:"x",distance:function(t,e,n,r){return(n?t.xo:t.x)-(r?e.xo:e.x)},interpolate:function(t,e,n,r){var i,s,a,o,l,h,u;if(!r||r===this){if(i=t.xo-e.xo,s=t.xo-n.xo,l=e.x-e.xo,h=n.x-n.xo,a=Math.abs(i),o=Math.abs(s),u=a+o,u===0){t.x=t.xo+(l+h)/2;return}t.x=t.xo+(l*o+h*a)/u;return}if(i=r.distance(t,e,!0,!0),s=r.distance(t,n,!0,!0),l=r.distance(e,e,!1,!0),h=r.distance(n,n,!1,!0),a=Math.abs(i),o=Math.abs(s),u=a+o,u===0){Xt.setRelative(t,t,(l+h)/2,r,!0);return}Xt.setRelative(t,t,(l*o+h*a)/u,r,!0)},normalSlope:Number.NEGATIVE_INFINITY,setRelative:function(t,e,n,r,i){if(!r||r===this){t.x=(i?e.xo:e.x)+n;return}var s=i?e.xo:e.x,a=i?e.yo:e.y,o=s+n*r.x,l=a+n*r.y;t.x=o+(t.y-l)/r.normalSlope},slope:0,touch:function(t){t.xTouched=!0},touched:function(t){return t.xTouched},untouch:function(t){t.xTouched=!1}},gn={x:0,y:1,axis:"y",distance:function(t,e,n,r){return(n?t.yo:t.y)-(r?e.yo:e.y)},interpolate:function(t,e,n,r){var i,s,a,o,l,h,u;if(!r||r===this){if(i=t.yo-e.yo,s=t.yo-n.yo,l=e.y-e.yo,h=n.y-n.yo,a=Math.abs(i),o=Math.abs(s),u=a+o,u===0){t.y=t.yo+(l+h)/2;return}t.y=t.yo+(l*o+h*a)/u;return}if(i=r.distance(t,e,!0,!0),s=r.distance(t,n,!0,!0),l=r.distance(e,e,!1,!0),h=r.distance(n,n,!1,!0),a=Math.abs(i),o=Math.abs(s),u=a+o,u===0){gn.setRelative(t,t,(l+h)/2,r,!0);return}gn.setRelative(t,t,(l*o+h*a)/u,r,!0)},normalSlope:0,setRelative:function(t,e,n,r,i){if(!r||r===this){t.y=(i?e.yo:e.y)+n;return}var s=i?e.xo:e.x,a=i?e.yo:e.y,o=s+n*r.x,l=a+n*r.y;t.y=l+r.normalSlope*(t.x-o)},slope:Number.POSITIVE_INFINITY,touch:function(t){t.yTouched=!0},touched:function(t){return t.yTouched},untouch:function(t){t.yTouched=!1}};Object.freeze(Xt),Object.freeze(gn);function ni(t,e){this.x=t,this.y=e,this.axis=void 0,this.slope=e/t,this.normalSlope=-t/e,Object.freeze(this)}ni.prototype.distance=function(t,e,n,r){return this.x*Xt.distance(t,e,n,r)+this.y*gn.distance(t,e,n,r)},ni.prototype.interpolate=function(t,e,n,r){var i,s,a,o,l,h,u;if(a=r.distance(t,e,!0,!0),o=r.distance(t,n,!0,!0),i=r.distance(e,e,!1,!0),s=r.distance(n,n,!1,!0),l=Math.abs(a),h=Math.abs(o),u=l+h,u===0){this.setRelative(t,t,(i+s)/2,r,!0);return}this.setRelative(t,t,(i*h+s*l)/u,r,!0)},ni.prototype.setRelative=function(t,e,n,r,i){r=r||this;var s=i?e.xo:e.x,a=i?e.yo:e.y,o=s+n*r.x,l=a+n*r.y,h=r.normalSlope,u=this.slope,A=t.x,f=t.y;t.x=(u*A-h*o+l-f)/(u-h),t.y=u*(t.x-A)+f},ni.prototype.touch=function(t){t.xTouched=!0,t.yTouched=!0};function ri(t,e){var n=Math.sqrt(t*t+e*e);return t/=n,e/=n,t===1&&e===0?Xt:t===0&&e===1?gn:new ni(t,e)}function mn(t,e,n,r){this.x=this.xo=Math.round(t*64)/64,this.y=this.yo=Math.round(e*64)/64,this.lastPointOfContour=n,this.onCurve=r,this.prevPointOnContour=void 0,this.nextPointOnContour=void 0,this.xTouched=!1,this.yTouched=!1,Object.preventExtensions(this)}mn.prototype.nextTouched=function(t){for(var e=this.nextPointOnContour;!t.touched(e)&&e!==this;)e=e.nextPointOnContour;return e},mn.prototype.prevTouched=function(t){for(var e=this.prevPointOnContour;!t.touched(e)&&e!==this;)e=e.prevPointOnContour;return e};var ii=Object.freeze(new mn(0,0)),kf={cvCutIn:17/16,deltaBase:9,deltaShift:.125,loop:1,minDis:1,autoFlip:!0};function Fn(t,e){switch(this.env=t,this.stack=[],this.prog=e,t){case"glyf":this.zp0=this.zp1=this.zp2=1,this.rp0=this.rp1=this.rp2=0;case"prep":this.fv=this.pv=this.dpv=Xt,this.round=r3}}n3.prototype.exec=function(t,e){if(typeof e!="number")throw new Error("Point size is not a number!");if(!(this._errorState>2)){var n=this.font,r=this._prepState;if(!r||r.ppem!==e){var i=this._fpgmState;if(!i){Fn.prototype=kf,i=this._fpgmState=new Fn("fpgm",n.tables.fpgm),i.funcs=[],i.font=n,k.DEBUG&&(console.log("---EXEC FPGM---"),i.step=-1);try{tr(i)}catch(h){console.log("Hinting error in FPGM:"+h),this._errorState=3;return}}Fn.prototype=i,r=this._prepState=new Fn("prep",n.tables.prep),r.ppem=e;var s=n.tables.cvt;if(s)for(var a=r.cvt=new Array(s.length),o=e/n.unitsPerEm,l=0;l<s.length;l++)a[l]=s[l]*o;else r.cvt=[];k.DEBUG&&(console.log("---EXEC PREP---"),r.step=-1);try{tr(r)}catch(h){this._errorState<2&&console.log("Hinting error in PREP:"+h),this._errorState=2}}if(!(this._errorState>1))try{return t3(t,r)}catch(h){this._errorState<1&&(console.log("Hinting error:"+h),console.log("Note: further hinting errors are silenced")),this._errorState=1;return}}},t3=function(t,e){var n=e.ppem/e.font.unitsPerEm,r=n,i=t.components,s,a,o;if(Fn.prototype=e,!i)o=new Fn("glyf",t.instructions),k.DEBUG&&(console.log("---EXEC GLYPH---"),o.step=-1),eo(t,o,n,r),a=o.gZone;else{var l=e.font;a=[],s=[];for(var h=0;h<i.length;h++){var u=i[h],A=l.glyphs.get(u.glyphIndex);o=new Fn("glyf",A.instructions),k.DEBUG&&(console.log("---EXEC COMP "+h+"---"),o.step=-1),eo(A,o,n,r);for(var f=Math.round(u.dx*n),d=Math.round(u.dy*r),m=o.gZone,y=o.contours,C=0;C<m.length;C++){var x=m[C];x.xTouched=x.yTouched=!1,x.xo=x.x=x.x+f,x.yo=x.y=x.y+d}var I=a.length;a.push.apply(a,m);for(var g=0;g<y.length;g++)s.push(y[g]+I)}t.instructions&&!o.inhibitGridFit&&(o=new Fn("glyf",t.instructions),o.gZone=o.z0=o.z1=o.z2=a,o.contours=s,a.push(new mn(0,0),new mn(Math.round(t.advanceWidth*n),0)),k.DEBUG&&(console.log("---EXEC COMPOSITE---"),o.step=-1),tr(o),a.length-=2)}return a},eo=function(t,e,n,r){for(var i=t.points||[],s=i.length,a=e.gZone=e.z0=e.z1=e.z2=[],o=e.contours=[],l,h=0;h<s;h++)l=i[h],a[h]=new mn(l.x*n,l.y*r,l.lastPointOfContour,l.onCurve);for(var u,A,f=0;f<s;f++)l=a[f],u||(u=l,o.push(f)),l.lastPointOfContour?(l.nextPointOnContour=u,u.prevPointOnContour=l,u=void 0):(A=a[f+1],l.nextPointOnContour=A,A.prevPointOnContour=l);if(!e.inhibitGridFit){if(k.DEBUG){console.log("PROCESSING GLYPH",e.stack);for(var d=0;d<s;d++)console.log(d,a[d].x,a[d].y)}if(a.push(new mn(0,0),new mn(Math.round(t.advanceWidth*n),0)),tr(e),a.length-=2,k.DEBUG){console.log("FINISHED GLYPH",e.stack);for(var m=0;m<s;m++)console.log(m,a[m].x,a[m].y)}}},tr=function(t){var e=t.prog;if(e){var n=e.length,r;for(t.ip=0;t.ip<n;t.ip++){if(k.DEBUG&&t.step++,r=e3[e[t.ip]],!r)throw new Error("unknown instruction: 0x"+Number(e[t.ip]).toString(16));r(t)}}};function ss(t){for(var e=t.tZone=new Array(t.gZone.length),n=0;n<e.length;n++)e[n]=new mn(0,0)}function s3(t,e){var n=t.prog,r=t.ip,i=1,s;do if(s=n[++r],s===88)i++;else if(s===89)i--;else if(s===64)r+=n[r+1]+1;else if(s===65)r+=2*n[r+1]+1;else if(s>=176&&s<=183)r+=s-176+1;else if(s>=184&&s<=191)r+=(s-184+1)*2;else if(e&&i===1&&s===27)break;while(i>0);t.ip=r}function a3(t,e){k.DEBUG&&console.log(e.step,"SVTCA["+t.axis+"]"),e.fv=e.pv=e.dpv=t}function o3(t,e){k.DEBUG&&console.log(e.step,"SPVTCA["+t.axis+"]"),e.pv=e.dpv=t}function l3(t,e){k.DEBUG&&console.log(e.step,"SFVTCA["+t.axis+"]"),e.fv=t}function c3(t,e){var n=e.stack,r=n.pop(),i=n.pop(),s=e.z2[r],a=e.z1[i];k.DEBUG&&console.log("SPVTL["+t+"]",r,i);var o,l;t?(o=s.y-a.y,l=a.x-s.x):(o=a.x-s.x,l=a.y-s.y),e.pv=e.dpv=ri(o,l)}function h3(t,e){var n=e.stack,r=n.pop(),i=n.pop(),s=e.z2[r],a=e.z1[i];k.DEBUG&&console.log("SFVTL["+t+"]",r,i);var o,l;t?(o=s.y-a.y,l=a.x-s.x):(o=a.x-s.x,l=a.y-s.y),e.fv=ri(o,l)}function Of(t){var e=t.stack,n=e.pop(),r=e.pop();k.DEBUG&&console.log(t.step,"SPVFS[]",n,r),t.pv=t.dpv=ri(r,n)}function Rf(t){var e=t.stack,n=e.pop(),r=e.pop();k.DEBUG&&console.log(t.step,"SPVFS[]",n,r),t.fv=ri(r,n)}function Uf(t){var e=t.stack,n=t.pv;k.DEBUG&&console.log(t.step,"GPV[]"),e.push(n.x*16384),e.push(n.y*16384)}function Qf(t){var e=t.stack,n=t.fv;k.DEBUG&&console.log(t.step,"GFV[]"),e.push(n.x*16384),e.push(n.y*16384)}function Nf(t){t.fv=t.pv,k.DEBUG&&console.log(t.step,"SFVTPV[]")}function Gf(t){var e=t.stack,n=e.pop(),r=e.pop(),i=e.pop(),s=e.pop(),a=e.pop(),o=t.z0,l=t.z1,h=o[n],u=o[r],A=l[i],f=l[s],d=t.z2[a];k.DEBUG&&console.log("ISECT[], ",n,r,i,s,a);var m=h.x,y=h.y,C=u.x,x=u.y,I=A.x,g=A.y,v=f.x,w=f.y,b=(m-C)*(g-w)-(y-x)*(I-v),B=m*x-y*C,_=I*w-g*v;d.x=(B*(I-v)-_*(m-C))/b,d.y=(B*(g-w)-_*(y-x))/b}function Vf(t){t.rp0=t.stack.pop(),k.DEBUG&&console.log(t.step,"SRP0[]",t.rp0)}function zf(t){t.rp1=t.stack.pop(),k.DEBUG&&console.log(t.step,"SRP1[]",t.rp1)}function Wf(t){t.rp2=t.stack.pop(),k.DEBUG&&console.log(t.step,"SRP2[]",t.rp2)}function Yf(t){var e=t.stack.pop();switch(k.DEBUG&&console.log(t.step,"SZP0[]",e),t.zp0=e,e){case 0:t.tZone||ss(t),t.z0=t.tZone;break;case 1:t.z0=t.gZone;break;default:throw new Error("Invalid zone pointer")}}function jf(t){var e=t.stack.pop();switch(k.DEBUG&&console.log(t.step,"SZP1[]",e),t.zp1=e,e){case 0:t.tZone||ss(t),t.z1=t.tZone;break;case 1:t.z1=t.gZone;break;default:throw new Error("Invalid zone pointer")}}function qf(t){var e=t.stack.pop();switch(k.DEBUG&&console.log(t.step,"SZP2[]",e),t.zp2=e,e){case 0:t.tZone||ss(t),t.z2=t.tZone;break;case 1:t.z2=t.gZone;break;default:throw new Error("Invalid zone pointer")}}function Kf(t){var e=t.stack.pop();switch(k.DEBUG&&console.log(t.step,"SZPS[]",e),t.zp0=t.zp1=t.zp2=e,e){case 0:t.tZone||ss(t),t.z0=t.z1=t.z2=t.tZone;break;case 1:t.z0=t.z1=t.z2=t.gZone;break;default:throw new Error("Invalid zone pointer")}}function Xf(t){t.loop=t.stack.pop(),k.DEBUG&&console.log(t.step,"SLOOP[]",t.loop)}function Zf(t){k.DEBUG&&console.log(t.step,"RTG[]"),t.round=r3}function Jf(t){k.DEBUG&&console.log(t.step,"RTHG[]"),t.round=Lf}function Hf(t){var e=t.stack.pop();k.DEBUG&&console.log(t.step,"SMD[]",e),t.minDis=e/64}function $f(t){k.DEBUG&&console.log(t.step,"ELSE[]"),s3(t,!1)}function ed(t){var e=t.stack.pop();k.DEBUG&&console.log(t.step,"JMPR[]",e),t.ip+=e-1}function td(t){var e=t.stack.pop();k.DEBUG&&console.log(t.step,"SCVTCI[]",e),t.cvCutIn=e/64}function nd(t){var e=t.stack;k.DEBUG&&console.log(t.step,"DUP[]"),e.push(e[e.length-1])}function to(t){k.DEBUG&&console.log(t.step,"POP[]"),t.stack.pop()}function rd(t){k.DEBUG&&console.log(t.step,"CLEAR[]"),t.stack.length=0}function id(t){var e=t.stack,n=e.pop(),r=e.pop();k.DEBUG&&console.log(t.step,"SWAP[]"),e.push(n),e.push(r)}function sd(t){var e=t.stack;k.DEBUG&&console.log(t.step,"DEPTH[]"),e.push(e.length)}function ad(t){var e=t.stack,n=e.pop(),r=e.pop();k.DEBUG&&console.log(t.step,"LOOPCALL[]",n,r);var i=t.ip,s=t.prog;t.prog=t.funcs[n];for(var a=0;a<r;a++)tr(t),k.DEBUG&&console.log(++t.step,a+1<r?"next loopcall":"done loopcall",a);t.ip=i,t.prog=s}function od(t){var e=t.stack.pop();k.DEBUG&&console.log(t.step,"CALL[]",e);var n=t.ip,r=t.prog;t.prog=t.funcs[e],tr(t),t.ip=n,t.prog=r,k.DEBUG&&console.log(++t.step,"returning from",e)}function ld(t){var e=t.stack,n=e.pop();k.DEBUG&&console.log(t.step,"CINDEX[]",n),e.push(e[e.length-n])}function cd(t){var e=t.stack,n=e.pop();k.DEBUG&&console.log(t.step,"MINDEX[]",n),e.push(e.splice(e.length-n,1)[0])}function hd(t){if(t.env!=="fpgm")throw new Error("FDEF not allowed here");var e=t.stack,n=t.prog,r=t.ip,i=e.pop(),s=r;for(k.DEBUG&&console.log(t.step,"FDEF[]",i);n[++r]!==45;);t.ip=r,t.funcs[i]=n.slice(s+1,r)}function u3(t,e){var n=e.stack.pop(),r=e.z0[n],i=e.fv,s=e.pv;k.DEBUG&&console.log(e.step,"MDAP["+t+"]",n);var a=s.distance(r,ii);t&&(a=e.round(a)),i.setRelative(r,ii,a,s),i.touch(r),e.rp0=e.rp1=n}function A3(t,e){var n=e.z2,r=n.length-2,i,s,a;k.DEBUG&&console.log(e.step,"IUP["+t.axis+"]");for(var o=0;o<r;o++)i=n[o],!t.touched(i)&&(s=i.prevTouched(t),s!==i&&(a=i.nextTouched(t),s===a&&t.setRelative(i,i,t.distance(s,s,!1,!0),t,!0),t.interpolate(i,s,a,t)))}function f3(t,e){for(var n=e.stack,r=t?e.rp1:e.rp2,i=(t?e.z0:e.z1)[r],s=e.fv,a=e.pv,o=e.loop,l=e.z2;o--;){var h=n.pop(),u=l[h],A=a.distance(i,i,!1,!0);s.setRelative(u,u,A,a),s.touch(u),k.DEBUG&&console.log(e.step,(e.loop>1?"loop "+(e.loop-o)+": ":"")+"SHP["+(t?"rp1":"rp2")+"]",h)}e.loop=1}function d3(t,e){var n=e.stack,r=t?e.rp1:e.rp2,i=(t?e.z0:e.z1)[r],s=e.fv,a=e.pv,o=n.pop(),l=e.z2[e.contours[o]],h=l;k.DEBUG&&console.log(e.step,"SHC["+t+"]",o);var u=a.distance(i,i,!1,!0);do h!==i&&s.setRelative(h,h,u,a),h=h.nextPointOnContour;while(h!==l)}function p3(t,e){var n=e.stack,r=t?e.rp1:e.rp2,i=(t?e.z0:e.z1)[r],s=e.fv,a=e.pv,o=n.pop();k.DEBUG&&console.log(e.step,"SHZ["+t+"]",o);var l;switch(o){case 0:l=e.tZone;break;case 1:l=e.gZone;break;default:throw new Error("Invalid zone")}for(var h,u=a.distance(i,i,!1,!0),A=l.length-2,f=0;f<A;f++)h=l[f],s.setRelative(h,h,u,a)}function ud(t){for(var e=t.stack,n=t.loop,r=t.fv,i=e.pop()/64,s=t.z2;n--;){var a=e.pop(),o=s[a];k.DEBUG&&console.log(t.step,(t.loop>1?"loop "+(t.loop-n)+": ":"")+"SHPIX[]",a,i),r.setRelative(o,o,i),r.touch(o)}t.loop=1}function Ad(t){for(var e=t.stack,n=t.rp1,r=t.rp2,i=t.loop,s=t.z0[n],a=t.z1[r],o=t.fv,l=t.dpv,h=t.z2;i--;){var u=e.pop(),A=h[u];k.DEBUG&&console.log(t.step,(t.loop>1?"loop "+(t.loop-i)+": ":"")+"IP[]",u,n,"<->",r),o.interpolate(A,s,a,l),o.touch(A)}t.loop=1}function g3(t,e){var n=e.stack,r=n.pop()/64,i=n.pop(),s=e.z1[i],a=e.z0[e.rp0],o=e.fv,l=e.pv;o.setRelative(s,a,r,l),o.touch(s),k.DEBUG&&console.log(e.step,"MSIRP["+t+"]",r,i),e.rp1=e.rp0,e.rp2=i,t&&(e.rp0=i)}function fd(t){for(var e=t.stack,n=t.rp0,r=t.z0[n],i=t.loop,s=t.fv,a=t.pv,o=t.z1;i--;){var l=e.pop(),h=o[l];k.DEBUG&&console.log(t.step,(t.loop>1?"loop "+(t.loop-i)+": ":"")+"ALIGNRP[]",l),s.setRelative(h,r,0,a),s.touch(h)}t.loop=1}function dd(t){k.DEBUG&&console.log(t.step,"RTDG[]"),t.round=Df}function m3(t,e){var n=e.stack,r=n.pop(),i=n.pop(),s=e.z0[i],a=e.fv,o=e.pv,l=e.cvt[r];k.DEBUG&&console.log(e.step,"MIAP["+t+"]",r,"(",l,")",i);var h=o.distance(s,ii);t&&(Math.abs(h-l)<e.cvCutIn&&(h=l),h=e.round(h)),a.setRelative(s,ii,h,o),e.zp0===0&&(s.xo=s.x,s.yo=s.y),a.touch(s),e.rp0=e.rp1=i}function pd(t){var e=t.prog,n=t.ip,r=t.stack,i=e[++n];k.DEBUG&&console.log(t.step,"NPUSHB[]",i);for(var s=0;s<i;s++)r.push(e[++n]);t.ip=n}function gd(t){var e=t.ip,n=t.prog,r=t.stack,i=n[++e];k.DEBUG&&console.log(t.step,"NPUSHW[]",i);for(var s=0;s<i;s++){var a=n[++e]<<8|n[++e];a&32768&&(a=-((a^65535)+1)),r.push(a)}t.ip=e}function md(t){var e=t.stack,n=t.store;n||(n=t.store=[]);var r=e.pop(),i=e.pop();k.DEBUG&&console.log(t.step,"WS",r,i),n[i]=r}function vd(t){var e=t.stack,n=t.store,r=e.pop();k.DEBUG&&console.log(t.step,"RS",r);var i=n&&n[r]||0;e.push(i)}function yd(t){var e=t.stack,n=e.pop(),r=e.pop();k.DEBUG&&console.log(t.step,"WCVTP",n,r),t.cvt[r]=n/64}function Cd(t){var e=t.stack,n=e.pop();k.DEBUG&&console.log(t.step,"RCVT",n),e.push(t.cvt[n]*64)}function v3(t,e){var n=e.stack,r=n.pop(),i=e.z2[r];k.DEBUG&&console.log(e.step,"GC["+t+"]",r),n.push(e.dpv.distance(i,ii,t,!1)*64)}function y3(t,e){var n=e.stack,r=n.pop(),i=n.pop(),s=e.z1[r],a=e.z0[i],o=e.dpv.distance(a,s,t,t);k.DEBUG&&console.log(e.step,"MD["+t+"]",r,i,"->",o),e.stack.push(Math.round(o*64))}function Id(t){k.DEBUG&&console.log(t.step,"MPPEM[]"),t.stack.push(t.ppem)}function xd(t){k.DEBUG&&console.log(t.step,"FLIPON[]"),t.autoFlip=!0}function Sd(t){var e=t.stack,n=e.pop(),r=e.pop();k.DEBUG&&console.log(t.step,"LT[]",n,r),e.push(r<n?1:0)}function Bd(t){var e=t.stack,n=e.pop(),r=e.pop();k.DEBUG&&console.log(t.step,"LTEQ[]",n,r),e.push(r<=n?1:0)}function wd(t){var e=t.stack,n=e.pop(),r=e.pop();k.DEBUG&&console.log(t.step,"GT[]",n,r),e.push(r>n?1:0)}function bd(t){var e=t.stack,n=e.pop(),r=e.pop();k.DEBUG&&console.log(t.step,"GTEQ[]",n,r),e.push(r>=n?1:0)}function _d(t){var e=t.stack,n=e.pop(),r=e.pop();k.DEBUG&&console.log(t.step,"EQ[]",n,r),e.push(n===r?1:0)}function Ed(t){var e=t.stack,n=e.pop(),r=e.pop();k.DEBUG&&console.log(t.step,"NEQ[]",n,r),e.push(n!==r?1:0)}function Td(t){var e=t.stack,n=e.pop();k.DEBUG&&console.log(t.step,"ODD[]",n),e.push(Math.trunc(n)%2?1:0)}function Md(t){var e=t.stack,n=e.pop();k.DEBUG&&console.log(t.step,"EVEN[]",n),e.push(Math.trunc(n)%2?0:1)}function Dd(t){var e=t.stack.pop();k.DEBUG&&console.log(t.step,"IF[]",e),e||(s3(t,!0),k.DEBUG&&console.log(t.step,"EIF[]"))}function Ld(t){k.DEBUG&&console.log(t.step,"EIF[]")}function Pd(t){var e=t.stack,n=e.pop(),r=e.pop();k.DEBUG&&console.log(t.step,"AND[]",n,r),e.push(n&&r?1:0)}function Fd(t){var e=t.stack,n=e.pop(),r=e.pop();k.DEBUG&&console.log(t.step,"OR[]",n,r),e.push(n||r?1:0)}function kd(t){var e=t.stack,n=e.pop();k.DEBUG&&console.log(t.step,"NOT[]",n),e.push(n?0:1)}function no(t,e){var n=e.stack,r=n.pop(),i=e.fv,s=e.pv,a=e.ppem,o=e.deltaBase+(t-1)*16,l=e.deltaShift,h=e.z0;k.DEBUG&&console.log(e.step,"DELTAP["+t+"]",r,n);for(var u=0;u<r;u++){var A=n.pop(),f=n.pop(),d=o+((f&240)>>4);if(d===a){var m=(f&15)-8;m>=0&&m++,k.DEBUG&&console.log(e.step,"DELTAPFIX",A,"by",m*l);var y=h[A];i.setRelative(y,y,m*l,s)}}}function Od(t){var e=t.stack,n=e.pop();k.DEBUG&&console.log(t.step,"SDB[]",n),t.deltaBase=n}function Rd(t){var e=t.stack,n=e.pop();k.DEBUG&&console.log(t.step,"SDS[]",n),t.deltaShift=Math.pow(.5,n)}function Ud(t){var e=t.stack,n=e.pop(),r=e.pop();k.DEBUG&&console.log(t.step,"ADD[]",n,r),e.push(r+n)}function Qd(t){var e=t.stack,n=e.pop(),r=e.pop();k.DEBUG&&console.log(t.step,"SUB[]",n,r),e.push(r-n)}function Nd(t){var e=t.stack,n=e.pop(),r=e.pop();k.DEBUG&&console.log(t.step,"DIV[]",n,r),e.push(r*64/n)}function Gd(t){var e=t.stack,n=e.pop(),r=e.pop();k.DEBUG&&console.log(t.step,"MUL[]",n,r),e.push(r*n/64)}function Vd(t){var e=t.stack,n=e.pop();k.DEBUG&&console.log(t.step,"ABS[]",n),e.push(Math.abs(n))}function zd(t){var e=t.stack,n=e.pop();k.DEBUG&&console.log(t.step,"NEG[]",n),e.push(-n)}function Wd(t){var e=t.stack,n=e.pop();k.DEBUG&&console.log(t.step,"FLOOR[]",n),e.push(Math.floor(n/64)*64)}function Yd(t){var e=t.stack,n=e.pop();k.DEBUG&&console.log(t.step,"CEILING[]",n),e.push(Math.ceil(n/64)*64)}function as(t,e){var n=e.stack,r=n.pop();k.DEBUG&&console.log(e.step,"ROUND[]"),n.push(e.round(r/64)*64)}function jd(t){var e=t.stack,n=e.pop(),r=e.pop();k.DEBUG&&console.log(t.step,"WCVTF[]",n,r),t.cvt[r]=n*t.ppem/t.font.unitsPerEm}function ro(t,e){var n=e.stack,r=n.pop(),i=e.ppem,s=e.deltaBase+(t-1)*16,a=e.deltaShift;k.DEBUG&&console.log(e.step,"DELTAC["+t+"]",r,n);for(var o=0;o<r;o++){var l=n.pop(),h=n.pop(),u=s+((h&240)>>4);if(u===i){var A=(h&15)-8;A>=0&&A++;var f=A*a;k.DEBUG&&console.log(e.step,"DELTACFIX",l,"by",f),e.cvt[l]+=f}}}function qd(t){var e=t.stack.pop();k.DEBUG&&console.log(t.step,"SROUND[]",e),t.round=i3;var n;switch(e&192){case 0:n=.5;break;case 64:n=1;break;case 128:n=2;break;default:throw new Error("invalid SROUND value")}switch(t.srPeriod=n,e&48){case 0:t.srPhase=0;break;case 16:t.srPhase=.25*n;break;case 32:t.srPhase=.5*n;break;case 48:t.srPhase=.75*n;break;default:throw new Error("invalid SROUND value")}e&=15,e===0?t.srThreshold=0:t.srThreshold=(e/8-.5)*n}function Kd(t){var e=t.stack.pop();k.DEBUG&&console.log(t.step,"S45ROUND[]",e),t.round=i3;var n;switch(e&192){case 0:n=Math.sqrt(2)/2;break;case 64:n=Math.sqrt(2);break;case 128:n=2*Math.sqrt(2);break;default:throw new Error("invalid S45ROUND value")}switch(t.srPeriod=n,e&48){case 0:t.srPhase=0;break;case 16:t.srPhase=.25*n;break;case 32:t.srPhase=.5*n;break;case 48:t.srPhase=.75*n;break;default:throw new Error("invalid S45ROUND value")}e&=15,e===0?t.srThreshold=0:t.srThreshold=(e/8-.5)*n}function Xd(t){k.DEBUG&&console.log(t.step,"ROFF[]"),t.round=Mf}function Zd(t){k.DEBUG&&console.log(t.step,"RUTG[]"),t.round=Pf}function Jd(t){k.DEBUG&&console.log(t.step,"RDTG[]"),t.round=Ff}function Hd(t){var e=t.stack.pop();k.DEBUG&&console.log(t.step,"SCANCTRL[]",e)}function C3(t,e){var n=e.stack,r=n.pop(),i=n.pop(),s=e.z2[r],a=e.z1[i];k.DEBUG&&console.log(e.step,"SDPVTL["+t+"]",r,i);var o,l;t?(o=s.y-a.y,l=a.x-s.x):(o=a.x-s.x,l=a.y-s.y),e.dpv=ri(o,l)}function $d(t){var e=t.stack,n=e.pop(),r=0;k.DEBUG&&console.log(t.step,"GETINFO[]",n),n&1&&(r=35),n&32&&(r|=4096),e.push(r)}function e5(t){var e=t.stack,n=e.pop(),r=e.pop(),i=e.pop();k.DEBUG&&console.log(t.step,"ROLL[]"),e.push(r),e.push(n),e.push(i)}function t5(t){var e=t.stack,n=e.pop(),r=e.pop();k.DEBUG&&console.log(t.step,"MAX[]",n,r),e.push(Math.max(r,n))}function n5(t){var e=t.stack,n=e.pop(),r=e.pop();k.DEBUG&&console.log(t.step,"MIN[]",n,r),e.push(Math.min(r,n))}function r5(t){var e=t.stack.pop();k.DEBUG&&console.log(t.step,"SCANTYPE[]",e)}function i5(t){var e=t.stack.pop(),n=t.stack.pop();switch(k.DEBUG&&console.log(t.step,"INSTCTRL[]",e,n),e){case 1:t.inhibitGridFit=!!n;return;case 2:t.ignoreCvt=!!n;return;default:throw new Error("invalid INSTCTRL[] selector")}}function kn(t,e){var n=e.stack,r=e.prog,i=e.ip;k.DEBUG&&console.log(e.step,"PUSHB["+t+"]");for(var s=0;s<t;s++)n.push(r[++i]);e.ip=i}function On(t,e){var n=e.ip,r=e.prog,i=e.stack;k.DEBUG&&console.log(e.ip,"PUSHW["+t+"]");for(var s=0;s<t;s++){var a=r[++n]<<8|r[++n];a&32768&&(a=-((a^65535)+1)),i.push(a)}e.ip=n}function ce(t,e,n,r,i,s){var a=s.stack,o=t&&a.pop(),l=a.pop(),h=s.rp0,u=s.z0[h],A=s.z1[l],f=s.minDis,d=s.fv,m=s.dpv,y,C,x,I;C=y=m.distance(A,u,!0,!0),x=C>=0?1:-1,C=Math.abs(C),t&&(I=s.cvt[o],r&&Math.abs(C-I)<s.cvCutIn&&(C=I)),n&&C<f&&(C=f),r&&(C=s.round(C)),d.setRelative(A,u,x*C,m),d.touch(A),k.DEBUG&&console.log(s.step,(t?"MIRP[":"MDRP[")+(e?"M":"m")+(n?">":"_")+(r?"R":"_")+(i===0?"Gr":i===1?"Bl":i===2?"Wh":"")+"]",t?o+"("+s.cvt[o]+","+I+")":"",l,"(d =",y,"->",x*C,")"),s.rp1=s.rp0,s.rp2=l,e&&(s.rp0=l)}e3=[a3.bind(void 0,gn),a3.bind(void 0,Xt),o3.bind(void 0,gn),o3.bind(void 0,Xt),l3.bind(void 0,gn),l3.bind(void 0,Xt),c3.bind(void 0,0),c3.bind(void 0,1),h3.bind(void 0,0),h3.bind(void 0,1),Of,Rf,Uf,Qf,Nf,Gf,Vf,zf,Wf,Yf,jf,qf,Kf,Xf,Zf,Jf,Hf,$f,ed,td,void 0,void 0,nd,to,rd,id,sd,ld,cd,void 0,void 0,void 0,ad,od,hd,void 0,u3.bind(void 0,0),u3.bind(void 0,1),A3.bind(void 0,gn),A3.bind(void 0,Xt),f3.bind(void 0,0),f3.bind(void 0,1),d3.bind(void 0,0),d3.bind(void 0,1),p3.bind(void 0,0),p3.bind(void 0,1),ud,Ad,g3.bind(void 0,0),g3.bind(void 0,1),fd,dd,m3.bind(void 0,0),m3.bind(void 0,1),pd,gd,md,vd,yd,Cd,v3.bind(void 0,0),v3.bind(void 0,1),void 0,y3.bind(void 0,0),y3.bind(void 0,1),Id,void 0,xd,void 0,void 0,Sd,Bd,wd,bd,_d,Ed,Td,Md,Dd,Ld,Pd,Fd,kd,no.bind(void 0,1),Od,Rd,Ud,Qd,Nd,Gd,Vd,zd,Wd,Yd,as.bind(void 0,0),as.bind(void 0,1),as.bind(void 0,2),as.bind(void 0,3),void 0,void 0,void 0,void 0,jd,no.bind(void 0,2),no.bind(void 0,3),ro.bind(void 0,1),ro.bind(void 0,2),ro.bind(void 0,3),qd,Kd,void 0,void 0,Xd,void 0,Zd,Jd,to,to,void 0,void 0,void 0,void 0,void 0,Hd,C3.bind(void 0,0),C3.bind(void 0,1),$d,void 0,e5,t5,n5,r5,i5,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,kn.bind(void 0,1),kn.bind(void 0,2),kn.bind(void 0,3),kn.bind(void 0,4),kn.bind(void 0,5),kn.bind(void 0,6),kn.bind(void 0,7),kn.bind(void 0,8),On.bind(void 0,1),On.bind(void 0,2),On.bind(void 0,3),On.bind(void 0,4),On.bind(void 0,5),On.bind(void 0,6),On.bind(void 0,7),On.bind(void 0,8),ce.bind(void 0,0,0,0,0,0),ce.bind(void 0,0,0,0,0,1),ce.bind(void 0,0,0,0,0,2),ce.bind(void 0,0,0,0,0,3),ce.bind(void 0,0,0,0,1,0),ce.bind(void 0,0,0,0,1,1),ce.bind(void 0,0,0,0,1,2),ce.bind(void 0,0,0,0,1,3),ce.bind(void 0,0,0,1,0,0),ce.bind(void 0,0,0,1,0,1),ce.bind(void 0,0,0,1,0,2),ce.bind(void 0,0,0,1,0,3),ce.bind(void 0,0,0,1,1,0),ce.bind(void 0,0,0,1,1,1),ce.bind(void 0,0,0,1,1,2),ce.bind(void 0,0,0,1,1,3),ce.bind(void 0,0,1,0,0,0),ce.bind(void 0,0,1,0,0,1),ce.bind(void 0,0,1,0,0,2),ce.bind(void 0,0,1,0,0,3),ce.bind(void 0,0,1,0,1,0),ce.bind(void 0,0,1,0,1,1),ce.bind(void 0,0,1,0,1,2),ce.bind(void 0,0,1,0,1,3),ce.bind(void 0,0,1,1,0,0),ce.bind(void 0,0,1,1,0,1),ce.bind(void 0,0,1,1,0,2),ce.bind(void 0,0,1,1,0,3),ce.bind(void 0,0,1,1,1,0),ce.bind(void 0,0,1,1,1,1),ce.bind(void 0,0,1,1,1,2),ce.bind(void 0,0,1,1,1,3),ce.bind(void 0,1,0,0,0,0),ce.bind(void 0,1,0,0,0,1),ce.bind(void 0,1,0,0,0,2),ce.bind(void 0,1,0,0,0,3),ce.bind(void 0,1,0,0,1,0),ce.bind(void 0,1,0,0,1,1),ce.bind(void 0,1,0,0,1,2),ce.bind(void 0,1,0,0,1,3),ce.bind(void 0,1,0,1,0,0),ce.bind(void 0,1,0,1,0,1),ce.bind(void 0,1,0,1,0,2),ce.bind(void 0,1,0,1,0,3),ce.bind(void 0,1,0,1,1,0),ce.bind(void 0,1,0,1,1,1),ce.bind(void 0,1,0,1,1,2),ce.bind(void 0,1,0,1,1,3),ce.bind(void 0,1,1,0,0,0),ce.bind(void 0,1,1,0,0,1),ce.bind(void 0,1,1,0,0,2),ce.bind(void 0,1,1,0,0,3),ce.bind(void 0,1,1,0,1,0),ce.bind(void 0,1,1,0,1,1),ce.bind(void 0,1,1,0,1,2),ce.bind(void 0,1,1,0,1,3),ce.bind(void 0,1,1,1,0,0),ce.bind(void 0,1,1,1,0,1),ce.bind(void 0,1,1,1,0,2),ce.bind(void 0,1,1,1,0,3),ce.bind(void 0,1,1,1,1,0),ce.bind(void 0,1,1,1,1,1),ce.bind(void 0,1,1,1,1,2),ce.bind(void 0,1,1,1,1,3)];function Tr(t){this.char=t,this.state={},this.activeState=null}function io(t,e,n){this.contextName=n,this.startIndex=t,this.endOffset=e}function s5(t,e,n){this.contextName=t,this.openRange=null,this.ranges=[],this.checkStart=e,this.checkEnd=n}function Rt(t,e){this.context=t,this.index=e,this.length=t.length,this.current=t[e],this.backtrack=t.slice(0,e),this.lookahead=t.slice(e+1)}function os(t){this.eventId=t,this.subscribers=[]}function a5(t){var e=this,n=["start","end","next","newToken","contextStart","contextEnd","insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD","updateContextsRanges"];n.forEach(function(i){Object.defineProperty(e.events,i,{value:new os(i)})}),t&&n.forEach(function(i){var s=t[i];typeof s=="function"&&e.events[i].subscribe(s)});var r=["insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD"];r.forEach(function(i){e.events[i].subscribe(e.updateContextsRanges)})}function ze(t){this.tokens=[],this.registeredContexts={},this.contextCheckers=[],this.events={},this.registeredModifiers=[],a5.call(this,t)}Tr.prototype.setState=function(t,e){return this.state[t]=e,this.activeState={key:t,value:this.state[t]},this.activeState},Tr.prototype.getState=function(t){return this.state[t]||null},ze.prototype.inboundIndex=function(t){return t>=0&&t<this.tokens.length},ze.prototype.composeRUD=function(t){var e=this,n=!0,r=t.map(function(s){return e[s[0]].apply(e,s.slice(1).concat(n))}),i=function(s){return typeof s=="object"&&s.hasOwnProperty("FAIL")};if(r.every(i))return{FAIL:"composeRUD: one or more operations hasn't completed successfully",report:r.filter(i)};this.dispatch("composeRUD",[r.filter(function(s){return!i(s)})])},ze.prototype.replaceRange=function(t,e,n,r){e=e!==null?e:this.tokens.length;var i=n.every(function(a){return a instanceof Tr});if(!isNaN(t)&&this.inboundIndex(t)&&i){var s=this.tokens.splice.apply(this.tokens,[t,e].concat(n));return r||this.dispatch("replaceToken",[t,e,n]),[s,n]}else return{FAIL:"replaceRange: invalid tokens or startIndex."}},ze.prototype.replaceToken=function(t,e,n){if(!isNaN(t)&&this.inboundIndex(t)&&e instanceof Tr){var r=this.tokens.splice(t,1,e);return n||this.dispatch("replaceToken",[t,e]),[r[0],e]}else return{FAIL:"replaceToken: invalid token or index."}},ze.prototype.removeRange=function(t,e,n){e=isNaN(e)?this.tokens.length:e;var r=this.tokens.splice(t,e);return n||this.dispatch("removeRange",[r,t,e]),r},ze.prototype.removeToken=function(t,e){if(!isNaN(t)&&this.inboundIndex(t)){var n=this.tokens.splice(t,1);return e||this.dispatch("removeToken",[n,t]),n}else return{FAIL:"removeToken: invalid token index."}},ze.prototype.insertToken=function(t,e,n){var r=t.every(function(i){return i instanceof Tr});return r?(this.tokens.splice.apply(this.tokens,[e,0].concat(t)),n||this.dispatch("insertToken",[t,e]),t):{FAIL:"insertToken: invalid token(s)."}},ze.prototype.registerModifier=function(t,e,n){this.events.newToken.subscribe(function(r,i){var s=[r,i],a=e===null||e.apply(this,s)===!0,o=[r,i];if(a){var l=n.apply(this,o);r.setState(t,l)}}),this.registeredModifiers.push(t)},os.prototype.subscribe=function(t){return typeof t=="function"?this.subscribers.push(t)-1:{FAIL:"invalid '"+this.eventId+"' event handler"}},os.prototype.unsubscribe=function(t){this.subscribers.splice(t,1)},Rt.prototype.setCurrentIndex=function(t){this.index=t,this.current=this.context[t],this.backtrack=this.context.slice(0,t),this.lookahead=this.context.slice(t+1)},Rt.prototype.get=function(t){switch(!0){case t===0:return this.current;case(t<0&&Math.abs(t)<=this.backtrack.length):return this.backtrack.slice(t)[0];case(t>0&&t<=this.lookahead.length):return this.lookahead[t-1];default:return null}},ze.prototype.rangeToText=function(t){if(t instanceof io)return this.getRangeTokens(t).map(function(e){return e.char}).join("")},ze.prototype.getText=function(){return this.tokens.map(function(t){return t.char}).join("")},ze.prototype.getContext=function(t){var e=this.registeredContexts[t];return e||null},ze.prototype.on=function(t,e){var n=this.events[t];return n?n.subscribe(e):null},ze.prototype.dispatch=function(t,e){var n=this,r=this.events[t];r instanceof os&&r.subscribers.forEach(function(i){i.apply(n,e||[])})},ze.prototype.registerContextChecker=function(t,e,n){if(this.getContext(t))return{FAIL:"context name '"+t+"' is already registered."};if(typeof e!="function")return{FAIL:"missing context start check."};if(typeof n!="function")return{FAIL:"missing context end check."};var r=new s5(t,e,n);return this.registeredContexts[t]=r,this.contextCheckers.push(r),r},ze.prototype.getRangeTokens=function(t){var e=t.startIndex+t.endOffset;return[].concat(this.tokens.slice(t.startIndex,e))},ze.prototype.getContextRanges=function(t){var e=this.getContext(t);return e?e.ranges:{FAIL:"context checker '"+t+"' is not registered."}},ze.prototype.resetContextsRanges=function(){var t=this.registeredContexts;for(var e in t)if(t.hasOwnProperty(e)){var n=t[e];n.ranges=[]}},ze.prototype.updateContextsRanges=function(){this.resetContextsRanges();for(var t=this.tokens.map(function(r){return r.char}),e=0;e<t.length;e++){var n=new Rt(t,e);this.runContextCheck(n)}this.dispatch("updateContextsRanges",[this.registeredContexts])},ze.prototype.setEndOffset=function(t,e){var n=this.getContext(e).openRange.startIndex,r=new io(n,t,e),i=this.getContext(e).ranges;return r.rangeId=e+"."+i.length,i.push(r),this.getContext(e).openRange=null,r},ze.prototype.runContextCheck=function(t){var e=this,n=t.index;this.contextCheckers.forEach(function(r){var i=r.contextName,s=e.getContext(i).openRange;if(!s&&r.checkStart(t)&&(s=new io(n,null,i),e.getContext(i).openRange=s,e.dispatch("contextStart",[i,n])),s&&r.checkEnd(t)){var a=n-s.startIndex+1,o=e.setEndOffset(a,i);e.dispatch("contextEnd",[i,o])}})},ze.prototype.tokenize=function(t){this.tokens=[],this.resetContextsRanges();var e=Array.from(t);this.dispatch("start");for(var n=0;n<e.length;n++){var r=e[n],i=new Rt(e,n);this.dispatch("next",[i]),this.runContextCheck(i);var s=new Tr(r);this.tokens.push(s),this.dispatch("newToken",[s,i])}return this.dispatch("end",[this.tokens]),this.tokens};function Rn(t){return/[\u0600-\u065F\u066A-\u06D2\u06FA-\u06FF]/.test(t)}function I3(t){return/[\u0630\u0690\u0621\u0631\u0661\u0671\u0622\u0632\u0672\u0692\u06C2\u0623\u0673\u0693\u06C3\u0624\u0694\u06C4\u0625\u0675\u0695\u06C5\u06E5\u0676\u0696\u06C6\u0627\u0677\u0697\u06C7\u0648\u0688\u0698\u06C8\u0689\u0699\u06C9\u068A\u06CA\u066B\u068B\u06CB\u068C\u068D\u06CD\u06FD\u068E\u06EE\u06FE\u062F\u068F\u06CF\u06EF]/.test(t)}function Un(t){return/[\u0600-\u0605\u060C-\u060E\u0610-\u061B\u061E\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED]/.test(t)}function ls(t){return/[A-z]/.test(t)}function o5(t){return/\s/.test(t)}function yt(t){this.font=t,this.features={}}function nr(t){this.id=t.id,this.tag=t.tag,this.substitution=t.substitution}function si(t,e){if(!t)return-1;switch(e.format){case 1:return e.glyphs.indexOf(t);case 2:for(var n=e.ranges,r=0;r<n.length;r++){var i=n[r];if(t>=i.start&&t<=i.end){var s=t-i.start;return i.index+s}}break;default:return-1}return-1}function l5(t,e){var n=si(t,e.coverage);return n===-1?null:t+e.deltaGlyphId}function c5(t,e){var n=si(t,e.coverage);return n===-1?null:e.substitute[n]}function so(t,e){for(var n=[],r=0;r<t.length;r++){var i=t[r],s=e.current;s=Array.isArray(s)?s[0]:s;var a=si(s,i);a!==-1&&n.push(a)}return n.length!==t.length?-1:n}function h5(t,e){var n=e.inputCoverage.length+e.lookaheadCoverage.length+e.backtrackCoverage.length;if(t.context.length<n)return[];var r=so(e.inputCoverage,t);if(r===-1)return[];var i=e.inputCoverage.length-1;if(t.lookahead.length<e.lookaheadCoverage.length)return[];for(var s=t.lookahead.slice(i);s.length&&Un(s[0].char);)s.shift();var a=new Rt(s,0),o=so(e.lookaheadCoverage,a),l=[].concat(t.backtrack);for(l.reverse();l.length&&Un(l[0].char);)l.shift();if(l.length<e.backtrackCoverage.length)return[];var h=new Rt(l,0),u=so(e.backtrackCoverage,h),A=r.length===e.inputCoverage.length&&o.length===e.lookaheadCoverage.length&&u.length===e.backtrackCoverage.length,f=[];if(A)for(var d=0;d<e.lookupRecords.length;d++)for(var m=e.lookupRecords[d],y=m.lookupListIndex,C=this.getLookupByIndex(y),x=0;x<C.subtables.length;x++){var I=C.subtables[x],g=this.getLookupMethod(C,I),v=this.getSubstitutionType(C,I);if(v==="12")for(var w=0;w<r.length;w++){var b=t.get(w),B=g(b);B&&f.push(B)}}return f}function u5(t,e){var n=t.current,r=si(n,e.coverage);if(r===-1)return null;for(var i,s=e.ligatureSets[r],a=0;a<s.length;a++){i=s[a];for(var o=0;o<i.components.length;o++){var l=t.lookahead[o],h=i.components[o];if(l!==h)break;if(o===i.components.length-1)return i}}return null}function A5(t,e){var n=si(t,e.coverage);return n===-1?null:e.sequences[n]}yt.prototype.getDefaultScriptFeaturesIndexes=function(){for(var t=this.font.tables.gsub.scripts,e=0;e<t.length;e++){var n=t[e];if(n.tag==="DFLT")return n.script.defaultLangSys.featureIndexes}return[]},yt.prototype.getScriptFeaturesIndexes=function(t){var e=this.font.tables;if(!e.gsub)return[];if(!t)return this.getDefaultScriptFeaturesIndexes();for(var n=this.font.tables.gsub.scripts,r=0;r<n.length;r++){var i=n[r];if(i.tag===t&&i.script.defaultLangSys)return i.script.defaultLangSys.featureIndexes;var s=i.langSysRecords;if(s)for(var a=0;a<s.length;a++){var o=s[a];if(o.tag===t){var l=o.langSys;return l.featureIndexes}}}return this.getDefaultScriptFeaturesIndexes()},yt.prototype.mapTagsToFeatures=function(t,e){for(var n={},r=0;r<t.length;r++){var i=t[r].tag,s=t[r].feature;n[i]=s}this.features[e].tags=n},yt.prototype.getScriptFeatures=function(t){var e=this.features[t];if(this.features.hasOwnProperty(t))return e;var n=this.getScriptFeaturesIndexes(t);if(!n)return null;var r=this.font.tables.gsub;return e=n.map(function(i){return r.features[i]}),this.features[t]=e,this.mapTagsToFeatures(e,t),e},yt.prototype.getSubstitutionType=function(t,e){var n=t.lookupType.toString(),r=e.substFormat.toString();return n+r},yt.prototype.getLookupMethod=function(t,e){var n=this,r=this.getSubstitutionType(t,e);switch(r){case"11":return function(i){return l5.apply(n,[i,e])};case"12":return function(i){return c5.apply(n,[i,e])};case"63":return function(i){return h5.apply(n,[i,e])};case"41":return function(i){return u5.apply(n,[i,e])};case"21":return function(i){return A5.apply(n,[i,e])};default:throw new Error("lookupType: "+t.lookupType+" - substFormat: "+e.substFormat+" is not yet supported")}},yt.prototype.lookupFeature=function(t){var e=t.contextParams,n=e.index,r=this.getFeature({tag:t.tag,script:t.script});if(!r)return new Error("font '"+this.font.names.fullName.en+"' doesn't support feature '"+t.tag+"' for script '"+t.script+"'.");for(var i=this.getFeatureLookups(r),s=[].concat(e.context),a=0;a<i.length;a++)for(var o=i[a],l=this.getLookupSubtables(o),h=0;h<l.length;h++){var u=l[h],A=this.getSubstitutionType(o,u),f=this.getLookupMethod(o,u),d=void 0;switch(A){case"11":d=f(e.current),d&&s.splice(n,1,new nr({id:11,tag:t.tag,substitution:d}));break;case"12":d=f(e.current),d&&s.splice(n,1,new nr({id:12,tag:t.tag,substitution:d}));break;case"63":d=f(e),Array.isArray(d)&&d.length&&s.splice(n,1,new nr({id:63,tag:t.tag,substitution:d}));break;case"41":d=f(e),d&&s.splice(n,1,new nr({id:41,tag:t.tag,substitution:d}));break;case"21":d=f(e.current),d&&s.splice(n,1,new nr({id:21,tag:t.tag,substitution:d}));break}e=new Rt(s,n),!(Array.isArray(d)&&!d.length)&&(d=null)}return s.length?s:null},yt.prototype.supports=function(t){if(!t.script)return!1;this.getScriptFeatures(t.script);var e=this.features.hasOwnProperty(t.script);if(!t.tag)return e;var n=this.features[t.script].some(function(r){return r.tag===t.tag});return e&&n},yt.prototype.getLookupSubtables=function(t){return t.subtables||null},yt.prototype.getLookupByIndex=function(t){var e=this.font.tables.gsub.lookups;return e[t]||null},yt.prototype.getFeatureLookups=function(t){return t.lookupListIndexes.map(this.getLookupByIndex.bind(this))},yt.prototype.getFeature=function(e){if(!this.font)return{FAIL:"No font was found"};this.features.hasOwnProperty(e.script)||this.getScriptFeatures(e.script);var n=this.features[e.script];return n?n.tags[e.tag]?this.features[e.script].tags[e.tag]:null:{FAIL:"No feature for script "+e.script}};function f5(t){var e=t.current,n=t.get(-1);return n===null&&Rn(e)||!Rn(n)&&Rn(e)}function d5(t){var e=t.get(1);return e===null||!Rn(e)}var p5={startCheck:f5,endCheck:d5};function g5(t){var e=t.current,n=t.get(-1);return(Rn(e)||Un(e))&&!Rn(n)}function m5(t){var e=t.get(1);switch(!0){case e===null:return!0;case(!Rn(e)&&!Un(e)):var n=o5(e);if(!n)return!0;if(n){var r=!1;if(r=t.lookahead.some(function(i){return Rn(i)||Un(i)}),!r)return!0}break;default:return!1}}var v5={startCheck:g5,endCheck:m5};function y5(t,e,n){e[n].setState(t.tag,t.substitution)}function C5(t,e,n){e[n].setState(t.tag,t.substitution)}function I5(t,e,n){t.substitution.forEach(function(r,i){var s=e[n+i];s.setState(t.tag,r)})}function x5(t,e,n){var r=e[n];r.setState(t.tag,t.substitution.ligGlyph);for(var i=t.substitution.components.length,s=0;s<i;s++)r=e[n+s+1],r.setState("deleted",!0)}var x3={11:y5,12:C5,63:I5,41:x5};function ao(t,e,n){t instanceof nr&&x3[t.id]&&x3[t.id](t,e,n)}function S5(t){for(var e=[].concat(t.backtrack),n=e.length-1;n>=0;n--){var r=e[n],i=I3(r),s=Un(r);if(!i&&!s)return!0;if(i)return!1}return!1}function B5(t){if(I3(t.current))return!1;for(var e=0;e<t.lookahead.length;e++){var n=t.lookahead[e],r=Un(n);if(!r)return!0}return!1}function w5(t){var e=this,n="arab",r=this.featuresTags[n],i=this.tokenizer.getRangeTokens(t);if(i.length!==1){var s=new Rt(i.map(function(o){return o.getState("glyphIndex")}),0),a=new Rt(i.map(function(o){return o.char}),0);i.forEach(function(o,l){if(!Un(o.char)){s.setCurrentIndex(l),a.setCurrentIndex(l);var h=0;S5(a)&&(h|=1),B5(a)&&(h|=2);var u;switch(h){case 1:u="fina";break;case 2:u="init";break;case 3:u="medi";break}if(r.indexOf(u)!==-1){var A=e.query.lookupFeature({tag:u,script:n,contextParams:s});if(A instanceof Error)return console.info(A.message);A.forEach(function(f,d){f instanceof nr&&(ao(f,i,d),s.context[d]=f.substitution)})}}})}}function S3(t,e){var n=t.map(function(r){return r.activeState.value});return new Rt(n,e||0)}function b5(t){var e=this,n="arab",r=this.tokenizer.getRangeTokens(t),i=S3(r);i.context.forEach(function(s,a){i.setCurrentIndex(a);var o=e.query.lookupFeature({tag:"rlig",script:n,contextParams:i});o.length&&(o.forEach(function(l){return ao(l,r,a)}),i=S3(r))})}function _5(t){var e=t.current,n=t.get(-1);return n===null&&ls(e)||!ls(n)&&ls(e)}function E5(t){var e=t.get(1);return e===null||!ls(e)}var T5={startCheck:_5,endCheck:E5};function B3(t,e){var n=t.map(function(r){return r.activeState.value});return new Rt(n,e||0)}function M5(t){var e=this,n="latn",r=this.tokenizer.getRangeTokens(t),i=B3(r);i.context.forEach(function(s,a){i.setCurrentIndex(a);var o=e.query.lookupFeature({tag:"liga",script:n,contextParams:i});o.length&&(o.forEach(function(l){return ao(l,r,a)}),i=B3(r))})}function Ut(t){this.baseDir=t||"ltr",this.tokenizer=new ze,this.featuresTags={}}Ut.prototype.setText=function(t){this.text=t},Ut.prototype.contextChecks={latinWordCheck:T5,arabicWordCheck:p5,arabicSentenceCheck:v5};function oo(t){var e=this.contextChecks[t+"Check"];return this.tokenizer.registerContextChecker(t,e.startCheck,e.endCheck)}function D5(){return oo.call(this,"latinWord"),oo.call(this,"arabicWord"),oo.call(this,"arabicSentence"),this.tokenizer.tokenize(this.text)}function L5(){var t=this,e=this.tokenizer.getContextRanges("arabicSentence");e.forEach(function(n){var r=t.tokenizer.getRangeTokens(n);t.tokenizer.replaceRange(n.startIndex,n.endOffset,r.reverse())})}Ut.prototype.registerFeatures=function(t,e){var n=this,r=e.filter(function(i){return n.query.supports({script:t,tag:i})});this.featuresTags.hasOwnProperty(t)?this.featuresTags[t]=this.featuresTags[t].concat(r):this.featuresTags[t]=r},Ut.prototype.applyFeatures=function(t,e){if(!t)throw new Error("No valid font was provided to apply features");this.query||(this.query=new yt(t));for(var n=0;n<e.length;n++){var r=e[n];this.query.supports({script:r.script})&&this.registerFeatures(r.script,r.tags)}},Ut.prototype.registerModifier=function(t,e,n){this.tokenizer.registerModifier(t,e,n)};function lo(){if(this.tokenizer.registeredModifiers.indexOf("glyphIndex")===-1)throw new Error("glyphIndex modifier is required to apply arabic presentation features.")}function P5(){var t=this,e="arab";if(this.featuresTags.hasOwnProperty(e)){lo.call(this);var n=this.tokenizer.getContextRanges("arabicWord");n.forEach(function(r){w5.call(t,r)})}}function F5(){var t=this,e="arab";if(this.featuresTags.hasOwnProperty(e)){var n=this.featuresTags[e];if(n.indexOf("rlig")!==-1){lo.call(this);var r=this.tokenizer.getContextRanges("arabicWord");r.forEach(function(i){b5.call(t,i)})}}}function k5(){var t=this,e="latn";if(this.featuresTags.hasOwnProperty(e)){var n=this.featuresTags[e];if(n.indexOf("liga")!==-1){lo.call(this);var r=this.tokenizer.getContextRanges("latinWord");r.forEach(function(i){M5.call(t,i)})}}}Ut.prototype.checkContextReady=function(t){return!!this.tokenizer.getContext(t)},Ut.prototype.applyFeaturesToContexts=function(){this.checkContextReady("arabicWord")&&(P5.call(this),F5.call(this)),this.checkContextReady("latinWord")&&k5.call(this),this.checkContextReady("arabicSentence")&&L5.call(this)},Ut.prototype.processText=function(t){(!this.text||this.text!==t)&&(this.setText(t),D5.call(this),this.applyFeaturesToContexts())},Ut.prototype.getBidiText=function(t){return this.processText(t),this.tokenizer.getText()},Ut.prototype.getTextGlyphs=function(t){this.processText(t);for(var e=[],n=0;n<this.tokenizer.tokens.length;n++){var r=this.tokenizer.tokens[n];if(!r.state.deleted){var i=r.activeState.value;e.push(Array.isArray(i)?i[0]:i)}}return e};function Le(t){t=t||{},t.tables=t.tables||{},t.empty||(ti(t.familyName,"When creating a new Font object, familyName is required."),ti(t.styleName,"When creating a new Font object, styleName is required."),ti(t.unitsPerEm,"When creating a new Font object, unitsPerEm is required."),ti(t.ascender,"When creating a new Font object, ascender is required."),ti(t.descender<=0,"When creating a new Font object, negative descender value is required."),this.names={fontFamily:{en:t.familyName||" "},fontSubfamily:{en:t.styleName||" "},fullName:{en:t.fullName||t.familyName+" "+t.styleName},postScriptName:{en:t.postScriptName||(t.familyName+t.styleName).replace(/\s/g,"")},designer:{en:t.designer||" "},designerURL:{en:t.designerURL||" "},manufacturer:{en:t.manufacturer||" "},manufacturerURL:{en:t.manufacturerURL||" "},license:{en:t.license||" "},licenseURL:{en:t.licenseURL||" "},version:{en:t.version||"Version 0.1"},description:{en:t.description||" "},copyright:{en:t.copyright||" "},trademark:{en:t.trademark||" "}},this.unitsPerEm=t.unitsPerEm||1e3,this.ascender=t.ascender,this.descender=t.descender,this.createdTimestamp=t.createdTimestamp,this.tables=Object.assign(t.tables,{os2:Object.assign({usWeightClass:t.weightClass||this.usWeightClasses.MEDIUM,usWidthClass:t.widthClass||this.usWidthClasses.MEDIUM,fsSelection:t.fsSelection||this.fsSelectionValues.REGULAR},t.tables.os2)})),this.supported=!0,this.glyphs=new Kt.GlyphSet(this,t.glyphs||[]),this.encoding=new Bc(this),this.position=new ei(this),this.substitution=new vt(this),this.tables=this.tables||{},this._push=null,this._hmtxTableData={},Object.defineProperty(this,"hinting",{get:function(){if(this._hinting)return this._hinting;if(this.outlinesFormat==="truetype")return this._hinting=new n3(this)}})}Le.prototype.hasChar=function(t){return this.encoding.charToGlyphIndex(t)!==null},Le.prototype.charToGlyphIndex=function(t){return this.encoding.charToGlyphIndex(t)},Le.prototype.charToGlyph=function(t){var e=this.charToGlyphIndex(t),n=this.glyphs.get(e);return n||(n=this.glyphs.get(0)),n},Le.prototype.updateFeatures=function(t){return this.defaultRenderOptions.features.map(function(e){return e.script==="latn"?{script:"latn",tags:e.tags.filter(function(n){return t[n]})}:e})},Le.prototype.stringToGlyphs=function(t,e){var n=this,r=new Ut,i=function(A){return n.charToGlyphIndex(A.char)};r.registerModifier("glyphIndex",null,i);var s=e?this.updateFeatures(e.features):this.defaultRenderOptions.features;r.applyFeatures(this,s);for(var a=r.getTextGlyphs(t),o=a.length,l=new Array(o),h=this.glyphs.get(0),u=0;u<o;u+=1)l[u]=this.glyphs.get(a[u])||h;return l},Le.prototype.nameToGlyphIndex=function(t){return this.glyphNames.nameToGlyphIndex(t)},Le.prototype.nameToGlyph=function(t){var e=this.nameToGlyphIndex(t),n=this.glyphs.get(e);return n||(n=this.glyphs.get(0)),n},Le.prototype.glyphIndexToName=function(t){return this.glyphNames.glyphIndexToName?this.glyphNames.glyphIndexToName(t):""},Le.prototype.getKerningValue=function(t,e){t=t.index||t,e=e.index||e;var n=this.position.defaultKerningTables;return n?this.position.getKerningValue(n,t,e):this.kerningPairs[t+","+e]||0},Le.prototype.defaultRenderOptions={kerning:!0,features:[{script:"arab",tags:["init","medi","fina","rlig"]},{script:"latn",tags:["liga","rlig"]}]},Le.prototype.forEachGlyph=function(t,e,n,r,i,s){e=e!==void 0?e:0,n=n!==void 0?n:0,r=r!==void 0?r:72,i=Object.assign({},this.defaultRenderOptions,i);var a=1/this.unitsPerEm*r,o=this.stringToGlyphs(t,i),l;if(i.kerning){var h=i.script||this.position.getDefaultScriptName();l=this.position.getKerningTables(h,i.language)}for(var u=0;u<o.length;u+=1){var A=o[u];if(s.call(this,A,e,n,r,i),A.advanceWidth&&(e+=A.advanceWidth*a),i.kerning&&u<o.length-1){var f=l?this.position.getKerningValue(l,A.index,o[u+1].index):this.getKerningValue(A,o[u+1]);e+=f*a}i.letterSpacing?e+=i.letterSpacing*r:i.tracking&&(e+=i.tracking/1e3*r)}return e},Le.prototype.getPath=function(t,e,n,r,i){var s=new Ke;return this.forEachGlyph(t,e,n,r,i,function(a,o,l,h){var u=a.getPath(o,l,h,i,this);s.extend(u)}),s},Le.prototype.getPaths=function(t,e,n,r,i){var s=[];return this.forEachGlyph(t,e,n,r,i,function(a,o,l,h){var u=a.getPath(o,l,h,i,this);s.push(u)}),s},Le.prototype.getAdvanceWidth=function(t,e,n){return this.forEachGlyph(t,0,0,e,n,function(){})},Le.prototype.draw=function(t,e,n,r,i,s){this.getPath(e,n,r,i,s).draw(t)},Le.prototype.drawPoints=function(t,e,n,r,i,s){this.forEachGlyph(e,n,r,i,s,function(a,o,l,h){a.drawPoints(t,o,l,h)})},Le.prototype.drawMetrics=function(t,e,n,r,i,s){this.forEachGlyph(e,n,r,i,s,function(a,o,l,h){a.drawMetrics(t,o,l,h)})},Le.prototype.getEnglishName=function(t){var e=this.names[t];if(e)return e.en},Le.prototype.validate=function(){var t=this;function e(r,i){}function n(r){var i=t.getEnglishName(r);i&&i.trim().length>0}n("fontFamily"),n("weightName"),n("manufacturer"),n("copyright"),n("version"),this.unitsPerEm>0},Le.prototype.toTables=function(){return If.fontToTable(this)},Le.prototype.toBuffer=function(){return console.warn("Font.toBuffer is deprecated. Use Font.toArrayBuffer instead."),this.toArrayBuffer()},Le.prototype.toArrayBuffer=function(){for(var t=this.toTables(),e=t.encode(),n=new ArrayBuffer(e.length),r=new Uint8Array(n),i=0;i<e.length;i++)r[i]=e[i];return n},Le.prototype.download=function(t){var e=this.getEnglishName("fontFamily"),n=this.getEnglishName("fontSubfamily");t=t||e.replace(/\s/g,"")+"-"+n+".otf";var r=this.toArrayBuffer();if(Sf())if(window.URL=window.URL||window.webkitURL,window.URL){var i=new DataView(r),s=new Blob([i],{type:"font/opentype"}),a=document.createElement("a");a.href=window.URL.createObjectURL(s),a.download=t;var o=document.createEvent("MouseEvents");o.initEvent("click",!0,!1),a.dispatchEvent(o)}else console.warn("Font file could not be downloaded. Try using a different browser.");else{var l=require("fs"),h=Bf(r);l.writeFileSync(t,h)}},Le.prototype.fsSelectionValues={ITALIC:1,UNDERSCORE:2,NEGATIVE:4,OUTLINED:8,STRIKEOUT:16,BOLD:32,REGULAR:64,USER_TYPO_METRICS:128,WWS:256,OBLIQUE:512},Le.prototype.usWidthClasses={ULTRA_CONDENSED:1,EXTRA_CONDENSED:2,CONDENSED:3,SEMI_CONDENSED:4,MEDIUM:5,SEMI_EXPANDED:6,EXPANDED:7,EXTRA_EXPANDED:8,ULTRA_EXPANDED:9},Le.prototype.usWeightClasses={THIN:100,EXTRA_LIGHT:200,LIGHT:300,NORMAL:400,MEDIUM:500,SEMI_BOLD:600,BOLD:700,EXTRA_BOLD:800,BLACK:900};var vn=new Array(10);vn[1]=function(){var e=this.offset+this.relativeOffset,n=this.parseUShort();if(n===1)return{posFormat:1,coverage:this.parsePointer(W.coverage),value:this.parseValueRecord()};if(n===2)return{posFormat:2,coverage:this.parsePointer(W.coverage),values:this.parseValueRecordList()};Ie.assert(!1,"0x"+e.toString(16)+": GPOS lookup type 1 format must be 1 or 2.")},vn[2]=function(){var e=this.offset+this.relativeOffset,n=this.parseUShort();Ie.assert(n===1||n===2,"0x"+e.toString(16)+": GPOS lookup type 2 format must be 1 or 2.");var r=this.parsePointer(W.coverage),i=this.parseUShort(),s=this.parseUShort();if(n===1)return{posFormat:n,coverage:r,valueFormat1:i,valueFormat2:s,pairSets:this.parseList(W.pointer(W.list(function(){return{secondGlyph:this.parseUShort(),value1:this.parseValueRecord(i),value2:this.parseValueRecord(s)}})))};if(n===2){var a=this.parsePointer(W.classDef),o=this.parsePointer(W.classDef),l=this.parseUShort(),h=this.parseUShort();return{posFormat:n,coverage:r,valueFormat1:i,valueFormat2:s,classDef1:a,classDef2:o,class1Count:l,class2Count:h,classRecords:this.parseList(l,W.list(h,function(){return{value1:this.parseValueRecord(i),value2:this.parseValueRecord(s)}}))}}},vn[3]=function(){return{error:"GPOS Lookup 3 not supported"}},vn[4]=function(){return{error:"GPOS Lookup 4 not supported"}},vn[5]=function(){return{error:"GPOS Lookup 5 not supported"}},vn[6]=function(){return{error:"GPOS Lookup 6 not supported"}},vn[7]=function(){return{error:"GPOS Lookup 7 not supported"}},vn[8]=function(){return{error:"GPOS Lookup 8 not supported"}},vn[9]=function(){return{error:"GPOS Lookup 9 not supported"}},new Array(10);var O5=Object.defineProperty,R5=(t,e,n)=>e in t?O5(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,M=(t,e,n)=>(R5(t,typeof e!="symbol"?e+"":e,n),n);function w3(t,e){if(e===c.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),t;if(e===c.TriangleFanDrawMode||e===c.TriangleStripDrawMode){let n=t.getIndex();if(n===null){const a=[],o=t.getAttribute("position");if(o!==void 0){for(let l=0;l<o.count;l++)a.push(l);t.setIndex(a),n=t.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),t}const r=n.count-2,i=[];if(n)if(e===c.TriangleFanDrawMode)for(let a=1;a<=r;a++)i.push(n.getX(0)),i.push(n.getX(a)),i.push(n.getX(a+1));else for(let a=0;a<r;a++)a%2===0?(i.push(n.getX(a)),i.push(n.getX(a+1)),i.push(n.getX(a+2))):(i.push(n.getX(a+2)),i.push(n.getX(a+1)),i.push(n.getX(a)));i.length/3!==r&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=t.clone();return s.setIndex(i),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),t}new c.Color;const b3=class{parse(t,e={decodeSpeed:5,encodeSpeed:5,encoderMethod:b3.MESH_EDGEBREAKER_ENCODING,quantization:[16,8,8,8,8],exportUvs:!0,exportNormals:!0,exportColor:!1}){if(t instanceof c.BufferGeometry&&t.isBufferGeometry)throw new Error("DRACOExporter: The first parameter of parse() is now an instance of Mesh or Points.");if(DracoEncoderModule===void 0)throw new Error("THREE.DRACOExporter: required the draco_encoder to work.");const n=t.geometry,r=DracoEncoderModule(),i=new r.Encoder;let s,a;if(!n.isBufferGeometry)throw new Error("THREE.DRACOExporter.parse(geometry, options): geometry is not a THREE.BufferGeometry instance.");if(t instanceof c.Mesh&&t.isMesh){s=new r.MeshBuilder,a=new r.Mesh;const f=n.getAttribute("position");s.AddFloatAttributeToMesh(a,r.POSITION,f.count,f.itemSize,f.array);const d=n.getIndex();if(d!==null)s.AddFacesToMesh(a,d.count/3,d.array);else{const m=new(f.count>65535?Uint32Array:Uint16Array)(f.count);for(let y=0;y<m.length;y++)m[y]=y;s.AddFacesToMesh(a,f.count,m)}if(e.exportNormals){const m=n.getAttribute("normal");m!==void 0&&s.AddFloatAttributeToMesh(a,r.NORMAL,m.count,m.itemSize,m.array)}if(e.exportUvs){const m=n.getAttribute("uv");m!==void 0&&s.AddFloatAttributeToMesh(a,r.TEX_COORD,m.count,m.itemSize,m.array)}if(e.exportColor){const m=n.getAttribute("color");m!==void 0&&s.AddFloatAttributeToMesh(a,r.COLOR,m.count,m.itemSize,m.array)}}else if(t instanceof c.Points&&t.isPoints){s=new r.PointCloudBuilder,a=new r.PointCloud;const f=n.getAttribute("position");if(s.AddFloatAttribute(a,r.POSITION,f.count,f.itemSize,f.array),e.exportColor){const d=n.getAttribute("color");d!==void 0&&s.AddFloatAttribute(a,r.COLOR,d.count,d.itemSize,d.array)}}else throw new Error("DRACOExporter: Unsupported object type.");const o=new r.DracoInt8Array,l=e.encodeSpeed!==void 0?e.encodeSpeed:5,h=e.decodeSpeed!==void 0?e.decodeSpeed:5;if(i.SetSpeedOptions(l,h),e.encoderMethod!==void 0&&i.SetEncodingMethod(e.encoderMethod),e.quantization!==void 0)for(let f=0;f<5;f++)e.quantization[f]!==void 0&&i.SetAttributeQuantization(f,e.quantization[f]);let u;if(t instanceof c.Mesh&&t.isMesh?u=i.EncodeMeshToDracoBuffer(a,o):u=i.EncodePointCloudToDracoBuffer(a,!0,o),r.destroy(a),u===0)throw new Error("THREE.DRACOExporter: Draco encoding failed.");const A=new Int8Array(new ArrayBuffer(u));for(let f=0;f<u;f++)A[f]=o.GetValue(f);return r.destroy(o),r.destroy(i),r.destroy(s),A}};let Zt=b3;M(Zt,"MESH_EDGEBREAKER_ENCODING",1),M(Zt,"MESH_SEQUENTIAL_ENCODING",0),M(Zt,"POINT_CLOUD",0),M(Zt,"TRIANGULAR_MESH",1),M(Zt,"INVALID",-1),M(Zt,"POSITION",0),M(Zt,"NORMAL",1),M(Zt,"COLOR",2),M(Zt,"TEX_COORD",3),M(Zt,"GENERIC",4);const _3=class extends c.Mesh{constructor(t,e={}){super(t),this.isReflector=!0,this.type="Reflector",this.camera=new c.PerspectiveCamera;const n=this,r=e.color!==void 0?new c.Color(e.color):new c.Color(8355711),i=e.textureWidth||512,s=e.textureHeight||512,a=e.clipBias||0,o=e.shader||_3.ReflectorShader,l=e.multisample!==void 0?e.multisample:4,h=new c.Plane,u=new c.Vector3,A=new c.Vector3,f=new c.Vector3,d=new c.Matrix4,m=new c.Vector3(0,0,-1),y=new c.Vector4,C=new c.Vector3,x=new c.Vector3,I=new c.Vector4,g=new c.Matrix4,v=this.camera,w=new c.WebGLRenderTarget(i,s,{samples:l,type:c.HalfFloatType}),b=new c.ShaderMaterial({uniforms:c.UniformsUtils.clone(o.uniforms),fragmentShader:o.fragmentShader,vertexShader:o.vertexShader});b.uniforms.tDiffuse.value=w.texture,b.uniforms.color.value=r,b.uniforms.textureMatrix.value=g,this.material=b,this.onBeforeRender=function(B,_,E){if(A.setFromMatrixPosition(n.matrixWorld),f.setFromMatrixPosition(E.matrixWorld),d.extractRotation(n.matrixWorld),u.set(0,0,1),u.applyMatrix4(d),C.subVectors(A,f),C.dot(u)>0)return;C.reflect(u).negate(),C.add(A),d.extractRotation(E.matrixWorld),m.set(0,0,-1),m.applyMatrix4(d),m.add(f),x.subVectors(A,m),x.reflect(u).negate(),x.add(A),v.position.copy(C),v.up.set(0,1,0),v.up.applyMatrix4(d),v.up.reflect(u),v.lookAt(x),v.far=E.far,v.updateMatrixWorld(),v.projectionMatrix.copy(E.projectionMatrix),g.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),g.multiply(v.projectionMatrix),g.multiply(v.matrixWorldInverse),g.multiply(n.matrixWorld),h.setFromNormalAndCoplanarPoint(u,A),h.applyMatrix4(v.matrixWorldInverse),y.set(h.normal.x,h.normal.y,h.normal.z,h.constant);const T=v.projectionMatrix;I.x=(Math.sign(y.x)+T.elements[8])/T.elements[0],I.y=(Math.sign(y.y)+T.elements[9])/T.elements[5],I.z=-1,I.w=(1+T.elements[10])/T.elements[14],y.multiplyScalar(2/y.dot(I)),T.elements[2]=y.x,T.elements[6]=y.y,T.elements[10]=y.z+1-a,T.elements[14]=y.w,n.visible=!1;const L=B.getRenderTarget(),R=B.xr.enabled,V=B.shadowMap.autoUpdate,Y=B.toneMapping;let q=!1;"outputColorSpace"in B?q=B.outputColorSpace==="srgb":q=B.outputEncoding===3001,B.xr.enabled=!1,B.shadowMap.autoUpdate=!1,"outputColorSpace"in B?B.outputColorSpace="linear-srgb":B.outputEncoding=3e3,B.toneMapping=c.NoToneMapping,B.setRenderTarget(w),B.state.buffers.depth.setMask(!0),B.autoClear===!1&&B.clear(),B.render(_,v),B.xr.enabled=R,B.shadowMap.autoUpdate=V,B.toneMapping=Y,"outputColorSpace"in B?B.outputColorSpace=q?"srgb":"srgb-linear":B.outputEncoding=q?3001:3e3,B.setRenderTarget(L);const ne=E.viewport;ne!==void 0&&B.state.viewport(ne),n.visible=!0},this.getRenderTarget=function(){return w},this.dispose=function(){w.dispose(),n.material.dispose()}}};let co=_3;M(co,"ReflectorShader",{uniforms:{color:{value:null},tDiffuse:{value:null},textureMatrix:{value:null}},vertexShader:`
|
|
9
|
+
uniform mat4 textureMatrix;
|
|
10
|
+
varying vec4 vUv;
|
|
11
|
+
|
|
12
|
+
#include <common>
|
|
13
|
+
#include <logdepthbuf_pars_vertex>
|
|
14
|
+
|
|
15
|
+
void main() {
|
|
16
|
+
|
|
17
|
+
vUv = textureMatrix * vec4( position, 1.0 );
|
|
18
|
+
|
|
19
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
20
|
+
|
|
21
|
+
#include <logdepthbuf_vertex>
|
|
22
|
+
|
|
23
|
+
}`,fragmentShader:`
|
|
24
|
+
uniform vec3 color;
|
|
25
|
+
uniform sampler2D tDiffuse;
|
|
26
|
+
varying vec4 vUv;
|
|
27
|
+
|
|
28
|
+
#include <logdepthbuf_pars_fragment>
|
|
29
|
+
|
|
30
|
+
float blendOverlay( float base, float blend ) {
|
|
31
|
+
|
|
32
|
+
return( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );
|
|
33
|
+
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
vec3 blendOverlay( vec3 base, vec3 blend ) {
|
|
37
|
+
|
|
38
|
+
return vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) );
|
|
39
|
+
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
void main() {
|
|
43
|
+
|
|
44
|
+
#include <logdepthbuf_fragment>
|
|
45
|
+
|
|
46
|
+
vec4 base = texture2DProj( tDiffuse, vUv );
|
|
47
|
+
gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );
|
|
48
|
+
|
|
49
|
+
#include <tonemapping_fragment>
|
|
50
|
+
#include <${parseInt(c.REVISION.replace(/\D+/g,""))>=154?"colorspace_fragment":"encodings_fragment"}>
|
|
51
|
+
|
|
52
|
+
}`});const E3=class extends c.Mesh{constructor(t,e={}){super(t),this.isRefractor=!0,this.type="Refractor",this.camera=new c.PerspectiveCamera;const n=this,r=e.color!==void 0?new c.Color(e.color):new c.Color(8355711),i=e.textureWidth||512,s=e.textureHeight||512,a=e.clipBias||0,o=e.shader||E3.RefractorShader,l=e.multisample!==void 0?e.multisample:4,h=this.camera;h.matrixAutoUpdate=!1,h.userData.refractor=!0;const u=new c.Plane,A=new c.Matrix4,f=new c.WebGLRenderTarget(i,s,{samples:l,type:c.HalfFloatType});this.material=new c.ShaderMaterial({uniforms:c.UniformsUtils.clone(o.uniforms),vertexShader:o.vertexShader,fragmentShader:o.fragmentShader,transparent:!0}),this.material.uniforms.color.value=r,this.material.uniforms.tDiffuse.value=f.texture,this.material.uniforms.textureMatrix.value=A;const d=function(){const I=new c.Vector3,g=new c.Vector3,v=new c.Matrix4,w=new c.Vector3,b=new c.Vector3;return function(_){return I.setFromMatrixPosition(n.matrixWorld),g.setFromMatrixPosition(_.matrixWorld),w.subVectors(I,g),v.extractRotation(n.matrixWorld),b.set(0,0,1),b.applyMatrix4(v),w.dot(b)<0}}(),m=function(){const I=new c.Vector3,g=new c.Vector3,v=new c.Quaternion,w=new c.Vector3;return function(){n.matrixWorld.decompose(g,v,w),I.set(0,0,1).applyQuaternion(v).normalize(),I.negate(),u.setFromNormalAndCoplanarPoint(I,g)}}(),y=function(){const I=new c.Plane,g=new c.Vector4,v=new c.Vector4;return function(b){h.matrixWorld.copy(b.matrixWorld),h.matrixWorldInverse.copy(h.matrixWorld).invert(),h.projectionMatrix.copy(b.projectionMatrix),h.far=b.far,I.copy(u),I.applyMatrix4(h.matrixWorldInverse),g.set(I.normal.x,I.normal.y,I.normal.z,I.constant);const B=h.projectionMatrix;v.x=(Math.sign(g.x)+B.elements[8])/B.elements[0],v.y=(Math.sign(g.y)+B.elements[9])/B.elements[5],v.z=-1,v.w=(1+B.elements[10])/B.elements[14],g.multiplyScalar(2/g.dot(v)),B.elements[2]=g.x,B.elements[6]=g.y,B.elements[10]=g.z+1-a,B.elements[14]=g.w}}();function C(I){A.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),A.multiply(I.projectionMatrix),A.multiply(I.matrixWorldInverse),A.multiply(n.matrixWorld)}function x(I,g,v){n.visible=!1;const w=I.getRenderTarget(),b=I.xr.enabled,B=I.shadowMap.autoUpdate,_=I.toneMapping;let E=!1;"outputColorSpace"in I?E=I.outputColorSpace==="srgb":E=I.outputEncoding===3001,I.xr.enabled=!1,I.shadowMap.autoUpdate=!1,"outputColorSpace"in I?I.outputColorSpace="linear-srgb":I.outputEncoding=3e3,I.toneMapping=c.NoToneMapping,I.setRenderTarget(f),I.autoClear===!1&&I.clear(),I.render(g,h),I.xr.enabled=b,I.shadowMap.autoUpdate=B,I.toneMapping=_,I.setRenderTarget(w),"outputColorSpace"in I?I.outputColorSpace=E?"srgb":"srgb-linear":I.outputEncoding=E?3001:3e3;const T=v.viewport;T!==void 0&&I.state.viewport(T),n.visible=!0}this.onBeforeRender=function(I,g,v){v.userData.refractor!==!0&&d(v)&&(m(),C(v),y(v),x(I,g,v))},this.getRenderTarget=function(){return f},this.dispose=function(){f.dispose(),n.material.dispose()}}};let ho=E3;M(ho,"RefractorShader",{uniforms:{color:{value:null},tDiffuse:{value:null},textureMatrix:{value:null}},vertexShader:`
|
|
53
|
+
|
|
54
|
+
uniform mat4 textureMatrix;
|
|
55
|
+
|
|
56
|
+
varying vec4 vUv;
|
|
57
|
+
|
|
58
|
+
void main() {
|
|
59
|
+
|
|
60
|
+
vUv = textureMatrix * vec4( position, 1.0 );
|
|
61
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
62
|
+
|
|
63
|
+
}`,fragmentShader:`
|
|
64
|
+
|
|
65
|
+
uniform vec3 color;
|
|
66
|
+
uniform sampler2D tDiffuse;
|
|
67
|
+
|
|
68
|
+
varying vec4 vUv;
|
|
69
|
+
|
|
70
|
+
float blendOverlay( float base, float blend ) {
|
|
71
|
+
|
|
72
|
+
return( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );
|
|
73
|
+
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
vec3 blendOverlay( vec3 base, vec3 blend ) {
|
|
77
|
+
|
|
78
|
+
return vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) );
|
|
79
|
+
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
void main() {
|
|
83
|
+
|
|
84
|
+
vec4 base = texture2DProj( tDiffuse, vUv );
|
|
85
|
+
gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );
|
|
86
|
+
|
|
87
|
+
#include <tonemapping_fragment>
|
|
88
|
+
#include <${parseInt(c.REVISION.replace(/\D+/g,""))>=154?"colorspace_fragment":"encodings_fragment"}>
|
|
89
|
+
|
|
90
|
+
}`});const U5=new c.BufferGeometry,uo=class extends c.Mesh{constructor(){super(uo.Geometry,new c.MeshBasicMaterial({opacity:0,transparent:!0})),this.isLensflare=!0,this.type="Lensflare",this.frustumCulled=!1,this.renderOrder=1/0;const t=new c.Vector3,e=new c.Vector3,n=new c.DataTexture(new Uint8Array(16*16*3),16,16,c.RGBAFormat);n.minFilter=c.NearestFilter,n.magFilter=c.NearestFilter,n.wrapS=c.ClampToEdgeWrapping,n.wrapT=c.ClampToEdgeWrapping;const r=new c.DataTexture(new Uint8Array(16*16*3),16,16,c.RGBAFormat);r.minFilter=c.NearestFilter,r.magFilter=c.NearestFilter,r.wrapS=c.ClampToEdgeWrapping,r.wrapT=c.ClampToEdgeWrapping;const i=uo.Geometry,s=new c.RawShaderMaterial({uniforms:{scale:{value:null},screenPosition:{value:null}},vertexShader:`
|
|
91
|
+
|
|
92
|
+
precision highp float;
|
|
93
|
+
|
|
94
|
+
uniform vec3 screenPosition;
|
|
95
|
+
uniform vec2 scale;
|
|
96
|
+
|
|
97
|
+
attribute vec3 position;
|
|
98
|
+
|
|
99
|
+
void main() {
|
|
100
|
+
|
|
101
|
+
gl_Position = vec4( position.xy * scale + screenPosition.xy, screenPosition.z, 1.0 );
|
|
102
|
+
|
|
103
|
+
}`,fragmentShader:`
|
|
104
|
+
|
|
105
|
+
precision highp float;
|
|
106
|
+
|
|
107
|
+
void main() {
|
|
108
|
+
|
|
109
|
+
gl_FragColor = vec4( 1.0, 0.0, 1.0, 1.0 );
|
|
110
|
+
|
|
111
|
+
}`,depthTest:!0,depthWrite:!1,transparent:!1}),a=new c.RawShaderMaterial({uniforms:{map:{value:n},scale:{value:null},screenPosition:{value:null}},vertexShader:`
|
|
112
|
+
|
|
113
|
+
precision highp float;
|
|
114
|
+
|
|
115
|
+
uniform vec3 screenPosition;
|
|
116
|
+
uniform vec2 scale;
|
|
117
|
+
|
|
118
|
+
attribute vec3 position;
|
|
119
|
+
attribute vec2 uv;
|
|
120
|
+
|
|
121
|
+
varying vec2 vUV;
|
|
122
|
+
|
|
123
|
+
void main() {
|
|
124
|
+
|
|
125
|
+
vUV = uv;
|
|
126
|
+
|
|
127
|
+
gl_Position = vec4( position.xy * scale + screenPosition.xy, screenPosition.z, 1.0 );
|
|
128
|
+
|
|
129
|
+
}`,fragmentShader:`
|
|
130
|
+
|
|
131
|
+
precision highp float;
|
|
132
|
+
|
|
133
|
+
uniform sampler2D map;
|
|
134
|
+
|
|
135
|
+
varying vec2 vUV;
|
|
136
|
+
|
|
137
|
+
void main() {
|
|
138
|
+
|
|
139
|
+
gl_FragColor = texture2D( map, vUV );
|
|
140
|
+
|
|
141
|
+
}`,depthTest:!1,depthWrite:!1,transparent:!1}),o=new c.Mesh(i,s),l=[],h=T3.Shader,u=new c.RawShaderMaterial({uniforms:{map:{value:null},occlusionMap:{value:r},color:{value:new c.Color(16777215)},scale:{value:new c.Vector2},screenPosition:{value:new c.Vector3}},vertexShader:h.vertexShader,fragmentShader:h.fragmentShader,blending:c.AdditiveBlending,transparent:!0,depthWrite:!1}),A=new c.Mesh(i,u);this.addElement=function(C){l.push(C)};const f=new c.Vector2,d=new c.Vector2,m=new c.Box2,y=new c.Vector4;this.onBeforeRender=function(C,x,I){C.getCurrentViewport(y);const g=y.w/y.z,v=y.z/2,w=y.w/2;let b=16/y.w;if(f.set(b*g,b),m.min.set(y.x,y.y),m.max.set(y.x+(y.z-16),y.y+(y.w-16)),e.setFromMatrixPosition(this.matrixWorld),e.applyMatrix4(I.matrixWorldInverse),!(e.z>0)&&(t.copy(e).applyMatrix4(I.projectionMatrix),d.x=y.x+t.x*v+v-8,d.y=y.y+t.y*w+w-8,m.containsPoint(d))){C.copyFramebufferToTexture(d,n);let B=s.uniforms;B.scale.value=f,B.screenPosition.value=t,C.renderBufferDirect(I,null,i,s,o,null),C.copyFramebufferToTexture(d,r),B=a.uniforms,B.scale.value=f,B.screenPosition.value=t,C.renderBufferDirect(I,null,i,a,o,null);const _=-t.x*2,E=-t.y*2;for(let T=0,L=l.length;T<L;T++){const R=l[T],V=u.uniforms;V.color.value.copy(R.color),V.map.value=R.texture,V.screenPosition.value.x=t.x+_*R.distance,V.screenPosition.value.y=t.y+E*R.distance,b=R.size/y.w;const Y=y.w/y.z;V.scale.value.set(b*Y,b),u.uniformsNeedUpdate=!0,C.renderBufferDirect(I,null,i,u,A,null)}}},this.dispose=function(){s.dispose(),a.dispose(),u.dispose(),n.dispose(),r.dispose();for(let C=0,x=l.length;C<x;C++)l[C].texture.dispose()}}};M(uo,"Geometry",U5);let T3=class{constructor(e,n=1,r=0,i=new c.Color(16777215)){this.texture=e,this.size=n,this.distance=r,this.color=i}};M(T3,"Shader",{uniforms:{map:{value:null},occlusionMap:{value:null},color:{value:null},scale:{value:null},screenPosition:{value:null}},vertexShader:`
|
|
142
|
+
|
|
143
|
+
precision highp float;
|
|
144
|
+
|
|
145
|
+
uniform vec3 screenPosition;
|
|
146
|
+
uniform vec2 scale;
|
|
147
|
+
|
|
148
|
+
uniform sampler2D occlusionMap;
|
|
149
|
+
|
|
150
|
+
attribute vec3 position;
|
|
151
|
+
attribute vec2 uv;
|
|
152
|
+
|
|
153
|
+
varying vec2 vUV;
|
|
154
|
+
varying float vVisibility;
|
|
155
|
+
|
|
156
|
+
void main() {
|
|
157
|
+
|
|
158
|
+
vUV = uv;
|
|
159
|
+
|
|
160
|
+
vec2 pos = position.xy;
|
|
161
|
+
|
|
162
|
+
vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );
|
|
163
|
+
visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );
|
|
164
|
+
visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );
|
|
165
|
+
visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );
|
|
166
|
+
visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );
|
|
167
|
+
visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );
|
|
168
|
+
visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );
|
|
169
|
+
visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );
|
|
170
|
+
visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );
|
|
171
|
+
|
|
172
|
+
vVisibility = visibility.r / 9.0;
|
|
173
|
+
vVisibility *= 1.0 - visibility.g / 9.0;
|
|
174
|
+
vVisibility *= visibility.b / 9.0;
|
|
175
|
+
|
|
176
|
+
gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );
|
|
177
|
+
|
|
178
|
+
}`,fragmentShader:`
|
|
179
|
+
|
|
180
|
+
precision highp float;
|
|
181
|
+
|
|
182
|
+
uniform sampler2D map;
|
|
183
|
+
uniform vec3 color;
|
|
184
|
+
|
|
185
|
+
varying vec2 vUV;
|
|
186
|
+
varying float vVisibility;
|
|
187
|
+
|
|
188
|
+
void main() {
|
|
189
|
+
|
|
190
|
+
vec4 texture = texture2D( map, vUV );
|
|
191
|
+
texture.a *= vVisibility;
|
|
192
|
+
gl_FragColor = texture;
|
|
193
|
+
gl_FragColor.rgb *= color;
|
|
194
|
+
|
|
195
|
+
}`});class ai{constructor(e=Math){M(this,"grad3",[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]]),M(this,"grad4",[[0,1,1,1],[0,1,1,-1],[0,1,-1,1],[0,1,-1,-1],[0,-1,1,1],[0,-1,1,-1],[0,-1,-1,1],[0,-1,-1,-1],[1,0,1,1],[1,0,1,-1],[1,0,-1,1],[1,0,-1,-1],[-1,0,1,1],[-1,0,1,-1],[-1,0,-1,1],[-1,0,-1,-1],[1,1,0,1],[1,1,0,-1],[1,-1,0,1],[1,-1,0,-1],[-1,1,0,1],[-1,1,0,-1],[-1,-1,0,1],[-1,-1,0,-1],[1,1,1,0],[1,1,-1,0],[1,-1,1,0],[1,-1,-1,0],[-1,1,1,0],[-1,1,-1,0],[-1,-1,1,0],[-1,-1,-1,0]]),M(this,"p",[]),M(this,"perm",[]),M(this,"simplex",[[0,1,2,3],[0,1,3,2],[0,0,0,0],[0,2,3,1],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,2,3,0],[0,2,1,3],[0,0,0,0],[0,3,1,2],[0,3,2,1],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,3,2,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,2,0,3],[0,0,0,0],[1,3,0,2],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,3,0,1],[2,3,1,0],[1,0,2,3],[1,0,3,2],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,0,3,1],[0,0,0,0],[2,1,3,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,0,1,3],[0,0,0,0],[0,0,0,0],[0,0,0,0],[3,0,1,2],[3,0,2,1],[0,0,0,0],[3,1,2,0],[2,1,0,3],[0,0,0,0],[0,0,0,0],[0,0,0,0],[3,1,0,2],[0,0,0,0],[3,2,0,1],[3,2,1,0]]),M(this,"dot",(n,r,i)=>n[0]*r+n[1]*i),M(this,"dot3",(n,r,i,s)=>n[0]*r+n[1]*i+n[2]*s),M(this,"dot4",(n,r,i,s,a)=>n[0]*r+n[1]*i+n[2]*s+n[3]*a),M(this,"noise",(n,r)=>{let i,s,a;const o=.5*(Math.sqrt(3)-1),l=(n+r)*o,h=Math.floor(n+l),u=Math.floor(r+l),A=(3-Math.sqrt(3))/6,f=(h+u)*A,d=h-f,m=u-f,y=n-d,C=r-m;let x=0,I=1;y>C&&(x=1,I=0);const g=y-x+A,v=C-I+A,w=y-1+2*A,b=C-1+2*A,B=h&255,_=u&255,E=this.perm[B+this.perm[_]]%12,T=this.perm[B+x+this.perm[_+I]]%12,L=this.perm[B+1+this.perm[_+1]]%12;let R=.5-y*y-C*C;R<0?i=0:(R*=R,i=R*R*this.dot(this.grad3[E],y,C));let V=.5-g*g-v*v;V<0?s=0:(V*=V,s=V*V*this.dot(this.grad3[T],g,v));let Y=.5-w*w-b*b;return Y<0?a=0:(Y*=Y,a=Y*Y*this.dot(this.grad3[L],w,b)),70*(i+s+a)}),M(this,"noise3d",(n,r,i)=>{let s,a,o,l;const h=.3333333333333333,u=(n+r+i)*h,A=Math.floor(n+u),f=Math.floor(r+u),d=Math.floor(i+u),m=1/6,y=(A+f+d)*m,C=A-y,x=f-y,I=d-y,g=n-C,v=r-x,w=i-I;let b,B,_,E,T,L;g>=v?v>=w?(b=1,B=0,_=0,E=1,T=1,L=0):g>=w?(b=1,B=0,_=0,E=1,T=0,L=1):(b=0,B=0,_=1,E=1,T=0,L=1):v<w?(b=0,B=0,_=1,E=0,T=1,L=1):g<w?(b=0,B=1,_=0,E=0,T=1,L=1):(b=0,B=1,_=0,E=1,T=1,L=0);const R=g-b+m,V=v-B+m,Y=w-_+m,q=g-E+2*m,ne=v-T+2*m,X=w-L+2*m,G=g-1+3*m,H=v-1+3*m,Z=w-1+3*m,$=A&255,O=f&255,F=d&255,S=this.perm[$+this.perm[O+this.perm[F]]]%12,Q=this.perm[$+b+this.perm[O+B+this.perm[F+_]]]%12,z=this.perm[$+E+this.perm[O+T+this.perm[F+L]]]%12,P=this.perm[$+1+this.perm[O+1+this.perm[F+1]]]%12;let K=.6-g*g-v*v-w*w;K<0?s=0:(K*=K,s=K*K*this.dot3(this.grad3[S],g,v,w));let se=.6-R*R-V*V-Y*Y;se<0?a=0:(se*=se,a=se*se*this.dot3(this.grad3[Q],R,V,Y));let J=.6-q*q-ne*ne-X*X;J<0?o=0:(J*=J,o=J*J*this.dot3(this.grad3[z],q,ne,X));let ie=.6-G*G-H*H-Z*Z;return ie<0?l=0:(ie*=ie,l=ie*ie*this.dot3(this.grad3[P],G,H,Z)),32*(s+a+o+l)}),M(this,"noise4d",(n,r,i,s)=>{const a=this.grad4,o=this.simplex,l=this.perm,h=(Math.sqrt(5)-1)/4,u=(5-Math.sqrt(5))/20;let A,f,d,m,y;const C=(n+r+i+s)*h,x=Math.floor(n+C),I=Math.floor(r+C),g=Math.floor(i+C),v=Math.floor(s+C),w=(x+I+g+v)*u,b=x-w,B=I-w,_=g-w,E=v-w,T=n-b,L=r-B,R=i-_,V=s-E,Y=T>L?32:0,q=T>R?16:0,ne=L>R?8:0,X=T>V?4:0,G=L>V?2:0,H=R>V?1:0,Z=Y+q+ne+X+G+H;let $,O,F,S,Q,z,P,K,se,J,ie,ee;$=o[Z][0]>=3?1:0,O=o[Z][1]>=3?1:0,F=o[Z][2]>=3?1:0,S=o[Z][3]>=3?1:0,Q=o[Z][0]>=2?1:0,z=o[Z][1]>=2?1:0,P=o[Z][2]>=2?1:0,K=o[Z][3]>=2?1:0,se=o[Z][0]>=1?1:0,J=o[Z][1]>=1?1:0,ie=o[Z][2]>=1?1:0,ee=o[Z][3]>=1?1:0;const fe=T-$+u,te=L-O+u,oe=R-F+u,U=V-S+u,D=T-Q+2*u,le=L-z+2*u,Se=R-P+2*u,De=V-K+2*u,Ue=T-se+3*u,qe=L-J+3*u,ht=R-ie+3*u,fn=V-ee+3*u,_n=T-1+4*u,st=L-1+4*u,Hn=R-1+4*u,dn=V-1+4*u,xr=x&255,Sr=I&255,$n=g&255,Br=v&255,Ba=l[xr+l[Sr+l[$n+l[Br]]]]%32,wa=l[xr+$+l[Sr+O+l[$n+F+l[Br+S]]]]%32,Yi=l[xr+Q+l[Sr+z+l[$n+P+l[Br+K]]]]%32,N=l[xr+se+l[Sr+J+l[$n+ie+l[Br+ee]]]]%32,re=l[xr+1+l[Sr+1+l[$n+1+l[Br+1]]]]%32;let de=.6-T*T-L*L-R*R-V*V;de<0?A=0:(de*=de,A=de*de*this.dot4(a[Ba],T,L,R,V));let be=.6-fe*fe-te*te-oe*oe-U*U;be<0?f=0:(be*=be,f=be*be*this.dot4(a[wa],fe,te,oe,U));let Qe=.6-D*D-le*le-Se*Se-De*De;Qe<0?d=0:(Qe*=Qe,d=Qe*Qe*this.dot4(a[Yi],D,le,Se,De));let ut=.6-Ue*Ue-qe*qe-ht*ht-fn*fn;ut<0?m=0:(ut*=ut,m=ut*ut*this.dot4(a[N],Ue,qe,ht,fn));let mt=.6-_n*_n-st*st-Hn*Hn-dn*dn;return mt<0?y=0:(mt*=mt,y=mt*mt*this.dot4(a[re],_n,st,Hn,dn)),27*(A+f+d+m+y)});for(let n=0;n<256;n++)this.p[n]=Math.floor(e.random()*256);for(let n=0;n<512;n++)this.perm[n]=this.p[n&255]}}const ot=class extends c.BufferGeometry{constructor(t={}){super(),this.isLightningStrike=!0,this.type="LightningStrike",this.init(ot.copyParameters(t,t)),this.createMesh()}static createRandomGenerator(){const e=[];for(let r=0;r<2053;r++)e.push(Math.random());const n={currentSeed:0,random:function(){const r=e[n.currentSeed];return n.currentSeed=(n.currentSeed+1)%2053,r},getSeed:function(){return n.currentSeed/2053},setSeed:function(r){n.currentSeed=Math.floor(r*2053)%2053}};return n}static copyParameters(t={},e={}){const n=function(r){return e===t?r:r.clone()};return t.sourceOffset=e.sourceOffset!==void 0?n(e.sourceOffset):new c.Vector3(0,100,0),t.destOffset=e.destOffset!==void 0?n(e.destOffset):new c.Vector3(0,0,0),t.timeScale=e.timeScale!==void 0?e.timeScale:1,t.roughness=e.roughness!==void 0?e.roughness:.9,t.straightness=e.straightness!==void 0?e.straightness:.7,t.up0=e.up0!==void 0?n(e.up0):new c.Vector3(0,0,1),t.up1=e.up1!==void 0?n(e.up1):new c.Vector3(0,0,1),t.radius0=e.radius0!==void 0?e.radius0:1,t.radius1=e.radius1!==void 0?e.radius1:1,t.radius0Factor=e.radius0Factor!==void 0?e.radius0Factor:.5,t.radius1Factor=e.radius1Factor!==void 0?e.radius1Factor:.2,t.minRadius=e.minRadius!==void 0?e.minRadius:.2,t.isEternal=e.isEternal!==void 0?e.isEternal:e.birthTime===void 0||e.deathTime===void 0,t.birthTime=e.birthTime,t.deathTime=e.deathTime,t.propagationTimeFactor=e.propagationTimeFactor!==void 0?e.propagationTimeFactor:.1,t.vanishingTimeFactor=e.vanishingTimeFactor!==void 0?e.vanishingTimeFactor:.9,t.subrayPeriod=e.subrayPeriod!==void 0?e.subrayPeriod:4,t.subrayDutyCycle=e.subrayDutyCycle!==void 0?e.subrayDutyCycle:.6,t.maxIterations=e.maxIterations!==void 0?e.maxIterations:9,t.isStatic=e.isStatic!==void 0?e.isStatic:!1,t.ramification=e.ramification!==void 0?e.ramification:5,t.maxSubrayRecursion=e.maxSubrayRecursion!==void 0?e.maxSubrayRecursion:3,t.recursionProbability=e.recursionProbability!==void 0?e.recursionProbability:.6,t.generateUVs=e.generateUVs!==void 0?e.generateUVs:!1,t.randomGenerator=e.randomGenerator,t.noiseSeed=e.noiseSeed,t.onDecideSubrayCreation=e.onDecideSubrayCreation,t.onSubrayCreation=e.onSubrayCreation,t}update(t){this.isStatic||(this.rayParameters.isEternal||this.rayParameters.birthTime<=t&&t<=this.rayParameters.deathTime?(this.updateMesh(t),t<this.subrays[0].endPropagationTime?this.state=ot.RAY_PROPAGATING:t>this.subrays[0].beginVanishingTime?this.state=ot.RAY_VANISHING:this.state=ot.RAY_STEADY,this.visible=!0):(this.visible=!1,t<this.rayParameters.birthTime?this.state=ot.RAY_UNBORN:this.state=ot.RAY_EXTINGUISHED))}init(t){this.rayParameters=t,this.maxIterations=t.maxIterations!==void 0?Math.floor(t.maxIterations):9,t.maxIterations=this.maxIterations,this.isStatic=t.isStatic!==void 0?t.isStatic:!1,t.isStatic=this.isStatic,this.ramification=t.ramification!==void 0?Math.floor(t.ramification):5,t.ramification=this.ramification,this.maxSubrayRecursion=t.maxSubrayRecursion!==void 0?Math.floor(t.maxSubrayRecursion):3,t.maxSubrayRecursion=this.maxSubrayRecursion,this.recursionProbability=t.recursionProbability!==void 0?t.recursionProbability:.6,t.recursionProbability=this.recursionProbability,this.generateUVs=t.generateUVs!==void 0?t.generateUVs:!1,t.generateUVs=this.generateUVs,t.randomGenerator!==void 0?(this.randomGenerator=t.randomGenerator,this.seedGenerator=t.randomGenerator,t.noiseSeed!==void 0&&this.seedGenerator.setSeed(t.noiseSeed)):(this.randomGenerator=ot.createRandomGenerator(),this.seedGenerator=Math),t.onDecideSubrayCreation!==void 0?this.onDecideSubrayCreation=t.onDecideSubrayCreation:(this.createDefaultSubrayCreationCallbacks(),t.onSubrayCreation!==void 0&&(this.onSubrayCreation=t.onSubrayCreation)),this.state=ot.RAY_INITIALIZED,this.maxSubrays=Math.ceil(1+Math.pow(this.ramification,Math.max(0,this.maxSubrayRecursion-1))),t.maxSubrays=this.maxSubrays,this.maxRaySegments=2*(1<<this.maxIterations),this.subrays=[];for(let e=0;e<this.maxSubrays;e++)this.subrays.push(this.createSubray());this.raySegments=[];for(let e=0;e<this.maxRaySegments;e++)this.raySegments.push(this.createSegment());this.time=0,this.timeFraction=0,this.currentSegmentCallback=null,this.currentCreateTriangleVertices=this.generateUVs?this.createTriangleVerticesWithUVs:this.createTriangleVerticesWithoutUVs,this.numSubrays=0,this.currentSubray=null,this.currentSegmentIndex=0,this.isInitialSegment=!1,this.subrayProbability=0,this.currentVertex=0,this.currentIndex=0,this.currentCoordinate=0,this.currentUVCoordinate=0,this.vertices=null,this.uvs=null,this.indices=null,this.positionAttribute=null,this.uvsAttribute=null,this.simplexX=new ai(this.seedGenerator),this.simplexY=new ai(this.seedGenerator),this.simplexZ=new ai(this.seedGenerator),this.forwards=new c.Vector3,this.forwardsFill=new c.Vector3,this.side=new c.Vector3,this.down=new c.Vector3,this.middlePos=new c.Vector3,this.middleLinPos=new c.Vector3,this.newPos=new c.Vector3,this.vPos=new c.Vector3,this.cross1=new c.Vector3}createMesh(){const t=1<<this.maxIterations,e=3*(t+1)*this.maxSubrays,n=18*t*this.maxSubrays;this.vertices=new Float32Array(e*3),this.indices=new Uint32Array(n),this.generateUVs&&(this.uvs=new Float32Array(e*2)),this.fillMesh(0),this.setIndex(new c.Uint32BufferAttribute(this.indices,1)),this.positionAttribute=new c.Float32BufferAttribute(this.vertices,3),this.setAttribute("position",this.positionAttribute),this.generateUVs&&(this.uvsAttribute=new c.Float32BufferAttribute(new Float32Array(this.uvs),2),this.setAttribute("uv",this.uvsAttribute)),this.isStatic||(this.index.usage=c.DynamicDrawUsage,this.positionAttribute.usage=c.DynamicDrawUsage,this.generateUVs&&(this.uvsAttribute.usage=c.DynamicDrawUsage)),this.vertices=this.positionAttribute.array,this.indices=this.index.array,this.generateUVs&&(this.uvs=this.uvsAttribute.array)}updateMesh(t){this.fillMesh(t),this.drawRange.count=this.currentIndex,this.index.needsUpdate=!0,this.positionAttribute.needsUpdate=!0,this.generateUVs&&(this.uvsAttribute.needsUpdate=!0)}fillMesh(t){const e=this;this.currentVertex=0,this.currentIndex=0,this.currentCoordinate=0,this.currentUVCoordinate=0,this.fractalRay(t,function(r){const i=e.currentSubray;t<i.birthTime||(this.rayParameters.isEternal&&e.currentSubray.recursion==0?(e.createPrism(r),e.onDecideSubrayCreation(r,e)):t<i.endPropagationTime?e.timeFraction>=r.fraction0*i.propagationTimeFactor&&(e.createPrism(r),e.onDecideSubrayCreation(r,e)):t<i.beginVanishingTime?(e.createPrism(r),e.onDecideSubrayCreation(r,e)):(e.timeFraction<=i.vanishingTimeFactor+r.fraction1*(1-i.vanishingTimeFactor)&&e.createPrism(r),e.onDecideSubrayCreation(r,e)))})}addNewSubray(){return this.subrays[this.numSubrays++]}initSubray(t,e){t.pos0.copy(e.sourceOffset),t.pos1.copy(e.destOffset),t.up0.copy(e.up0),t.up1.copy(e.up1),t.radius0=e.radius0,t.radius1=e.radius1,t.birthTime=e.birthTime,t.deathTime=e.deathTime,t.timeScale=e.timeScale,t.roughness=e.roughness,t.straightness=e.straightness,t.propagationTimeFactor=e.propagationTimeFactor,t.vanishingTimeFactor=e.vanishingTimeFactor,t.maxIterations=this.maxIterations,t.seed=e.noiseSeed!==void 0?e.noiseSeed:0,t.recursion=0}fractalRay(t,e){this.time=t,this.currentSegmentCallback=e,this.numSubrays=0,this.initSubray(this.addNewSubray(),this.rayParameters);for(let n=0;n<this.numSubrays;n++){const r=this.subrays[n];this.currentSubray=r,this.randomGenerator.setSeed(r.seed),r.endPropagationTime=c.MathUtils.lerp(r.birthTime,r.deathTime,r.propagationTimeFactor),r.beginVanishingTime=c.MathUtils.lerp(r.deathTime,r.birthTime,1-r.vanishingTimeFactor);const i=this.randomGenerator.random;r.linPos0.set(i(),i(),i()).multiplyScalar(1e3),r.linPos1.set(i(),i(),i()).multiplyScalar(1e3),this.timeFraction=(t-r.birthTime)/(r.deathTime-r.birthTime),this.currentSegmentIndex=0,this.isInitialSegment=!0;const s=this.getNewSegment();s.iteration=0,s.pos0.copy(r.pos0),s.pos1.copy(r.pos1),s.linPos0.copy(r.linPos0),s.linPos1.copy(r.linPos1),s.up0.copy(r.up0),s.up1.copy(r.up1),s.radius0=r.radius0,s.radius1=r.radius1,s.fraction0=0,s.fraction1=1,s.positionVariationFactor=1-r.straightness,this.subrayProbability=this.ramification*Math.pow(this.recursionProbability,r.recursion)/(1<<r.maxIterations),this.fractalRayRecursive(s)}this.currentSegmentCallback=null,this.currentSubray=null}fractalRayRecursive(t){if(t.iteration>=this.currentSubray.maxIterations){this.currentSegmentCallback(t);return}this.forwards.subVectors(t.pos1,t.pos0);let e=this.forwards.length();e<1e-6&&(this.forwards.set(0,0,.01),e=this.forwards.length());const n=(t.radius0+t.radius1)*.5,r=(t.fraction0+t.fraction1)*.5,i=this.time*this.currentSubray.timeScale*Math.pow(2,t.iteration);this.middlePos.lerpVectors(t.pos0,t.pos1,.5),this.middleLinPos.lerpVectors(t.linPos0,t.linPos1,.5);const s=this.middleLinPos;this.newPos.set(this.simplexX.noise4d(s.x,s.y,s.z,i),this.simplexY.noise4d(s.x,s.y,s.z,i),this.simplexZ.noise4d(s.x,s.y,s.z,i)),this.newPos.multiplyScalar(t.positionVariationFactor*e),this.newPos.add(this.middlePos);const a=this.getNewSegment();a.pos0.copy(t.pos0),a.pos1.copy(this.newPos),a.linPos0.copy(t.linPos0),a.linPos1.copy(this.middleLinPos),a.up0.copy(t.up0),a.up1.copy(t.up1),a.radius0=t.radius0,a.radius1=n,a.fraction0=t.fraction0,a.fraction1=r,a.positionVariationFactor=t.positionVariationFactor*this.currentSubray.roughness,a.iteration=t.iteration+1;const o=this.getNewSegment();o.pos0.copy(this.newPos),o.pos1.copy(t.pos1),o.linPos0.copy(this.middleLinPos),o.linPos1.copy(t.linPos1),this.cross1.crossVectors(t.up0,this.forwards.normalize()),o.up0.crossVectors(this.forwards,this.cross1).normalize(),o.up1.copy(t.up1),o.radius0=n,o.radius1=t.radius1,o.fraction0=r,o.fraction1=t.fraction1,o.positionVariationFactor=t.positionVariationFactor*this.currentSubray.roughness,o.iteration=t.iteration+1,this.fractalRayRecursive(a),this.fractalRayRecursive(o)}createPrism(t){this.forwardsFill.subVectors(t.pos1,t.pos0).normalize(),this.isInitialSegment&&(this.currentCreateTriangleVertices(t.pos0,t.up0,this.forwardsFill,t.radius0,0),this.isInitialSegment=!1),this.currentCreateTriangleVertices(t.pos1,t.up0,this.forwardsFill,t.radius1,t.fraction1),this.createPrismFaces()}createTriangleVerticesWithoutUVs(t,e,n,r){this.side.crossVectors(e,n).multiplyScalar(r*ot.COS30DEG),this.down.copy(e).multiplyScalar(-r*ot.SIN30DEG);const i=this.vPos,s=this.vertices;i.copy(t).sub(this.side).add(this.down),s[this.currentCoordinate++]=i.x,s[this.currentCoordinate++]=i.y,s[this.currentCoordinate++]=i.z,i.copy(t).add(this.side).add(this.down),s[this.currentCoordinate++]=i.x,s[this.currentCoordinate++]=i.y,s[this.currentCoordinate++]=i.z,i.copy(e).multiplyScalar(r).add(t),s[this.currentCoordinate++]=i.x,s[this.currentCoordinate++]=i.y,s[this.currentCoordinate++]=i.z,this.currentVertex+=3}createTriangleVerticesWithUVs(t,e,n,r,i){this.side.crossVectors(e,n).multiplyScalar(r*ot.COS30DEG),this.down.copy(e).multiplyScalar(-r*ot.SIN30DEG);const s=this.vPos,a=this.vertices,o=this.uvs;s.copy(t).sub(this.side).add(this.down),a[this.currentCoordinate++]=s.x,a[this.currentCoordinate++]=s.y,a[this.currentCoordinate++]=s.z,o[this.currentUVCoordinate++]=i,o[this.currentUVCoordinate++]=0,s.copy(t).add(this.side).add(this.down),a[this.currentCoordinate++]=s.x,a[this.currentCoordinate++]=s.y,a[this.currentCoordinate++]=s.z,o[this.currentUVCoordinate++]=i,o[this.currentUVCoordinate++]=.5,s.copy(e).multiplyScalar(r).add(t),a[this.currentCoordinate++]=s.x,a[this.currentCoordinate++]=s.y,a[this.currentCoordinate++]=s.z,o[this.currentUVCoordinate++]=i,o[this.currentUVCoordinate++]=1,this.currentVertex+=3}createPrismFaces(t){const e=this.indices;t=this.currentVertex-6,e[this.currentIndex++]=t+1,e[this.currentIndex++]=t+2,e[this.currentIndex++]=t+5,e[this.currentIndex++]=t+1,e[this.currentIndex++]=t+5,e[this.currentIndex++]=t+4,e[this.currentIndex++]=t+0,e[this.currentIndex++]=t+1,e[this.currentIndex++]=t+4,e[this.currentIndex++]=t+0,e[this.currentIndex++]=t+4,e[this.currentIndex++]=t+3,e[this.currentIndex++]=t+2,e[this.currentIndex++]=t+0,e[this.currentIndex++]=t+3,e[this.currentIndex++]=t+2,e[this.currentIndex++]=t+3,e[this.currentIndex++]=t+5}createDefaultSubrayCreationCallbacks(){const t=this.randomGenerator.random;this.onDecideSubrayCreation=function(s,a){const o=a.currentSubray,l=a.rayParameters.subrayPeriod,h=a.rayParameters.subrayDutyCycle,u=a.rayParameters.isEternal&&o.recursion==0?-t()*l:c.MathUtils.lerp(o.birthTime,o.endPropagationTime,s.fraction0)-t()*l,A=a.time-u,f=Math.floor(A/l),d=t()*(f+1),m=A%l<=h*l;let y=0;if(m&&(y=a.subrayProbability),o.recursion<a.maxSubrayRecursion&&a.numSubrays<a.maxSubrays&&t()<y){const C=a.addNewSubray(),x=a.randomGenerator.getSeed();C.seed=d,a.randomGenerator.setSeed(d),C.recursion=o.recursion+1,C.maxIterations=Math.max(1,o.maxIterations-1),C.linPos0.set(t(),t(),t()).multiplyScalar(1e3),C.linPos1.set(t(),t(),t()).multiplyScalar(1e3),C.up0.copy(o.up0),C.up1.copy(o.up1),C.radius0=s.radius0*a.rayParameters.radius0Factor,C.radius1=Math.min(a.rayParameters.minRadius,s.radius1*a.rayParameters.radius1Factor),C.birthTime=u+f*l,C.deathTime=C.birthTime+l*h,!a.rayParameters.isEternal&&o.recursion==0&&(C.birthTime=Math.max(C.birthTime,o.birthTime),C.deathTime=Math.min(C.deathTime,o.deathTime)),C.timeScale=o.timeScale*2,C.roughness=o.roughness,C.straightness=o.straightness,C.propagationTimeFactor=o.propagationTimeFactor,C.vanishingTimeFactor=o.vanishingTimeFactor,a.onSubrayCreation(s,o,C,a),a.randomGenerator.setSeed(x)}};const e=new c.Vector3,n=new c.Vector3,r=new c.Vector3,i=new c.Vector3;this.onSubrayCreation=function(s,a,o,l){l.subrayCylinderPosition(s,a,o,.5,.6,.2)},this.subrayConePosition=function(s,a,o,l,h,u){o.pos0.copy(s.pos0),e.subVectors(a.pos1,a.pos0),n.copy(e).normalize(),e.multiplyScalar(s.fraction0+(1-s.fraction0)*(t()*l));const A=e.length();r.crossVectors(a.up0,n);const f=2*Math.PI*t();r.multiplyScalar(Math.cos(f)),i.copy(a.up0).multiplyScalar(Math.sin(f)),o.pos1.copy(r).add(i).multiplyScalar(A*h*(u+t()*(1-u))).add(e).add(a.pos0)},this.subrayCylinderPosition=function(s,a,o,l,h,u){o.pos0.copy(s.pos0),e.subVectors(a.pos1,a.pos0),n.copy(e).normalize(),e.multiplyScalar(s.fraction0+(1-s.fraction0)*((2*t()-1)*l));const A=e.length();r.crossVectors(a.up0,n);const f=2*Math.PI*t();r.multiplyScalar(Math.cos(f)),i.copy(a.up0).multiplyScalar(Math.sin(f)),o.pos1.copy(r).add(i).multiplyScalar(A*h*(u+t()*(1-u))).add(e).add(a.pos0)}}createSubray(){return{seed:0,maxIterations:0,recursion:0,pos0:new c.Vector3,pos1:new c.Vector3,linPos0:new c.Vector3,linPos1:new c.Vector3,up0:new c.Vector3,up1:new c.Vector3,radius0:0,radius1:0,birthTime:0,deathTime:0,timeScale:0,roughness:0,straightness:0,propagationTimeFactor:0,vanishingTimeFactor:0,endPropagationTime:0,beginVanishingTime:0}}createSegment(){return{iteration:0,pos0:new c.Vector3,pos1:new c.Vector3,linPos0:new c.Vector3,linPos1:new c.Vector3,up0:new c.Vector3,up1:new c.Vector3,radius0:0,radius1:0,fraction0:0,fraction1:0,positionVariationFactor:0}}getNewSegment(){return this.raySegments[this.currentSegmentIndex++]}copy(t){return super.copy(t),this.init(ot.copyParameters({},t.rayParameters)),this}clone(){return new this.constructor(ot.copyParameters({},this.rayParameters))}};let Qn=ot;M(Qn,"RAY_INITIALIZED",0),M(Qn,"RAY_UNBORN",1),M(Qn,"RAY_PROPAGATING",2),M(Qn,"RAY_STEADY",3),M(Qn,"RAY_VANISHING",4),M(Qn,"RAY_EXTINGUISHED",5),M(Qn,"COS30DEG",Math.cos(30*Math.PI/180)),M(Qn,"SIN30DEG",Math.sin(30*Math.PI/180));const rr=class extends c.Mesh{constructor(t,e={}){super(t),this.isReflectorForSSRPass=!0,this.type="ReflectorForSSRPass";const n=this,r=e.color!==void 0?new c.Color(e.color):new c.Color(8355711),i=e.textureWidth||512,s=e.textureHeight||512,a=e.clipBias||0,o=e.shader||rr.ReflectorShader,l=e.useDepthTexture===!0,h=new c.Vector3(0,1,0),u=new c.Vector3,A=new c.Vector3;n.needsUpdate=!1,n.maxDistance=rr.ReflectorShader.uniforms.maxDistance.value,n.opacity=rr.ReflectorShader.uniforms.opacity.value,n.color=r,n.resolution=e.resolution||new c.Vector2(window.innerWidth,window.innerHeight),n._distanceAttenuation=rr.ReflectorShader.defines.DISTANCE_ATTENUATION,Object.defineProperty(n,"distanceAttenuation",{get(){return n._distanceAttenuation},set(L){n._distanceAttenuation!==L&&(n._distanceAttenuation=L,n.material.defines.DISTANCE_ATTENUATION=L,n.material.needsUpdate=!0)}}),n._fresnel=rr.ReflectorShader.defines.FRESNEL,Object.defineProperty(n,"fresnel",{get(){return n._fresnel},set(L){n._fresnel!==L&&(n._fresnel=L,n.material.defines.FRESNEL=L,n.material.needsUpdate=!0)}});const f=new c.Vector3,d=new c.Vector3,m=new c.Vector3,y=new c.Matrix4,C=new c.Vector3(0,0,-1),x=new c.Vector3,I=new c.Vector3,g=new c.Matrix4,v=new c.PerspectiveCamera;let w;l&&(w=new c.DepthTexture,w.type=c.UnsignedShortType,w.minFilter=c.NearestFilter,w.magFilter=c.NearestFilter);const b={depthTexture:l?w:null,type:c.HalfFloatType},B=new c.WebGLRenderTarget(i,s,b),_=new c.ShaderMaterial({transparent:l,defines:Object.assign({},rr.ReflectorShader.defines,{useDepthTexture:l}),uniforms:c.UniformsUtils.clone(o.uniforms),fragmentShader:o.fragmentShader,vertexShader:o.vertexShader});_.uniforms.tDiffuse.value=B.texture,_.uniforms.color.value=n.color,_.uniforms.textureMatrix.value=g,l&&(_.uniforms.tDepth.value=B.depthTexture),this.material=_;const T=[new c.Plane(new c.Vector3(0,1,0),a)];this.doRender=function(L,R,V){if(_.uniforms.maxDistance.value=n.maxDistance,_.uniforms.color.value=n.color,_.uniforms.opacity.value=n.opacity,u.copy(V.position).normalize(),A.copy(u).reflect(h),_.uniforms.fresnelCoe.value=(u.dot(A)+1)/2,d.setFromMatrixPosition(n.matrixWorld),m.setFromMatrixPosition(V.matrixWorld),y.extractRotation(n.matrixWorld),f.set(0,0,1),f.applyMatrix4(y),x.subVectors(d,m),x.dot(f)>0)return;x.reflect(f).negate(),x.add(d),y.extractRotation(V.matrixWorld),C.set(0,0,-1),C.applyMatrix4(y),C.add(m),I.subVectors(d,C),I.reflect(f).negate(),I.add(d),v.position.copy(x),v.up.set(0,1,0),v.up.applyMatrix4(y),v.up.reflect(f),v.lookAt(I),v.far=V.far,v.updateMatrixWorld(),v.projectionMatrix.copy(V.projectionMatrix),_.uniforms.virtualCameraNear.value=V.near,_.uniforms.virtualCameraFar.value=V.far,_.uniforms.virtualCameraMatrixWorld.value=v.matrixWorld,_.uniforms.virtualCameraProjectionMatrix.value=V.projectionMatrix,_.uniforms.virtualCameraProjectionMatrixInverse.value=V.projectionMatrixInverse,_.uniforms.resolution.value=n.resolution,g.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),g.multiply(v.projectionMatrix),g.multiply(v.matrixWorldInverse),g.multiply(n.matrixWorld);const Y=L.getRenderTarget(),q=L.xr.enabled,ne=L.shadowMap.autoUpdate,X=L.clippingPlanes;L.xr.enabled=!1,L.shadowMap.autoUpdate=!1,L.clippingPlanes=T,L.setRenderTarget(B),L.state.buffers.depth.setMask(!0),L.autoClear===!1&&L.clear(),L.render(R,v),L.xr.enabled=q,L.shadowMap.autoUpdate=ne,L.clippingPlanes=X,L.setRenderTarget(Y);const G=V.viewport;G!==void 0&&L.state.viewport(G)},this.getRenderTarget=function(){return B}}};M(rr,"ReflectorShader",{defines:{DISTANCE_ATTENUATION:!0,FRESNEL:!0},uniforms:{color:{value:null},tDiffuse:{value:null},tDepth:{value:null},textureMatrix:{value:new c.Matrix4},maxDistance:{value:180},opacity:{value:.5},fresnelCoe:{value:null},virtualCameraNear:{value:null},virtualCameraFar:{value:null},virtualCameraProjectionMatrix:{value:new c.Matrix4},virtualCameraMatrixWorld:{value:new c.Matrix4},virtualCameraProjectionMatrixInverse:{value:new c.Matrix4},resolution:{value:new c.Vector2}},vertexShader:`
|
|
196
|
+
uniform mat4 textureMatrix;
|
|
197
|
+
varying vec4 vUv;
|
|
198
|
+
|
|
199
|
+
void main() {
|
|
200
|
+
|
|
201
|
+
vUv = textureMatrix * vec4( position, 1.0 );
|
|
202
|
+
|
|
203
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
204
|
+
|
|
205
|
+
}`,fragmentShader:`
|
|
206
|
+
uniform vec3 color;
|
|
207
|
+
uniform sampler2D tDiffuse;
|
|
208
|
+
uniform sampler2D tDepth;
|
|
209
|
+
uniform float maxDistance;
|
|
210
|
+
uniform float opacity;
|
|
211
|
+
uniform float fresnelCoe;
|
|
212
|
+
uniform float virtualCameraNear;
|
|
213
|
+
uniform float virtualCameraFar;
|
|
214
|
+
uniform mat4 virtualCameraProjectionMatrix;
|
|
215
|
+
uniform mat4 virtualCameraProjectionMatrixInverse;
|
|
216
|
+
uniform mat4 virtualCameraMatrixWorld;
|
|
217
|
+
uniform vec2 resolution;
|
|
218
|
+
varying vec4 vUv;
|
|
219
|
+
#include <packing>
|
|
220
|
+
float blendOverlay( float base, float blend ) {
|
|
221
|
+
return( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );
|
|
222
|
+
}
|
|
223
|
+
vec3 blendOverlay( vec3 base, vec3 blend ) {
|
|
224
|
+
return vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) );
|
|
225
|
+
}
|
|
226
|
+
float getDepth( const in vec2 uv ) {
|
|
227
|
+
return texture2D( tDepth, uv ).x;
|
|
228
|
+
}
|
|
229
|
+
float getViewZ( const in float depth ) {
|
|
230
|
+
return perspectiveDepthToViewZ( depth, virtualCameraNear, virtualCameraFar );
|
|
231
|
+
}
|
|
232
|
+
vec3 getViewPosition( const in vec2 uv, const in float depth/*clip space*/, const in float clipW ) {
|
|
233
|
+
vec4 clipPosition = vec4( ( vec3( uv, depth ) - 0.5 ) * 2.0, 1.0 );//ndc
|
|
234
|
+
clipPosition *= clipW; //clip
|
|
235
|
+
return ( virtualCameraProjectionMatrixInverse * clipPosition ).xyz;//view
|
|
236
|
+
}
|
|
237
|
+
void main() {
|
|
238
|
+
vec4 base = texture2DProj( tDiffuse, vUv );
|
|
239
|
+
#ifdef useDepthTexture
|
|
240
|
+
vec2 uv=(gl_FragCoord.xy-.5)/resolution.xy;
|
|
241
|
+
uv.x=1.-uv.x;
|
|
242
|
+
float depth = texture2DProj( tDepth, vUv ).r;
|
|
243
|
+
float viewZ = getViewZ( depth );
|
|
244
|
+
float clipW = virtualCameraProjectionMatrix[2][3] * viewZ+virtualCameraProjectionMatrix[3][3];
|
|
245
|
+
vec3 viewPosition=getViewPosition( uv, depth, clipW );
|
|
246
|
+
vec3 worldPosition=(virtualCameraMatrixWorld*vec4(viewPosition,1)).xyz;
|
|
247
|
+
if(worldPosition.y>maxDistance) discard;
|
|
248
|
+
float op=opacity;
|
|
249
|
+
#ifdef DISTANCE_ATTENUATION
|
|
250
|
+
float ratio=1.-(worldPosition.y/maxDistance);
|
|
251
|
+
float attenuation=ratio*ratio;
|
|
252
|
+
op=opacity*attenuation;
|
|
253
|
+
#endif
|
|
254
|
+
#ifdef FRESNEL
|
|
255
|
+
op*=fresnelCoe;
|
|
256
|
+
#endif
|
|
257
|
+
gl_FragColor = vec4( blendOverlay( base.rgb, color ), op );
|
|
258
|
+
#else
|
|
259
|
+
gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );
|
|
260
|
+
#endif
|
|
261
|
+
}
|
|
262
|
+
`});const cs={uniforms:{turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:.005},mieDirectionalG:{value:.8},sunPosition:{value:new c.Vector3},up:{value:new c.Vector3(0,1,0)}},vertexShader:`
|
|
263
|
+
uniform vec3 sunPosition;
|
|
264
|
+
uniform float rayleigh;
|
|
265
|
+
uniform float turbidity;
|
|
266
|
+
uniform float mieCoefficient;
|
|
267
|
+
uniform vec3 up;
|
|
268
|
+
|
|
269
|
+
varying vec3 vWorldPosition;
|
|
270
|
+
varying vec3 vSunDirection;
|
|
271
|
+
varying float vSunfade;
|
|
272
|
+
varying vec3 vBetaR;
|
|
273
|
+
varying vec3 vBetaM;
|
|
274
|
+
varying float vSunE;
|
|
275
|
+
|
|
276
|
+
// constants for atmospheric scattering
|
|
277
|
+
const float e = 2.71828182845904523536028747135266249775724709369995957;
|
|
278
|
+
const float pi = 3.141592653589793238462643383279502884197169;
|
|
279
|
+
|
|
280
|
+
// wavelength of used primaries, according to preetham
|
|
281
|
+
const vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 );
|
|
282
|
+
// this pre-calcuation replaces older TotalRayleigh(vec3 lambda) function:
|
|
283
|
+
// (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn))
|
|
284
|
+
const vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 );
|
|
285
|
+
|
|
286
|
+
// mie stuff
|
|
287
|
+
// K coefficient for the primaries
|
|
288
|
+
const float v = 4.0;
|
|
289
|
+
const vec3 K = vec3( 0.686, 0.678, 0.666 );
|
|
290
|
+
// MieConst = pi * pow( ( 2.0 * pi ) / lambda, vec3( v - 2.0 ) ) * K
|
|
291
|
+
const vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 );
|
|
292
|
+
|
|
293
|
+
// earth shadow hack
|
|
294
|
+
// cutoffAngle = pi / 1.95;
|
|
295
|
+
const float cutoffAngle = 1.6110731556870734;
|
|
296
|
+
const float steepness = 1.5;
|
|
297
|
+
const float EE = 1000.0;
|
|
298
|
+
|
|
299
|
+
float sunIntensity( float zenithAngleCos ) {
|
|
300
|
+
zenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 );
|
|
301
|
+
return EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) );
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
vec3 totalMie( float T ) {
|
|
305
|
+
float c = ( 0.2 * T ) * 10E-18;
|
|
306
|
+
return 0.434 * c * MieConst;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
void main() {
|
|
310
|
+
|
|
311
|
+
vec4 worldPosition = modelMatrix * vec4( position, 1.0 );
|
|
312
|
+
vWorldPosition = worldPosition.xyz;
|
|
313
|
+
|
|
314
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
315
|
+
gl_Position.z = gl_Position.w; // set z to camera.far
|
|
316
|
+
|
|
317
|
+
vSunDirection = normalize( sunPosition );
|
|
318
|
+
|
|
319
|
+
vSunE = sunIntensity( dot( vSunDirection, up ) );
|
|
320
|
+
|
|
321
|
+
vSunfade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 );
|
|
322
|
+
|
|
323
|
+
float rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) );
|
|
324
|
+
|
|
325
|
+
// extinction (absorbtion + out scattering)
|
|
326
|
+
// rayleigh coefficients
|
|
327
|
+
vBetaR = totalRayleigh * rayleighCoefficient;
|
|
328
|
+
|
|
329
|
+
// mie coefficients
|
|
330
|
+
vBetaM = totalMie( turbidity ) * mieCoefficient;
|
|
331
|
+
|
|
332
|
+
}
|
|
333
|
+
`,fragmentShader:`
|
|
334
|
+
varying vec3 vWorldPosition;
|
|
335
|
+
varying vec3 vSunDirection;
|
|
336
|
+
varying float vSunfade;
|
|
337
|
+
varying vec3 vBetaR;
|
|
338
|
+
varying vec3 vBetaM;
|
|
339
|
+
varying float vSunE;
|
|
340
|
+
|
|
341
|
+
uniform float mieDirectionalG;
|
|
342
|
+
uniform vec3 up;
|
|
343
|
+
|
|
344
|
+
const vec3 cameraPos = vec3( 0.0, 0.0, 0.0 );
|
|
345
|
+
|
|
346
|
+
// constants for atmospheric scattering
|
|
347
|
+
const float pi = 3.141592653589793238462643383279502884197169;
|
|
348
|
+
|
|
349
|
+
const float n = 1.0003; // refractive index of air
|
|
350
|
+
const float N = 2.545E25; // number of molecules per unit volume for air at 288.15K and 1013mb (sea level -45 celsius)
|
|
351
|
+
|
|
352
|
+
// optical length at zenith for molecules
|
|
353
|
+
const float rayleighZenithLength = 8.4E3;
|
|
354
|
+
const float mieZenithLength = 1.25E3;
|
|
355
|
+
// 66 arc seconds -> degrees, and the cosine of that
|
|
356
|
+
const float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;
|
|
357
|
+
|
|
358
|
+
// 3.0 / ( 16.0 * pi )
|
|
359
|
+
const float THREE_OVER_SIXTEENPI = 0.05968310365946075;
|
|
360
|
+
// 1.0 / ( 4.0 * pi )
|
|
361
|
+
const float ONE_OVER_FOURPI = 0.07957747154594767;
|
|
362
|
+
|
|
363
|
+
float rayleighPhase( float cosTheta ) {
|
|
364
|
+
return THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) );
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
float hgPhase( float cosTheta, float g ) {
|
|
368
|
+
float g2 = pow( g, 2.0 );
|
|
369
|
+
float inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 );
|
|
370
|
+
return ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse );
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
void main() {
|
|
374
|
+
|
|
375
|
+
vec3 direction = normalize( vWorldPosition - cameraPos );
|
|
376
|
+
|
|
377
|
+
// optical length
|
|
378
|
+
// cutoff angle at 90 to avoid singularity in next formula.
|
|
379
|
+
float zenithAngle = acos( max( 0.0, dot( up, direction ) ) );
|
|
380
|
+
float inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) );
|
|
381
|
+
float sR = rayleighZenithLength * inverse;
|
|
382
|
+
float sM = mieZenithLength * inverse;
|
|
383
|
+
|
|
384
|
+
// combined extinction factor
|
|
385
|
+
vec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) );
|
|
386
|
+
|
|
387
|
+
// in scattering
|
|
388
|
+
float cosTheta = dot( direction, vSunDirection );
|
|
389
|
+
|
|
390
|
+
float rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 );
|
|
391
|
+
vec3 betaRTheta = vBetaR * rPhase;
|
|
392
|
+
|
|
393
|
+
float mPhase = hgPhase( cosTheta, mieDirectionalG );
|
|
394
|
+
vec3 betaMTheta = vBetaM * mPhase;
|
|
395
|
+
|
|
396
|
+
vec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) );
|
|
397
|
+
Lin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) );
|
|
398
|
+
|
|
399
|
+
// nightsky
|
|
400
|
+
float theta = acos( direction.y ); // elevation --> y-axis, [-pi/2, pi/2]
|
|
401
|
+
float phi = atan( direction.z, direction.x ); // azimuth --> x-axis [-pi/2, pi/2]
|
|
402
|
+
vec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 );
|
|
403
|
+
vec3 L0 = vec3( 0.1 ) * Fex;
|
|
404
|
+
|
|
405
|
+
// composition + solar disc
|
|
406
|
+
float sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta );
|
|
407
|
+
L0 += ( vSunE * 19000.0 * Fex ) * sundisk;
|
|
408
|
+
|
|
409
|
+
vec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 );
|
|
410
|
+
|
|
411
|
+
vec3 retColor = pow( texColor, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) );
|
|
412
|
+
|
|
413
|
+
gl_FragColor = vec4( retColor, 1.0 );
|
|
414
|
+
|
|
415
|
+
#include <tonemapping_fragment>
|
|
416
|
+
#include <${parseInt(c.REVISION.replace(/\D+/g,""))>=154?"colorspace_fragment":"encodings_fragment"}>
|
|
417
|
+
|
|
418
|
+
}
|
|
419
|
+
`},M3=new c.ShaderMaterial({name:"SkyShader",fragmentShader:cs.fragmentShader,vertexShader:cs.vertexShader,uniforms:c.UniformsUtils.clone(cs.uniforms),side:c.BackSide,depthWrite:!1});let D3=class extends c.Mesh{constructor(){super(new c.BoxGeometry(1,1,1),M3)}};M(D3,"SkyShader",cs),M(D3,"material",M3);const L3=class extends c.Mesh{constructor(t,e={}){super(t),this.isWater=!0,this.type="Water";const n=this,r=e.color!==void 0?new c.Color(e.color):new c.Color(16777215),i=e.textureWidth||512,s=e.textureHeight||512,a=e.clipBias||0,o=e.flowDirection||new c.Vector2(1,0),l=e.flowSpeed||.03,h=e.reflectivity||.02,u=e.scale||1,A=e.shader||L3.WaterShader,f=e.encoding!==void 0?e.encoding:3e3,d=e.flowMap||void 0,m=e.normalMap0,y=e.normalMap1,C=.15,x=C*.5,I=new c.Matrix4,g=new c.Clock;if(co===void 0){console.error("THREE.Water: Required component Reflector not found.");return}if(ho===void 0){console.error("THREE.Water: Required component Refractor not found.");return}const v=new co(t,{textureWidth:i,textureHeight:s,clipBias:a,encoding:f}),w=new ho(t,{textureWidth:i,textureHeight:s,clipBias:a,encoding:f});v.matrixAutoUpdate=!1,w.matrixAutoUpdate=!1,this.material=new c.ShaderMaterial({uniforms:c.UniformsUtils.merge([c.UniformsLib.fog,A.uniforms]),vertexShader:A.vertexShader,fragmentShader:A.fragmentShader,transparent:!0,fog:!0}),d!==void 0?(this.material.defines.USE_FLOWMAP="",this.material.uniforms.tFlowMap={type:"t",value:d}):this.material.uniforms.flowDirection={type:"v2",value:o},m.wrapS=m.wrapT=c.RepeatWrapping,y.wrapS=y.wrapT=c.RepeatWrapping,this.material.uniforms.tReflectionMap.value=v.getRenderTarget().texture,this.material.uniforms.tRefractionMap.value=w.getRenderTarget().texture,this.material.uniforms.tNormalMap0.value=m,this.material.uniforms.tNormalMap1.value=y,this.material.uniforms.color.value=r,this.material.uniforms.reflectivity.value=h,this.material.uniforms.textureMatrix.value=I,this.material.uniforms.config.value.x=0,this.material.uniforms.config.value.y=x,this.material.uniforms.config.value.z=x,this.material.uniforms.config.value.w=u;function b(_){I.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),I.multiply(_.projectionMatrix),I.multiply(_.matrixWorldInverse),I.multiply(n.matrixWorld)}function B(){const _=g.getDelta(),E=n.material.uniforms.config;E.value.x+=l*_,E.value.y=E.value.x+x,E.value.x>=C?(E.value.x=0,E.value.y=x):E.value.y>=C&&(E.value.y=E.value.y-C)}this.onBeforeRender=function(_,E,T){b(T),B(),n.visible=!1,v.matrixWorld.copy(n.matrixWorld),w.matrixWorld.copy(n.matrixWorld),v.onBeforeRender(_,E,T),w.onBeforeRender(_,E,T),n.visible=!0}}};M(L3,"WaterShader",{uniforms:{color:{value:null},reflectivity:{value:0},tReflectionMap:{value:null},tRefractionMap:{value:null},tNormalMap0:{value:null},tNormalMap1:{value:null},textureMatrix:{value:null},config:{value:new c.Vector4}},vertexShader:`
|
|
420
|
+
|
|
421
|
+
#include <common>
|
|
422
|
+
#include <fog_pars_vertex>
|
|
423
|
+
#include <logdepthbuf_pars_vertex>
|
|
424
|
+
|
|
425
|
+
uniform mat4 textureMatrix;
|
|
426
|
+
|
|
427
|
+
varying vec4 vCoord;
|
|
428
|
+
varying vec2 vUv;
|
|
429
|
+
varying vec3 vToEye;
|
|
430
|
+
|
|
431
|
+
void main() {
|
|
432
|
+
|
|
433
|
+
vUv = uv;
|
|
434
|
+
vCoord = textureMatrix * vec4( position, 1.0 );
|
|
435
|
+
|
|
436
|
+
vec4 worldPosition = modelMatrix * vec4( position, 1.0 );
|
|
437
|
+
vToEye = cameraPosition - worldPosition.xyz;
|
|
438
|
+
|
|
439
|
+
vec4 mvPosition = viewMatrix * worldPosition; // used in fog_vertex
|
|
440
|
+
gl_Position = projectionMatrix * mvPosition;
|
|
441
|
+
|
|
442
|
+
#include <logdepthbuf_vertex>
|
|
443
|
+
#include <fog_vertex>
|
|
444
|
+
|
|
445
|
+
}`,fragmentShader:`
|
|
446
|
+
|
|
447
|
+
#include <common>
|
|
448
|
+
#include <fog_pars_fragment>
|
|
449
|
+
#include <logdepthbuf_pars_fragment>
|
|
450
|
+
|
|
451
|
+
uniform sampler2D tReflectionMap;
|
|
452
|
+
uniform sampler2D tRefractionMap;
|
|
453
|
+
uniform sampler2D tNormalMap0;
|
|
454
|
+
uniform sampler2D tNormalMap1;
|
|
455
|
+
|
|
456
|
+
#ifdef USE_FLOWMAP
|
|
457
|
+
uniform sampler2D tFlowMap;
|
|
458
|
+
#else
|
|
459
|
+
uniform vec2 flowDirection;
|
|
460
|
+
#endif
|
|
461
|
+
|
|
462
|
+
uniform vec3 color;
|
|
463
|
+
uniform float reflectivity;
|
|
464
|
+
uniform vec4 config;
|
|
465
|
+
|
|
466
|
+
varying vec4 vCoord;
|
|
467
|
+
varying vec2 vUv;
|
|
468
|
+
varying vec3 vToEye;
|
|
469
|
+
|
|
470
|
+
void main() {
|
|
471
|
+
|
|
472
|
+
#include <logdepthbuf_fragment>
|
|
473
|
+
|
|
474
|
+
float flowMapOffset0 = config.x;
|
|
475
|
+
float flowMapOffset1 = config.y;
|
|
476
|
+
float halfCycle = config.z;
|
|
477
|
+
float scale = config.w;
|
|
478
|
+
|
|
479
|
+
vec3 toEye = normalize( vToEye );
|
|
480
|
+
|
|
481
|
+
// determine flow direction
|
|
482
|
+
vec2 flow;
|
|
483
|
+
#ifdef USE_FLOWMAP
|
|
484
|
+
flow = texture2D( tFlowMap, vUv ).rg * 2.0 - 1.0;
|
|
485
|
+
#else
|
|
486
|
+
flow = flowDirection;
|
|
487
|
+
#endif
|
|
488
|
+
flow.x *= - 1.0;
|
|
489
|
+
|
|
490
|
+
// sample normal maps (distort uvs with flowdata)
|
|
491
|
+
vec4 normalColor0 = texture2D( tNormalMap0, ( vUv * scale ) + flow * flowMapOffset0 );
|
|
492
|
+
vec4 normalColor1 = texture2D( tNormalMap1, ( vUv * scale ) + flow * flowMapOffset1 );
|
|
493
|
+
|
|
494
|
+
// linear interpolate to get the final normal color
|
|
495
|
+
float flowLerp = abs( halfCycle - flowMapOffset0 ) / halfCycle;
|
|
496
|
+
vec4 normalColor = mix( normalColor0, normalColor1, flowLerp );
|
|
497
|
+
|
|
498
|
+
// calculate normal vector
|
|
499
|
+
vec3 normal = normalize( vec3( normalColor.r * 2.0 - 1.0, normalColor.b, normalColor.g * 2.0 - 1.0 ) );
|
|
500
|
+
|
|
501
|
+
// calculate the fresnel term to blend reflection and refraction maps
|
|
502
|
+
float theta = max( dot( toEye, normal ), 0.0 );
|
|
503
|
+
float reflectance = reflectivity + ( 1.0 - reflectivity ) * pow( ( 1.0 - theta ), 5.0 );
|
|
504
|
+
|
|
505
|
+
// calculate final uv coords
|
|
506
|
+
vec3 coord = vCoord.xyz / vCoord.w;
|
|
507
|
+
vec2 uv = coord.xy + coord.z * normal.xz * 0.05;
|
|
508
|
+
|
|
509
|
+
vec4 reflectColor = texture2D( tReflectionMap, vec2( 1.0 - uv.x, uv.y ) );
|
|
510
|
+
vec4 refractColor = texture2D( tRefractionMap, uv );
|
|
511
|
+
|
|
512
|
+
// multiply water color with the mix of both textures
|
|
513
|
+
gl_FragColor = vec4( color, 1.0 ) * mix( refractColor, reflectColor, reflectance );
|
|
514
|
+
|
|
515
|
+
#include <tonemapping_fragment>
|
|
516
|
+
#include <${parseInt(c.REVISION.replace(/\D+/g,""))>=154?"colorspace_fragment":"encodings_fragment"}>
|
|
517
|
+
#include <fog_fragment>
|
|
518
|
+
|
|
519
|
+
}`});const Ao={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:["varying vec2 vUv;","void main() {"," vUv = uv;"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join(`
|
|
520
|
+
`),fragmentShader:["uniform float opacity;","uniform sampler2D tDiffuse;","varying vec2 vUv;","#include <packing>","void main() {"," float depth = 1.0 - unpackRGBAToDepth( texture2D( tDiffuse, vUv ) );"," gl_FragColor = vec4( vec3( depth ), opacity );","}"].join(`
|
|
521
|
+
`)};class Q5 extends c.Object3D{constructor(e,n){super(),M(this,"isTransformControls",!0),M(this,"visible",!1),M(this,"domElement"),M(this,"raycaster",new c.Raycaster),M(this,"gizmo"),M(this,"plane"),M(this,"tempVector",new c.Vector3),M(this,"tempVector2",new c.Vector3),M(this,"tempQuaternion",new c.Quaternion),M(this,"unit",{X:new c.Vector3(1,0,0),Y:new c.Vector3(0,1,0),Z:new c.Vector3(0,0,1)}),M(this,"pointStart",new c.Vector3),M(this,"pointEnd",new c.Vector3),M(this,"offset",new c.Vector3),M(this,"rotationAxis",new c.Vector3),M(this,"startNorm",new c.Vector3),M(this,"endNorm",new c.Vector3),M(this,"rotationAngle",0),M(this,"cameraPosition",new c.Vector3),M(this,"cameraQuaternion",new c.Quaternion),M(this,"cameraScale",new c.Vector3),M(this,"parentPosition",new c.Vector3),M(this,"parentQuaternion",new c.Quaternion),M(this,"parentQuaternionInv",new c.Quaternion),M(this,"parentScale",new c.Vector3),M(this,"worldPositionStart",new c.Vector3),M(this,"worldQuaternionStart",new c.Quaternion),M(this,"worldScaleStart",new c.Vector3),M(this,"worldPosition",new c.Vector3),M(this,"worldQuaternion",new c.Quaternion),M(this,"worldQuaternionInv",new c.Quaternion),M(this,"worldScale",new c.Vector3),M(this,"eye",new c.Vector3),M(this,"positionStart",new c.Vector3),M(this,"quaternionStart",new c.Quaternion),M(this,"scaleStart",new c.Vector3),M(this,"camera"),M(this,"object"),M(this,"enabled",!0),M(this,"axis",null),M(this,"mode","translate"),M(this,"translationSnap",null),M(this,"rotationSnap",null),M(this,"scaleSnap",null),M(this,"space","world"),M(this,"size",1),M(this,"dragging",!1),M(this,"showX",!0),M(this,"showY",!0),M(this,"showZ",!0),M(this,"changeEvent",{type:"change"}),M(this,"mouseDownEvent",{type:"mouseDown",mode:this.mode}),M(this,"mouseUpEvent",{type:"mouseUp",mode:this.mode}),M(this,"objectChangeEvent",{type:"objectChange"}),M(this,"intersectObjectWithRay",(i,s,a)=>{const o=s.intersectObject(i,!0);for(let l=0;l<o.length;l++)if(o[l].object.visible||a)return o[l];return!1}),M(this,"attach",i=>(this.object=i,this.visible=!0,this)),M(this,"detach",()=>(this.object=void 0,this.visible=!1,this.axis=null,this)),M(this,"reset",()=>this.enabled?(this.dragging&&this.object!==void 0&&(this.object.position.copy(this.positionStart),this.object.quaternion.copy(this.quaternionStart),this.object.scale.copy(this.scaleStart),this.dispatchEvent(this.changeEvent),this.dispatchEvent(this.objectChangeEvent),this.pointStart.copy(this.pointEnd)),this):this),M(this,"updateMatrixWorld",()=>{this.object!==void 0&&(this.object.updateMatrixWorld(),this.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this.parentPosition,this.parentQuaternion,this.parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this.worldScale),this.parentQuaternionInv.copy(this.parentQuaternion).invert(),this.worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this.cameraScale),this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),super.updateMatrixWorld()}),M(this,"pointerHover",i=>{if(this.object===void 0||this.dragging===!0)return;this.raycaster.setFromCamera(i,this.camera);const s=this.intersectObjectWithRay(this.gizmo.picker[this.mode],this.raycaster);s?this.axis=s.object.name:this.axis=null}),M(this,"pointerDown",i=>{if(!(this.object===void 0||this.dragging===!0||i.button!==0)&&this.axis!==null){this.raycaster.setFromCamera(i,this.camera);const s=this.intersectObjectWithRay(this.plane,this.raycaster,!0);if(s){let a=this.space;if(this.mode==="scale"?a="local":(this.axis==="E"||this.axis==="XYZE"||this.axis==="XYZ")&&(a="world"),a==="local"&&this.mode==="rotate"){const o=this.rotationSnap;this.axis==="X"&&o&&(this.object.rotation.x=Math.round(this.object.rotation.x/o)*o),this.axis==="Y"&&o&&(this.object.rotation.y=Math.round(this.object.rotation.y/o)*o),this.axis==="Z"&&o&&(this.object.rotation.z=Math.round(this.object.rotation.z/o)*o)}this.object.updateMatrixWorld(),this.object.parent&&this.object.parent.updateMatrixWorld(),this.positionStart.copy(this.object.position),this.quaternionStart.copy(this.object.quaternion),this.scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this.worldScaleStart),this.pointStart.copy(s.point).sub(this.worldPositionStart)}this.dragging=!0,this.mouseDownEvent.mode=this.mode,this.dispatchEvent(this.mouseDownEvent)}}),M(this,"pointerMove",i=>{const s=this.axis,a=this.mode,o=this.object;let l=this.space;if(a==="scale"?l="local":(s==="E"||s==="XYZE"||s==="XYZ")&&(l="world"),o===void 0||s===null||this.dragging===!1||i.button!==-1)return;this.raycaster.setFromCamera(i,this.camera);const h=this.intersectObjectWithRay(this.plane,this.raycaster,!0);if(h){if(this.pointEnd.copy(h.point).sub(this.worldPositionStart),a==="translate")this.offset.copy(this.pointEnd).sub(this.pointStart),l==="local"&&s!=="XYZ"&&this.offset.applyQuaternion(this.worldQuaternionInv),s.indexOf("X")===-1&&(this.offset.x=0),s.indexOf("Y")===-1&&(this.offset.y=0),s.indexOf("Z")===-1&&(this.offset.z=0),l==="local"&&s!=="XYZ"?this.offset.applyQuaternion(this.quaternionStart).divide(this.parentScale):this.offset.applyQuaternion(this.parentQuaternionInv).divide(this.parentScale),o.position.copy(this.offset).add(this.positionStart),this.translationSnap&&(l==="local"&&(o.position.applyQuaternion(this.tempQuaternion.copy(this.quaternionStart).invert()),s.search("X")!==-1&&(o.position.x=Math.round(o.position.x/this.translationSnap)*this.translationSnap),s.search("Y")!==-1&&(o.position.y=Math.round(o.position.y/this.translationSnap)*this.translationSnap),s.search("Z")!==-1&&(o.position.z=Math.round(o.position.z/this.translationSnap)*this.translationSnap),o.position.applyQuaternion(this.quaternionStart)),l==="world"&&(o.parent&&o.position.add(this.tempVector.setFromMatrixPosition(o.parent.matrixWorld)),s.search("X")!==-1&&(o.position.x=Math.round(o.position.x/this.translationSnap)*this.translationSnap),s.search("Y")!==-1&&(o.position.y=Math.round(o.position.y/this.translationSnap)*this.translationSnap),s.search("Z")!==-1&&(o.position.z=Math.round(o.position.z/this.translationSnap)*this.translationSnap),o.parent&&o.position.sub(this.tempVector.setFromMatrixPosition(o.parent.matrixWorld))));else if(a==="scale"){if(s.search("XYZ")!==-1){let u=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(u*=-1),this.tempVector2.set(u,u,u)}else this.tempVector.copy(this.pointStart),this.tempVector2.copy(this.pointEnd),this.tempVector.applyQuaternion(this.worldQuaternionInv),this.tempVector2.applyQuaternion(this.worldQuaternionInv),this.tempVector2.divide(this.tempVector),s.search("X")===-1&&(this.tempVector2.x=1),s.search("Y")===-1&&(this.tempVector2.y=1),s.search("Z")===-1&&(this.tempVector2.z=1);o.scale.copy(this.scaleStart).multiply(this.tempVector2),this.scaleSnap&&this.object&&(s.search("X")!==-1&&(this.object.scale.x=Math.round(o.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),s.search("Y")!==-1&&(o.scale.y=Math.round(o.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),s.search("Z")!==-1&&(o.scale.z=Math.round(o.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(a==="rotate"){this.offset.copy(this.pointEnd).sub(this.pointStart);const u=20/this.worldPosition.distanceTo(this.tempVector.setFromMatrixPosition(this.camera.matrixWorld));s==="E"?(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this.startNorm.copy(this.pointStart).normalize(),this.endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this.endNorm.cross(this.startNorm).dot(this.eye)<0?1:-1):s==="XYZE"?(this.rotationAxis.copy(this.offset).cross(this.eye).normalize(),this.rotationAngle=this.offset.dot(this.tempVector.copy(this.rotationAxis).cross(this.eye))*u):(s==="X"||s==="Y"||s==="Z")&&(this.rotationAxis.copy(this.unit[s]),this.tempVector.copy(this.unit[s]),l==="local"&&this.tempVector.applyQuaternion(this.worldQuaternion),this.rotationAngle=this.offset.dot(this.tempVector.cross(this.eye).normalize())*u),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),l==="local"&&s!=="E"&&s!=="XYZE"?(o.quaternion.copy(this.quaternionStart),o.quaternion.multiply(this.tempQuaternion.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this.parentQuaternionInv),o.quaternion.copy(this.tempQuaternion.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),o.quaternion.multiply(this.quaternionStart).normalize())}this.dispatchEvent(this.changeEvent),this.dispatchEvent(this.objectChangeEvent)}}),M(this,"pointerUp",i=>{i.button===0&&(this.dragging&&this.axis!==null&&(this.mouseUpEvent.mode=this.mode,this.dispatchEvent(this.mouseUpEvent)),this.dragging=!1,this.axis=null)}),M(this,"getPointer",i=>{var s,a;if(this.domElement&&((s=this.domElement.ownerDocument)!=null&&s.pointerLockElement))return{x:0,y:0,button:i.button};{const o=i.changedTouches?i.changedTouches[0]:i,l=(a=this.domElement)==null?void 0:a.getBoundingClientRect();return{x:(o.clientX-l.left)/l.width*2-1,y:-(o.clientY-l.top)/l.height*2+1,button:i.button}}}),M(this,"onPointerHover",i=>{if(this.enabled)switch(i.pointerType){case"mouse":case"pen":this.pointerHover(this.getPointer(i));break}}),M(this,"onPointerDown",i=>{!this.enabled||!this.domElement||(this.domElement.style.touchAction="none",this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.pointerHover(this.getPointer(i)),this.pointerDown(this.getPointer(i)))}),M(this,"onPointerMove",i=>{this.enabled&&this.pointerMove(this.getPointer(i))}),M(this,"onPointerUp",i=>{!this.enabled||!this.domElement||(this.domElement.style.touchAction="",this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.pointerUp(this.getPointer(i)))}),M(this,"getMode",()=>this.mode),M(this,"setMode",i=>{this.mode=i}),M(this,"setTranslationSnap",i=>{this.translationSnap=i}),M(this,"setRotationSnap",i=>{this.rotationSnap=i}),M(this,"setScaleSnap",i=>{this.scaleSnap=i}),M(this,"setSize",i=>{this.size=i}),M(this,"setSpace",i=>{this.space=i}),M(this,"update",()=>{console.warn("THREE.TransformControls: update function has no more functionality and therefore has been deprecated.")}),M(this,"connect",i=>{i===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.domElement=i,this.domElement.addEventListener("pointerdown",this.onPointerDown),this.domElement.addEventListener("pointermove",this.onPointerHover),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp)}),M(this,"dispose",()=>{var i,s,a,o,l,h;(i=this.domElement)==null||i.removeEventListener("pointerdown",this.onPointerDown),(s=this.domElement)==null||s.removeEventListener("pointermove",this.onPointerHover),(o=(a=this.domElement)==null?void 0:a.ownerDocument)==null||o.removeEventListener("pointermove",this.onPointerMove),(h=(l=this.domElement)==null?void 0:l.ownerDocument)==null||h.removeEventListener("pointerup",this.onPointerUp),this.traverse(u=>{const A=u;A.geometry&&A.geometry.dispose(),A.material&&A.material.dispose()})}),this.domElement=n,this.camera=e,this.gizmo=new N5,this.add(this.gizmo),this.plane=new G5,this.add(this.plane);const r=(i,s)=>{let a=s;Object.defineProperty(this,i,{get:function(){return a!==void 0?a:s},set:function(o){a!==o&&(a=o,this.plane[i]=o,this.gizmo[i]=o,this.dispatchEvent({type:i+"-changed",value:o}),this.dispatchEvent(this.changeEvent))}}),this[i]=s,this.plane[i]=s,this.gizmo[i]=s};r("camera",this.camera),r("object",this.object),r("enabled",this.enabled),r("axis",this.axis),r("mode",this.mode),r("translationSnap",this.translationSnap),r("rotationSnap",this.rotationSnap),r("scaleSnap",this.scaleSnap),r("space",this.space),r("size",this.size),r("dragging",this.dragging),r("showX",this.showX),r("showY",this.showY),r("showZ",this.showZ),r("worldPosition",this.worldPosition),r("worldPositionStart",this.worldPositionStart),r("worldQuaternion",this.worldQuaternion),r("worldQuaternionStart",this.worldQuaternionStart),r("cameraPosition",this.cameraPosition),r("cameraQuaternion",this.cameraQuaternion),r("pointStart",this.pointStart),r("pointEnd",this.pointEnd),r("rotationAxis",this.rotationAxis),r("rotationAngle",this.rotationAngle),r("eye",this.eye),n!==void 0&&this.connect(n)}}class N5 extends c.Object3D{constructor(){super(),M(this,"isTransformControlsGizmo",!0),M(this,"type","TransformControlsGizmo"),M(this,"tempVector",new c.Vector3(0,0,0)),M(this,"tempEuler",new c.Euler),M(this,"alignVector",new c.Vector3(0,1,0)),M(this,"zeroVector",new c.Vector3(0,0,0)),M(this,"lookAtMatrix",new c.Matrix4),M(this,"tempQuaternion",new c.Quaternion),M(this,"tempQuaternion2",new c.Quaternion),M(this,"identityQuaternion",new c.Quaternion),M(this,"unitX",new c.Vector3(1,0,0)),M(this,"unitY",new c.Vector3(0,1,0)),M(this,"unitZ",new c.Vector3(0,0,1)),M(this,"gizmo"),M(this,"picker"),M(this,"helper"),M(this,"rotationAxis",new c.Vector3),M(this,"cameraPosition",new c.Vector3),M(this,"worldPositionStart",new c.Vector3),M(this,"worldQuaternionStart",new c.Quaternion),M(this,"worldPosition",new c.Vector3),M(this,"worldQuaternion",new c.Quaternion),M(this,"eye",new c.Vector3),M(this,"camera",null),M(this,"enabled",!0),M(this,"axis",null),M(this,"mode","translate"),M(this,"space","world"),M(this,"size",1),M(this,"dragging",!1),M(this,"showX",!0),M(this,"showY",!0),M(this,"showZ",!0),M(this,"updateMatrixWorld",()=>{let Z=this.space;this.mode==="scale"&&(Z="local");const $=Z==="local"?this.worldQuaternion:this.identityQuaternion;this.gizmo.translate.visible=this.mode==="translate",this.gizmo.rotate.visible=this.mode==="rotate",this.gizmo.scale.visible=this.mode==="scale",this.helper.translate.visible=this.mode==="translate",this.helper.rotate.visible=this.mode==="rotate",this.helper.scale.visible=this.mode==="scale";let O=[];O=O.concat(this.picker[this.mode].children),O=O.concat(this.gizmo[this.mode].children),O=O.concat(this.helper[this.mode].children);for(let F=0;F<O.length;F++){const S=O[F];S.visible=!0,S.rotation.set(0,0,0),S.position.copy(this.worldPosition);let Q;if(this.camera.isOrthographicCamera?Q=(this.camera.top-this.camera.bottom)/this.camera.zoom:Q=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),S.scale.set(1,1,1).multiplyScalar(Q*this.size/7),S.tag==="helper"){S.visible=!1,S.name==="AXIS"?(S.position.copy(this.worldPositionStart),S.visible=!!this.axis,this.axis==="X"&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,0,0)),S.quaternion.copy($).multiply(this.tempQuaternion),Math.abs(this.alignVector.copy(this.unitX).applyQuaternion($).dot(this.eye))>.9&&(S.visible=!1)),this.axis==="Y"&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,0,Math.PI/2)),S.quaternion.copy($).multiply(this.tempQuaternion),Math.abs(this.alignVector.copy(this.unitY).applyQuaternion($).dot(this.eye))>.9&&(S.visible=!1)),this.axis==="Z"&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,Math.PI/2,0)),S.quaternion.copy($).multiply(this.tempQuaternion),Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion($).dot(this.eye))>.9&&(S.visible=!1)),this.axis==="XYZE"&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,Math.PI/2,0)),this.alignVector.copy(this.rotationAxis),S.quaternion.setFromRotationMatrix(this.lookAtMatrix.lookAt(this.zeroVector,this.alignVector,this.unitY)),S.quaternion.multiply(this.tempQuaternion),S.visible=this.dragging),this.axis==="E"&&(S.visible=!1)):S.name==="START"?(S.position.copy(this.worldPositionStart),S.visible=this.dragging):S.name==="END"?(S.position.copy(this.worldPosition),S.visible=this.dragging):S.name==="DELTA"?(S.position.copy(this.worldPositionStart),S.quaternion.copy(this.worldQuaternionStart),this.tempVector.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),this.tempVector.applyQuaternion(this.worldQuaternionStart.clone().invert()),S.scale.copy(this.tempVector),S.visible=this.dragging):(S.quaternion.copy($),this.dragging?S.position.copy(this.worldPositionStart):S.position.copy(this.worldPosition),this.axis&&(S.visible=this.axis.search(S.name)!==-1));continue}S.quaternion.copy($),this.mode==="translate"||this.mode==="scale"?((S.name==="X"||S.name==="XYZX")&&Math.abs(this.alignVector.copy(this.unitX).applyQuaternion($).dot(this.eye))>.99&&(S.scale.set(1e-10,1e-10,1e-10),S.visible=!1),(S.name==="Y"||S.name==="XYZY")&&Math.abs(this.alignVector.copy(this.unitY).applyQuaternion($).dot(this.eye))>.99&&(S.scale.set(1e-10,1e-10,1e-10),S.visible=!1),(S.name==="Z"||S.name==="XYZZ")&&Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion($).dot(this.eye))>.99&&(S.scale.set(1e-10,1e-10,1e-10),S.visible=!1),S.name==="XY"&&Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion($).dot(this.eye))<.2&&(S.scale.set(1e-10,1e-10,1e-10),S.visible=!1),S.name==="YZ"&&Math.abs(this.alignVector.copy(this.unitX).applyQuaternion($).dot(this.eye))<.2&&(S.scale.set(1e-10,1e-10,1e-10),S.visible=!1),S.name==="XZ"&&Math.abs(this.alignVector.copy(this.unitY).applyQuaternion($).dot(this.eye))<.2&&(S.scale.set(1e-10,1e-10,1e-10),S.visible=!1),S.name.search("X")!==-1&&(this.alignVector.copy(this.unitX).applyQuaternion($).dot(this.eye)<0?S.tag==="fwd"?S.visible=!1:S.scale.x*=-1:S.tag==="bwd"&&(S.visible=!1)),S.name.search("Y")!==-1&&(this.alignVector.copy(this.unitY).applyQuaternion($).dot(this.eye)<0?S.tag==="fwd"?S.visible=!1:S.scale.y*=-1:S.tag==="bwd"&&(S.visible=!1)),S.name.search("Z")!==-1&&(this.alignVector.copy(this.unitZ).applyQuaternion($).dot(this.eye)<0?S.tag==="fwd"?S.visible=!1:S.scale.z*=-1:S.tag==="bwd"&&(S.visible=!1))):this.mode==="rotate"&&(this.tempQuaternion2.copy($),this.alignVector.copy(this.eye).applyQuaternion(this.tempQuaternion.copy($).invert()),S.name.search("E")!==-1&&S.quaternion.setFromRotationMatrix(this.lookAtMatrix.lookAt(this.eye,this.zeroVector,this.unitY)),S.name==="X"&&(this.tempQuaternion.setFromAxisAngle(this.unitX,Math.atan2(-this.alignVector.y,this.alignVector.z)),this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2,this.tempQuaternion),S.quaternion.copy(this.tempQuaternion)),S.name==="Y"&&(this.tempQuaternion.setFromAxisAngle(this.unitY,Math.atan2(this.alignVector.x,this.alignVector.z)),this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2,this.tempQuaternion),S.quaternion.copy(this.tempQuaternion)),S.name==="Z"&&(this.tempQuaternion.setFromAxisAngle(this.unitZ,Math.atan2(this.alignVector.y,this.alignVector.x)),this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2,this.tempQuaternion),S.quaternion.copy(this.tempQuaternion))),S.visible=S.visible&&(S.name.indexOf("X")===-1||this.showX),S.visible=S.visible&&(S.name.indexOf("Y")===-1||this.showY),S.visible=S.visible&&(S.name.indexOf("Z")===-1||this.showZ),S.visible=S.visible&&(S.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),S.material.tempOpacity=S.material.tempOpacity||S.material.opacity,S.material.tempColor=S.material.tempColor||S.material.color.clone(),S.material.color.copy(S.material.tempColor),S.material.opacity=S.material.tempOpacity,this.enabled?this.axis&&(S.name===this.axis?(S.material.opacity=1,S.material.color.lerp(new c.Color(1,1,1),.5)):this.axis.split("").some(function(z){return S.name===z})?(S.material.opacity=1,S.material.color.lerp(new c.Color(1,1,1),.5)):(S.material.opacity*=.25,S.material.color.lerp(new c.Color(1,1,1),.5))):(S.material.opacity*=.5,S.material.color.lerp(new c.Color(1,1,1),.5))}super.updateMatrixWorld()});const e=new c.MeshBasicMaterial({depthTest:!1,depthWrite:!1,transparent:!0,side:c.DoubleSide,fog:!1,toneMapped:!1}),n=new c.LineBasicMaterial({depthTest:!1,depthWrite:!1,transparent:!0,linewidth:1,fog:!1,toneMapped:!1}),r=e.clone();r.opacity=.15;const i=e.clone();i.opacity=.33;const s=e.clone();s.color.set(16711680);const a=e.clone();a.color.set(65280);const o=e.clone();o.color.set(255);const l=e.clone();l.opacity=.25;const h=l.clone();h.color.set(16776960);const u=l.clone();u.color.set(65535);const A=l.clone();A.color.set(16711935),e.clone().color.set(16776960);const d=n.clone();d.color.set(16711680);const m=n.clone();m.color.set(65280);const y=n.clone();y.color.set(255);const C=n.clone();C.color.set(65535);const x=n.clone();x.color.set(16711935);const I=n.clone();I.color.set(16776960);const g=n.clone();g.color.set(7895160);const v=I.clone();v.opacity=.25;const w=new c.CylinderGeometry(0,.05,.2,12,1,!1),b=new c.BoxGeometry(.125,.125,.125),B=new c.BufferGeometry;B.setAttribute("position",new c.Float32BufferAttribute([0,0,0,1,0,0],3));const _=(Z,$)=>{const O=new c.BufferGeometry,F=[];for(let S=0;S<=64*$;++S)F.push(0,Math.cos(S/32*Math.PI)*Z,Math.sin(S/32*Math.PI)*Z);return O.setAttribute("position",new c.Float32BufferAttribute(F,3)),O},E=()=>{const Z=new c.BufferGeometry;return Z.setAttribute("position",new c.Float32BufferAttribute([0,0,0,1,1,1],3)),Z},T={X:[[new c.Mesh(w,s),[1,0,0],[0,0,-Math.PI/2],null,"fwd"],[new c.Mesh(w,s),[1,0,0],[0,0,Math.PI/2],null,"bwd"],[new c.Line(B,d)]],Y:[[new c.Mesh(w,a),[0,1,0],null,null,"fwd"],[new c.Mesh(w,a),[0,1,0],[Math.PI,0,0],null,"bwd"],[new c.Line(B,m),null,[0,0,Math.PI/2]]],Z:[[new c.Mesh(w,o),[0,0,1],[Math.PI/2,0,0],null,"fwd"],[new c.Mesh(w,o),[0,0,1],[-Math.PI/2,0,0],null,"bwd"],[new c.Line(B,y),null,[0,-Math.PI/2,0]]],XYZ:[[new c.Mesh(new c.OctahedronGeometry(.1,0),l.clone()),[0,0,0],[0,0,0]]],XY:[[new c.Mesh(new c.PlaneGeometry(.295,.295),h.clone()),[.15,.15,0]],[new c.Line(B,I),[.18,.3,0],null,[.125,1,1]],[new c.Line(B,I),[.3,.18,0],[0,0,Math.PI/2],[.125,1,1]]],YZ:[[new c.Mesh(new c.PlaneGeometry(.295,.295),u.clone()),[0,.15,.15],[0,Math.PI/2,0]],[new c.Line(B,C),[0,.18,.3],[0,0,Math.PI/2],[.125,1,1]],[new c.Line(B,C),[0,.3,.18],[0,-Math.PI/2,0],[.125,1,1]]],XZ:[[new c.Mesh(new c.PlaneGeometry(.295,.295),A.clone()),[.15,0,.15],[-Math.PI/2,0,0]],[new c.Line(B,x),[.18,0,.3],null,[.125,1,1]],[new c.Line(B,x),[.3,0,.18],[0,-Math.PI/2,0],[.125,1,1]]]},L={X:[[new c.Mesh(new c.CylinderGeometry(.2,0,1,4,1,!1),r),[.6,0,0],[0,0,-Math.PI/2]]],Y:[[new c.Mesh(new c.CylinderGeometry(.2,0,1,4,1,!1),r),[0,.6,0]]],Z:[[new c.Mesh(new c.CylinderGeometry(.2,0,1,4,1,!1),r),[0,0,.6],[Math.PI/2,0,0]]],XYZ:[[new c.Mesh(new c.OctahedronGeometry(.2,0),r)]],XY:[[new c.Mesh(new c.PlaneGeometry(.4,.4),r),[.2,.2,0]]],YZ:[[new c.Mesh(new c.PlaneGeometry(.4,.4),r),[0,.2,.2],[0,Math.PI/2,0]]],XZ:[[new c.Mesh(new c.PlaneGeometry(.4,.4),r),[.2,0,.2],[-Math.PI/2,0,0]]]},R={START:[[new c.Mesh(new c.OctahedronGeometry(.01,2),i),null,null,null,"helper"]],END:[[new c.Mesh(new c.OctahedronGeometry(.01,2),i),null,null,null,"helper"]],DELTA:[[new c.Line(E(),i),null,null,null,"helper"]],X:[[new c.Line(B,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new c.Line(B,i.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new c.Line(B,i.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},V={X:[[new c.Line(_(1,.5),d)],[new c.Mesh(new c.OctahedronGeometry(.04,0),s),[0,0,.99],null,[1,3,1]]],Y:[[new c.Line(_(1,.5),m),null,[0,0,-Math.PI/2]],[new c.Mesh(new c.OctahedronGeometry(.04,0),a),[0,0,.99],null,[3,1,1]]],Z:[[new c.Line(_(1,.5),y),null,[0,Math.PI/2,0]],[new c.Mesh(new c.OctahedronGeometry(.04,0),o),[.99,0,0],null,[1,3,1]]],E:[[new c.Line(_(1.25,1),v),null,[0,Math.PI/2,0]],[new c.Mesh(new c.CylinderGeometry(.03,0,.15,4,1,!1),v),[1.17,0,0],[0,0,-Math.PI/2],[1,1,.001]],[new c.Mesh(new c.CylinderGeometry(.03,0,.15,4,1,!1),v),[-1.17,0,0],[0,0,Math.PI/2],[1,1,.001]],[new c.Mesh(new c.CylinderGeometry(.03,0,.15,4,1,!1),v),[0,-1.17,0],[Math.PI,0,0],[1,1,.001]],[new c.Mesh(new c.CylinderGeometry(.03,0,.15,4,1,!1),v),[0,1.17,0],[0,0,0],[1,1,.001]]],XYZE:[[new c.Line(_(1,1),g),null,[0,Math.PI/2,0]]]},Y={AXIS:[[new c.Line(B,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},q={X:[[new c.Mesh(new c.TorusGeometry(1,.1,4,24),r),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new c.Mesh(new c.TorusGeometry(1,.1,4,24),r),[0,0,0],[Math.PI/2,0,0]]],Z:[[new c.Mesh(new c.TorusGeometry(1,.1,4,24),r),[0,0,0],[0,0,-Math.PI/2]]],E:[[new c.Mesh(new c.TorusGeometry(1.25,.1,2,24),r)]],XYZE:[[new c.Mesh(new c.SphereGeometry(.7,10,8),r)]]},ne={X:[[new c.Mesh(b,s),[.8,0,0],[0,0,-Math.PI/2]],[new c.Line(B,d),null,null,[.8,1,1]]],Y:[[new c.Mesh(b,a),[0,.8,0]],[new c.Line(B,m),null,[0,0,Math.PI/2],[.8,1,1]]],Z:[[new c.Mesh(b,o),[0,0,.8],[Math.PI/2,0,0]],[new c.Line(B,y),null,[0,-Math.PI/2,0],[.8,1,1]]],XY:[[new c.Mesh(b,h),[.85,.85,0],null,[2,2,.2]],[new c.Line(B,I),[.855,.98,0],null,[.125,1,1]],[new c.Line(B,I),[.98,.855,0],[0,0,Math.PI/2],[.125,1,1]]],YZ:[[new c.Mesh(b,u),[0,.85,.85],null,[.2,2,2]],[new c.Line(B,C),[0,.855,.98],[0,0,Math.PI/2],[.125,1,1]],[new c.Line(B,C),[0,.98,.855],[0,-Math.PI/2,0],[.125,1,1]]],XZ:[[new c.Mesh(b,A),[.85,0,.85],null,[2,.2,2]],[new c.Line(B,x),[.855,0,.98],null,[.125,1,1]],[new c.Line(B,x),[.98,0,.855],[0,-Math.PI/2,0],[.125,1,1]]],XYZX:[[new c.Mesh(new c.BoxGeometry(.125,.125,.125),l.clone()),[1.1,0,0]]],XYZY:[[new c.Mesh(new c.BoxGeometry(.125,.125,.125),l.clone()),[0,1.1,0]]],XYZZ:[[new c.Mesh(new c.BoxGeometry(.125,.125,.125),l.clone()),[0,0,1.1]]]},X={X:[[new c.Mesh(new c.CylinderGeometry(.2,0,.8,4,1,!1),r),[.5,0,0],[0,0,-Math.PI/2]]],Y:[[new c.Mesh(new c.CylinderGeometry(.2,0,.8,4,1,!1),r),[0,.5,0]]],Z:[[new c.Mesh(new c.CylinderGeometry(.2,0,.8,4,1,!1),r),[0,0,.5],[Math.PI/2,0,0]]],XY:[[new c.Mesh(b,r),[.85,.85,0],null,[3,3,.2]]],YZ:[[new c.Mesh(b,r),[0,.85,.85],null,[.2,3,3]]],XZ:[[new c.Mesh(b,r),[.85,0,.85],null,[3,.2,3]]],XYZX:[[new c.Mesh(new c.BoxGeometry(.2,.2,.2),r),[1.1,0,0]]],XYZY:[[new c.Mesh(new c.BoxGeometry(.2,.2,.2),r),[0,1.1,0]]],XYZZ:[[new c.Mesh(new c.BoxGeometry(.2,.2,.2),r),[0,0,1.1]]]},G={X:[[new c.Line(B,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new c.Line(B,i.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new c.Line(B,i.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},H=Z=>{const $=new c.Object3D;for(let O in Z)for(let F=Z[O].length;F--;){const S=Z[O][F][0].clone(),Q=Z[O][F][1],z=Z[O][F][2],P=Z[O][F][3],K=Z[O][F][4];S.name=O,S.tag=K,Q&&S.position.set(Q[0],Q[1],Q[2]),z&&S.rotation.set(z[0],z[1],z[2]),P&&S.scale.set(P[0],P[1],P[2]),S.updateMatrix();const se=S.geometry.clone();se.applyMatrix4(S.matrix),S.geometry=se,S.renderOrder=1/0,S.position.set(0,0,0),S.rotation.set(0,0,0),S.scale.set(1,1,1),$.add(S)}return $};this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=H(T)),this.add(this.gizmo.rotate=H(V)),this.add(this.gizmo.scale=H(ne)),this.add(this.picker.translate=H(L)),this.add(this.picker.rotate=H(q)),this.add(this.picker.scale=H(X)),this.add(this.helper.translate=H(R)),this.add(this.helper.rotate=H(Y)),this.add(this.helper.scale=H(G)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}}class G5 extends c.Mesh{constructor(){super(new c.PlaneGeometry(1e5,1e5,2,2),new c.MeshBasicMaterial({visible:!1,wireframe:!0,side:c.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1})),M(this,"isTransformControlsPlane",!0),M(this,"type","TransformControlsPlane"),M(this,"unitX",new c.Vector3(1,0,0)),M(this,"unitY",new c.Vector3(0,1,0)),M(this,"unitZ",new c.Vector3(0,0,1)),M(this,"tempVector",new c.Vector3),M(this,"dirVector",new c.Vector3),M(this,"alignVector",new c.Vector3),M(this,"tempMatrix",new c.Matrix4),M(this,"identityQuaternion",new c.Quaternion),M(this,"cameraQuaternion",new c.Quaternion),M(this,"worldPosition",new c.Vector3),M(this,"worldQuaternion",new c.Quaternion),M(this,"eye",new c.Vector3),M(this,"axis",null),M(this,"mode","translate"),M(this,"space","world"),M(this,"updateMatrixWorld",()=>{let e=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(e="local"),this.unitX.set(1,0,0).applyQuaternion(e==="local"?this.worldQuaternion:this.identityQuaternion),this.unitY.set(0,1,0).applyQuaternion(e==="local"?this.worldQuaternion:this.identityQuaternion),this.unitZ.set(0,0,1).applyQuaternion(e==="local"?this.worldQuaternion:this.identityQuaternion),this.alignVector.copy(this.unitY),this.mode){case"translate":case"scale":switch(this.axis){case"X":this.alignVector.copy(this.eye).cross(this.unitX),this.dirVector.copy(this.unitX).cross(this.alignVector);break;case"Y":this.alignVector.copy(this.eye).cross(this.unitY),this.dirVector.copy(this.unitY).cross(this.alignVector);break;case"Z":this.alignVector.copy(this.eye).cross(this.unitZ),this.dirVector.copy(this.unitZ).cross(this.alignVector);break;case"XY":this.dirVector.copy(this.unitZ);break;case"YZ":this.dirVector.copy(this.unitX);break;case"XZ":this.alignVector.copy(this.unitZ),this.dirVector.copy(this.unitY);break;case"XYZ":case"E":this.dirVector.set(0,0,0);break}break;case"rotate":default:this.dirVector.set(0,0,0)}this.dirVector.length()===0?this.quaternion.copy(this.cameraQuaternion):(this.tempMatrix.lookAt(this.tempVector.set(0,0,0),this.dirVector,this.alignVector),this.quaternion.setFromRotationMatrix(this.tempMatrix)),super.updateMatrixWorld()})}}const Mr=new c.Euler(0,0,0,"YXZ"),Dr=new c.Vector3,V5={type:"change"},z5={type:"lock"},W5={type:"unlock"},P3=Math.PI/2;class fo extends c.EventDispatcher{constructor(e,n){super(),M(this,"camera"),M(this,"domElement"),M(this,"isLocked"),M(this,"minPolarAngle"),M(this,"maxPolarAngle"),M(this,"pointerSpeed"),M(this,"onMouseMove",r=>{if(!this.domElement||this.isLocked===!1)return;const i=r.movementX||r.mozMovementX||r.webkitMovementX||0,s=r.movementY||r.mozMovementY||r.webkitMovementY||0;Mr.setFromQuaternion(this.camera.quaternion),Mr.y-=i*.002*this.pointerSpeed,Mr.x-=s*.002*this.pointerSpeed,Mr.x=Math.max(P3-this.maxPolarAngle,Math.min(P3-this.minPolarAngle,Mr.x)),this.camera.quaternion.setFromEuler(Mr),this.dispatchEvent(V5)}),M(this,"onPointerlockChange",()=>{this.domElement&&(this.domElement.ownerDocument.pointerLockElement===this.domElement?(this.dispatchEvent(z5),this.isLocked=!0):(this.dispatchEvent(W5),this.isLocked=!1))}),M(this,"onPointerlockError",()=>{console.error("THREE.PointerLockControls: Unable to use Pointer Lock API")}),M(this,"connect",r=>{this.domElement=r||this.domElement,this.domElement&&(this.domElement.ownerDocument.addEventListener("mousemove",this.onMouseMove),this.domElement.ownerDocument.addEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.addEventListener("pointerlockerror",this.onPointerlockError))}),M(this,"disconnect",()=>{this.domElement&&(this.domElement.ownerDocument.removeEventListener("mousemove",this.onMouseMove),this.domElement.ownerDocument.removeEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.removeEventListener("pointerlockerror",this.onPointerlockError))}),M(this,"dispose",()=>{this.disconnect()}),M(this,"getObject",()=>this.camera),M(this,"direction",new c.Vector3(0,0,-1)),M(this,"getDirection",r=>r.copy(this.direction).applyQuaternion(this.camera.quaternion)),M(this,"moveForward",r=>{Dr.setFromMatrixColumn(this.camera.matrix,0),Dr.crossVectors(this.camera.up,Dr),this.camera.position.addScaledVector(Dr,r)}),M(this,"moveRight",r=>{Dr.setFromMatrixColumn(this.camera.matrix,0),this.camera.position.addScaledVector(Dr,r)}),M(this,"lock",()=>{this.domElement&&this.domElement.requestPointerLock()}),M(this,"unlock",()=>{this.domElement&&this.domElement.ownerDocument.exitPointerLock()}),this.camera=e,this.domElement=n,this.isLocked=!1,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.pointerSpeed=1,n&&this.connect(n)}}const hs=new c.Ray,F3=new c.Plane,Y5=Math.cos(70*c.MathUtils.DEG2RAD),k3=(t,e)=>(t%e+e)%e;class O3 extends c.EventDispatcher{constructor(e,n){super(),M(this,"object"),M(this,"domElement"),M(this,"enabled",!0),M(this,"target",new c.Vector3),M(this,"minDistance",0),M(this,"maxDistance",1/0),M(this,"minZoom",0),M(this,"maxZoom",1/0),M(this,"minPolarAngle",0),M(this,"maxPolarAngle",Math.PI),M(this,"minAzimuthAngle",-1/0),M(this,"maxAzimuthAngle",1/0),M(this,"enableDamping",!1),M(this,"dampingFactor",.05),M(this,"enableZoom",!0),M(this,"zoomSpeed",1),M(this,"enableRotate",!0),M(this,"rotateSpeed",1),M(this,"enablePan",!0),M(this,"panSpeed",1),M(this,"screenSpacePanning",!0),M(this,"keyPanSpeed",7),M(this,"zoomToCursor",!1),M(this,"autoRotate",!1),M(this,"autoRotateSpeed",2),M(this,"reverseOrbit",!1),M(this,"reverseHorizontalOrbit",!1),M(this,"reverseVerticalOrbit",!1),M(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),M(this,"mouseButtons",{LEFT:c.MOUSE.ROTATE,MIDDLE:c.MOUSE.DOLLY,RIGHT:c.MOUSE.PAN}),M(this,"touches",{ONE:c.TOUCH.ROTATE,TWO:c.TOUCH.DOLLY_PAN}),M(this,"target0"),M(this,"position0"),M(this,"zoom0"),M(this,"_domElementKeyEvents",null),M(this,"getPolarAngle"),M(this,"getAzimuthalAngle"),M(this,"setPolarAngle"),M(this,"setAzimuthalAngle"),M(this,"getDistance"),M(this,"listenToKeyEvents"),M(this,"stopListenToKeyEvents"),M(this,"saveState"),M(this,"reset"),M(this,"update"),M(this,"connect"),M(this,"dispose"),this.object=e,this.domElement=n,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>u.phi,this.getAzimuthalAngle=()=>u.theta,this.setPolarAngle=N=>{let re=k3(N,2*Math.PI),de=u.phi;de<0&&(de+=2*Math.PI),re<0&&(re+=2*Math.PI);let be=Math.abs(re-de);2*Math.PI-be<be&&(re<de?re+=2*Math.PI:de+=2*Math.PI),A.phi=re-de,r.update()},this.setAzimuthalAngle=N=>{let re=k3(N,2*Math.PI),de=u.theta;de<0&&(de+=2*Math.PI),re<0&&(re+=2*Math.PI);let be=Math.abs(re-de);2*Math.PI-be<be&&(re<de?re+=2*Math.PI:de+=2*Math.PI),A.theta=re-de,r.update()},this.getDistance=()=>r.object.position.distanceTo(r.target),this.listenToKeyEvents=N=>{N.addEventListener("keydown",dn),this._domElementKeyEvents=N},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",dn),this._domElementKeyEvents=null},this.saveState=()=>{r.target0.copy(r.target),r.position0.copy(r.object.position),r.zoom0=r.object.zoom},this.reset=()=>{r.target.copy(r.target0),r.object.position.copy(r.position0),r.object.zoom=r.zoom0,r.object.updateProjectionMatrix(),r.dispatchEvent(i),r.update(),l=o.NONE},this.update=(()=>{const N=new c.Vector3,re=new c.Vector3(0,1,0),de=new c.Quaternion().setFromUnitVectors(e.up,re),be=de.clone().invert(),Qe=new c.Vector3,ut=new c.Quaternion,mt=2*Math.PI;return function(){const u2=r.object.position;de.setFromUnitVectors(e.up,re),be.copy(de).invert(),N.copy(u2).sub(r.target),N.applyQuaternion(de),u.setFromVector3(N),r.autoRotate&&l===o.NONE&&Y(R()),r.enableDamping?(u.theta+=A.theta*r.dampingFactor,u.phi+=A.phi*r.dampingFactor):(u.theta+=A.theta,u.phi+=A.phi);let En=r.minAzimuthAngle,Tn=r.maxAzimuthAngle;isFinite(En)&&isFinite(Tn)&&(En<-Math.PI?En+=mt:En>Math.PI&&(En-=mt),Tn<-Math.PI?Tn+=mt:Tn>Math.PI&&(Tn-=mt),En<=Tn?u.theta=Math.max(En,Math.min(Tn,u.theta)):u.theta=u.theta>(En+Tn)/2?Math.max(En,u.theta):Math.min(Tn,u.theta)),u.phi=Math.max(r.minPolarAngle,Math.min(r.maxPolarAngle,u.phi)),u.makeSafe(),r.enableDamping===!0?r.target.addScaledVector(d,r.dampingFactor):r.target.add(d),r.zoomToCursor&&E||r.object.isOrthographicCamera?u.radius=O(u.radius):u.radius=O(u.radius*f),N.setFromSpherical(u),N.applyQuaternion(be),u2.copy(r.target).add(N),r.object.lookAt(r.target),r.enableDamping===!0?(A.theta*=1-r.dampingFactor,A.phi*=1-r.dampingFactor,d.multiplyScalar(1-r.dampingFactor)):(A.set(0,0,0),d.set(0,0,0));let ba=!1;if(r.zoomToCursor&&E){let ji=null;if(r.object instanceof c.PerspectiveCamera&&r.object.isPerspectiveCamera){const qi=N.length();ji=O(qi*f);const _a=qi-ji;r.object.position.addScaledVector(B,_a),r.object.updateMatrixWorld()}else if(r.object.isOrthographicCamera){const qi=new c.Vector3(_.x,_.y,0);qi.unproject(r.object),r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/f)),r.object.updateProjectionMatrix(),ba=!0;const _a=new c.Vector3(_.x,_.y,0);_a.unproject(r.object),r.object.position.sub(_a).add(qi),r.object.updateMatrixWorld(),ji=N.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),r.zoomToCursor=!1;ji!==null&&(r.screenSpacePanning?r.target.set(0,0,-1).transformDirection(r.object.matrix).multiplyScalar(ji).add(r.object.position):(hs.origin.copy(r.object.position),hs.direction.set(0,0,-1).transformDirection(r.object.matrix),Math.abs(r.object.up.dot(hs.direction))<Y5?e.lookAt(r.target):(F3.setFromNormalAndCoplanarPoint(r.object.up,r.target),hs.intersectPlane(F3,r.target))))}else r.object instanceof c.OrthographicCamera&&r.object.isOrthographicCamera&&(r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/f)),r.object.updateProjectionMatrix(),ba=!0);return f=1,E=!1,ba||Qe.distanceToSquared(r.object.position)>h||8*(1-ut.dot(r.object.quaternion))>h?(r.dispatchEvent(i),Qe.copy(r.object.position),ut.copy(r.object.quaternion),ba=!1,!0):!1}})(),this.connect=N=>{N===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),r.domElement=N,r.domElement.style.touchAction="none",r.domElement.addEventListener("contextmenu",$n),r.domElement.addEventListener("pointerdown",Ue),r.domElement.addEventListener("pointercancel",fn),r.domElement.addEventListener("wheel",Hn)},this.dispose=()=>{var N,re,de,be,Qe,ut;(N=r.domElement)==null||N.removeEventListener("contextmenu",$n),(re=r.domElement)==null||re.removeEventListener("pointerdown",Ue),(de=r.domElement)==null||de.removeEventListener("pointercancel",fn),(be=r.domElement)==null||be.removeEventListener("wheel",Hn),(Qe=r.domElement)==null||Qe.ownerDocument.removeEventListener("pointermove",qe),(ut=r.domElement)==null||ut.ownerDocument.removeEventListener("pointerup",ht),r._domElementKeyEvents!==null&&r._domElementKeyEvents.removeEventListener("keydown",dn)};const r=this,i={type:"change"},s={type:"start"},a={type:"end"},o={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let l=o.NONE;const h=1e-6,u=new c.Spherical,A=new c.Spherical;let f=1;const d=new c.Vector3,m=new c.Vector2,y=new c.Vector2,C=new c.Vector2,x=new c.Vector2,I=new c.Vector2,g=new c.Vector2,v=new c.Vector2,w=new c.Vector2,b=new c.Vector2,B=new c.Vector3,_=new c.Vector2;let E=!1;const T=[],L={};function R(){return 2*Math.PI/60/60*r.autoRotateSpeed}function V(){return Math.pow(.95,r.zoomSpeed)}function Y(N){r.reverseOrbit||r.reverseHorizontalOrbit?A.theta+=N:A.theta-=N}function q(N){r.reverseOrbit||r.reverseVerticalOrbit?A.phi+=N:A.phi-=N}const ne=(()=>{const N=new c.Vector3;return function(de,be){N.setFromMatrixColumn(be,0),N.multiplyScalar(-de),d.add(N)}})(),X=(()=>{const N=new c.Vector3;return function(de,be){r.screenSpacePanning===!0?N.setFromMatrixColumn(be,1):(N.setFromMatrixColumn(be,0),N.crossVectors(r.object.up,N)),N.multiplyScalar(de),d.add(N)}})(),G=(()=>{const N=new c.Vector3;return function(de,be){const Qe=r.domElement;if(Qe&&r.object instanceof c.PerspectiveCamera&&r.object.isPerspectiveCamera){const ut=r.object.position;N.copy(ut).sub(r.target);let mt=N.length();mt*=Math.tan(r.object.fov/2*Math.PI/180),ne(2*de*mt/Qe.clientHeight,r.object.matrix),X(2*be*mt/Qe.clientHeight,r.object.matrix)}else Qe&&r.object instanceof c.OrthographicCamera&&r.object.isOrthographicCamera?(ne(de*(r.object.right-r.object.left)/r.object.zoom/Qe.clientWidth,r.object.matrix),X(be*(r.object.top-r.object.bottom)/r.object.zoom/Qe.clientHeight,r.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),r.enablePan=!1)}})();function H(N){r.object instanceof c.PerspectiveCamera&&r.object.isPerspectiveCamera||r.object instanceof c.OrthographicCamera&&r.object.isOrthographicCamera?f/=N:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function Z(N){r.object instanceof c.PerspectiveCamera&&r.object.isPerspectiveCamera||r.object instanceof c.OrthographicCamera&&r.object.isOrthographicCamera?f*=N:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function $(N){if(!r.zoomToCursor||!r.domElement)return;E=!0;const re=r.domElement.getBoundingClientRect(),de=N.clientX-re.left,be=N.clientY-re.top,Qe=re.width,ut=re.height;_.x=de/Qe*2-1,_.y=-(be/ut)*2+1,B.set(_.x,_.y,1).unproject(r.object).sub(r.object.position).normalize()}function O(N){return Math.max(r.minDistance,Math.min(r.maxDistance,N))}function F(N){m.set(N.clientX,N.clientY)}function S(N){$(N),v.set(N.clientX,N.clientY)}function Q(N){x.set(N.clientX,N.clientY)}function z(N){y.set(N.clientX,N.clientY),C.subVectors(y,m).multiplyScalar(r.rotateSpeed);const re=r.domElement;re&&(Y(2*Math.PI*C.x/re.clientHeight),q(2*Math.PI*C.y/re.clientHeight)),m.copy(y),r.update()}function P(N){w.set(N.clientX,N.clientY),b.subVectors(w,v),b.y>0?H(V()):b.y<0&&Z(V()),v.copy(w),r.update()}function K(N){I.set(N.clientX,N.clientY),g.subVectors(I,x).multiplyScalar(r.panSpeed),G(g.x,g.y),x.copy(I),r.update()}function se(N){$(N),N.deltaY<0?Z(V()):N.deltaY>0&&H(V()),r.update()}function J(N){let re=!1;switch(N.code){case r.keys.UP:G(0,r.keyPanSpeed),re=!0;break;case r.keys.BOTTOM:G(0,-r.keyPanSpeed),re=!0;break;case r.keys.LEFT:G(r.keyPanSpeed,0),re=!0;break;case r.keys.RIGHT:G(-r.keyPanSpeed,0),re=!0;break}re&&(N.preventDefault(),r.update())}function ie(){if(T.length==1)m.set(T[0].pageX,T[0].pageY);else{const N=.5*(T[0].pageX+T[1].pageX),re=.5*(T[0].pageY+T[1].pageY);m.set(N,re)}}function ee(){if(T.length==1)x.set(T[0].pageX,T[0].pageY);else{const N=.5*(T[0].pageX+T[1].pageX),re=.5*(T[0].pageY+T[1].pageY);x.set(N,re)}}function fe(){const N=T[0].pageX-T[1].pageX,re=T[0].pageY-T[1].pageY,de=Math.sqrt(N*N+re*re);v.set(0,de)}function te(){r.enableZoom&&fe(),r.enablePan&&ee()}function oe(){r.enableZoom&&fe(),r.enableRotate&&ie()}function U(N){if(T.length==1)y.set(N.pageX,N.pageY);else{const de=Yi(N),be=.5*(N.pageX+de.x),Qe=.5*(N.pageY+de.y);y.set(be,Qe)}C.subVectors(y,m).multiplyScalar(r.rotateSpeed);const re=r.domElement;re&&(Y(2*Math.PI*C.x/re.clientHeight),q(2*Math.PI*C.y/re.clientHeight)),m.copy(y)}function D(N){if(T.length==1)I.set(N.pageX,N.pageY);else{const re=Yi(N),de=.5*(N.pageX+re.x),be=.5*(N.pageY+re.y);I.set(de,be)}g.subVectors(I,x).multiplyScalar(r.panSpeed),G(g.x,g.y),x.copy(I)}function le(N){const re=Yi(N),de=N.pageX-re.x,be=N.pageY-re.y,Qe=Math.sqrt(de*de+be*be);w.set(0,Qe),b.set(0,Math.pow(w.y/v.y,r.zoomSpeed)),H(b.y),v.copy(w)}function Se(N){r.enableZoom&&le(N),r.enablePan&&D(N)}function De(N){r.enableZoom&&le(N),r.enableRotate&&U(N)}function Ue(N){var re,de;r.enabled!==!1&&(T.length===0&&((re=r.domElement)==null||re.ownerDocument.addEventListener("pointermove",qe),(de=r.domElement)==null||de.ownerDocument.addEventListener("pointerup",ht)),Br(N),N.pointerType==="touch"?xr(N):_n(N))}function qe(N){r.enabled!==!1&&(N.pointerType==="touch"?Sr(N):st(N))}function ht(N){var re,de,be;Ba(N),T.length===0&&((re=r.domElement)==null||re.releasePointerCapture(N.pointerId),(de=r.domElement)==null||de.ownerDocument.removeEventListener("pointermove",qe),(be=r.domElement)==null||be.ownerDocument.removeEventListener("pointerup",ht)),r.dispatchEvent(a),l=o.NONE}function fn(N){Ba(N)}function _n(N){let re;switch(N.button){case 0:re=r.mouseButtons.LEFT;break;case 1:re=r.mouseButtons.MIDDLE;break;case 2:re=r.mouseButtons.RIGHT;break;default:re=-1}switch(re){case c.MOUSE.DOLLY:if(r.enableZoom===!1)return;S(N),l=o.DOLLY;break;case c.MOUSE.ROTATE:if(N.ctrlKey||N.metaKey||N.shiftKey){if(r.enablePan===!1)return;Q(N),l=o.PAN}else{if(r.enableRotate===!1)return;F(N),l=o.ROTATE}break;case c.MOUSE.PAN:if(N.ctrlKey||N.metaKey||N.shiftKey){if(r.enableRotate===!1)return;F(N),l=o.ROTATE}else{if(r.enablePan===!1)return;Q(N),l=o.PAN}break;default:l=o.NONE}l!==o.NONE&&r.dispatchEvent(s)}function st(N){if(r.enabled!==!1)switch(l){case o.ROTATE:if(r.enableRotate===!1)return;z(N);break;case o.DOLLY:if(r.enableZoom===!1)return;P(N);break;case o.PAN:if(r.enablePan===!1)return;K(N);break}}function Hn(N){r.enabled===!1||r.enableZoom===!1||l!==o.NONE&&l!==o.ROTATE||(N.preventDefault(),r.dispatchEvent(s),se(N),r.dispatchEvent(a))}function dn(N){r.enabled===!1||r.enablePan===!1||J(N)}function xr(N){switch(wa(N),T.length){case 1:switch(r.touches.ONE){case c.TOUCH.ROTATE:if(r.enableRotate===!1)return;ie(),l=o.TOUCH_ROTATE;break;case c.TOUCH.PAN:if(r.enablePan===!1)return;ee(),l=o.TOUCH_PAN;break;default:l=o.NONE}break;case 2:switch(r.touches.TWO){case c.TOUCH.DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;te(),l=o.TOUCH_DOLLY_PAN;break;case c.TOUCH.DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;oe(),l=o.TOUCH_DOLLY_ROTATE;break;default:l=o.NONE}break;default:l=o.NONE}l!==o.NONE&&r.dispatchEvent(s)}function Sr(N){switch(wa(N),l){case o.TOUCH_ROTATE:if(r.enableRotate===!1)return;U(N),r.update();break;case o.TOUCH_PAN:if(r.enablePan===!1)return;D(N),r.update();break;case o.TOUCH_DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;Se(N),r.update();break;case o.TOUCH_DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;De(N),r.update();break;default:l=o.NONE}}function $n(N){r.enabled!==!1&&N.preventDefault()}function Br(N){T.push(N)}function Ba(N){delete L[N.pointerId];for(let re=0;re<T.length;re++)if(T[re].pointerId==N.pointerId){T.splice(re,1);return}}function wa(N){let re=L[N.pointerId];re===void 0&&(re=new c.Vector2,L[N.pointerId]=re),re.set(N.pageX,N.pageY)}function Yi(N){const re=N.pointerId===T[0].pointerId?T[1]:T[0];return L[re.pointerId]}n!==void 0&&this.connect(n),this.update()}}class j5 extends O3{constructor(e,n){super(e,n),this.screenSpacePanning=!1,this.mouseButtons.LEFT=c.MOUSE.PAN,this.mouseButtons.RIGHT=c.MOUSE.ROTATE,this.touches.ONE=c.TOUCH.PAN,this.touches.TWO=c.TOUCH.DOLLY_ROTATE}}class us{constructor(){M(this,"enabled",!0),M(this,"needsSwap",!0),M(this,"clear",!1),M(this,"renderToScreen",!1)}setSize(e,n){}render(e,n,r,i,s){console.error("THREE.Pass: .render() must be implemented in derived pass.")}}class As{constructor(e){M(this,"camera",new c.OrthographicCamera(-1,1,1,-1,0,1)),M(this,"geometry",new c.PlaneGeometry(2,2)),M(this,"mesh"),this.mesh=new c.Mesh(this.geometry,e)}get material(){return this.mesh.material}set material(e){this.mesh.material=e}dispose(){this.mesh.geometry.dispose()}render(e){e.render(this.mesh,this.camera)}}const Jt={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:["varying vec2 vUv;","void main() {"," vUv = uv;"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join(`
|
|
522
|
+
`),fragmentShader:["uniform float opacity;","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {"," vec4 texel = texture2D( tDiffuse, vUv );"," gl_FragColor = opacity * texel;","}"].join(`
|
|
523
|
+
`)},oi={defines:{PERSPECTIVE_CAMERA:1,KERNEL_SIZE:32},uniforms:{tDiffuse:{value:null},tNormal:{value:null},tDepth:{value:null},tNoise:{value:null},kernel:{value:null},cameraNear:{value:null},cameraFar:{value:null},resolution:{value:new c.Vector2},cameraProjectionMatrix:{value:new c.Matrix4},cameraInverseProjectionMatrix:{value:new c.Matrix4},kernelRadius:{value:8},minDistance:{value:.005},maxDistance:{value:.05}},vertexShader:["varying vec2 vUv;","void main() {"," vUv = uv;"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join(`
|
|
524
|
+
`),fragmentShader:["uniform sampler2D tDiffuse;","uniform sampler2D tNormal;","uniform sampler2D tDepth;","uniform sampler2D tNoise;","uniform vec3 kernel[ KERNEL_SIZE ];","uniform vec2 resolution;","uniform float cameraNear;","uniform float cameraFar;","uniform mat4 cameraProjectionMatrix;","uniform mat4 cameraInverseProjectionMatrix;","uniform float kernelRadius;","uniform float minDistance;","uniform float maxDistance;","varying vec2 vUv;","#include <packing>","float getDepth( const in vec2 screenPosition ) {"," return texture2D( tDepth, screenPosition ).x;","}","float getLinearDepth( const in vec2 screenPosition ) {"," #if PERSPECTIVE_CAMERA == 1"," float fragCoordZ = texture2D( tDepth, screenPosition ).x;"," float viewZ = perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar );"," return viewZToOrthographicDepth( viewZ, cameraNear, cameraFar );"," #else"," return texture2D( tDepth, screenPosition ).x;"," #endif","}","float getViewZ( const in float depth ) {"," #if PERSPECTIVE_CAMERA == 1"," return perspectiveDepthToViewZ( depth, cameraNear, cameraFar );"," #else"," return orthographicDepthToViewZ( depth, cameraNear, cameraFar );"," #endif","}","vec3 getViewPosition( const in vec2 screenPosition, const in float depth, const in float viewZ ) {"," float clipW = cameraProjectionMatrix[2][3] * viewZ + cameraProjectionMatrix[3][3];"," vec4 clipPosition = vec4( ( vec3( screenPosition, depth ) - 0.5 ) * 2.0, 1.0 );"," clipPosition *= clipW; // unprojection."," return ( cameraInverseProjectionMatrix * clipPosition ).xyz;","}","vec3 getViewNormal( const in vec2 screenPosition ) {"," return unpackRGBToNormal( texture2D( tNormal, screenPosition ).xyz );","}","void main() {"," float depth = getDepth( vUv );"," float viewZ = getViewZ( depth );"," vec3 viewPosition = getViewPosition( vUv, depth, viewZ );"," vec3 viewNormal = getViewNormal( vUv );"," vec2 noiseScale = vec2( resolution.x / 4.0, resolution.y / 4.0 );"," vec3 random = texture2D( tNoise, vUv * noiseScale ).xyz;"," vec3 tangent = normalize( random - viewNormal * dot( random, viewNormal ) );"," vec3 bitangent = cross( viewNormal, tangent );"," mat3 kernelMatrix = mat3( tangent, bitangent, viewNormal );"," float occlusion = 0.0;"," for ( int i = 0; i < KERNEL_SIZE; i ++ ) {"," vec3 sampleVector = kernelMatrix * kernel[ i ];"," vec3 samplePoint = viewPosition + ( sampleVector * kernelRadius );"," vec4 samplePointNDC = cameraProjectionMatrix * vec4( samplePoint, 1.0 );"," samplePointNDC /= samplePointNDC.w;"," vec2 samplePointUv = samplePointNDC.xy * 0.5 + 0.5;"," float realDepth = getLinearDepth( samplePointUv );"," float sampleDepth = viewZToOrthographicDepth( samplePoint.z, cameraNear, cameraFar );"," float delta = sampleDepth - realDepth;"," if ( delta > minDistance && delta < maxDistance ) {"," occlusion += 1.0;"," }"," }"," occlusion = clamp( occlusion / float( KERNEL_SIZE ), 0.0, 1.0 );"," gl_FragColor = vec4( vec3( 1.0 - occlusion ), 1.0 );","}"].join(`
|
|
525
|
+
`)},fs={defines:{PERSPECTIVE_CAMERA:1},uniforms:{tDepth:{value:null},cameraNear:{value:null},cameraFar:{value:null}},vertexShader:["varying vec2 vUv;","void main() {"," vUv = uv;"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join(`
|
|
526
|
+
`),fragmentShader:["uniform sampler2D tDepth;","uniform float cameraNear;","uniform float cameraFar;","varying vec2 vUv;","#include <packing>","float getLinearDepth( const in vec2 screenPosition ) {"," #if PERSPECTIVE_CAMERA == 1"," float fragCoordZ = texture2D( tDepth, screenPosition ).x;"," float viewZ = perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar );"," return viewZToOrthographicDepth( viewZ, cameraNear, cameraFar );"," #else"," return texture2D( tDepth, screenPosition ).x;"," #endif","}","void main() {"," float depth = getLinearDepth( vUv );"," gl_FragColor = vec4( vec3( 1.0 - depth ), 1.0 );","}"].join(`
|
|
527
|
+
`)},ds={uniforms:{tDiffuse:{value:null},resolution:{value:new c.Vector2}},vertexShader:["varying vec2 vUv;","void main() {"," vUv = uv;"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join(`
|
|
528
|
+
`),fragmentShader:["uniform sampler2D tDiffuse;","uniform vec2 resolution;","varying vec2 vUv;","void main() {"," vec2 texelSize = ( 1.0 / resolution );"," float result = 0.0;"," for ( int i = - 2; i <= 2; i ++ ) {"," for ( int j = - 2; j <= 2; j ++ ) {"," vec2 offset = ( vec2( float( i ), float( j ) ) ) * texelSize;"," result += texture2D( tDiffuse, vUv + offset ).r;"," }"," }"," gl_FragColor = vec4( vec3( result / ( 5.0 * 5.0 ) ), 1.0 );","}"].join(`
|
|
529
|
+
`)},ir=class extends us{constructor(t,e,n,r){super(),this.width=n!==void 0?n:512,this.height=r!==void 0?r:512,this.clear=!0,this.camera=e,this.scene=t,this.kernelRadius=8,this.kernelSize=32,this.kernel=[],this.noiseTexture=null,this.output=0,this.minDistance=.005,this.maxDistance=.1,this._visibilityCache=new Map,this.generateSampleKernel(),this.generateRandomKernelRotations();const i=new c.DepthTexture;i.format=c.DepthStencilFormat,i.type=c.UnsignedInt248Type,this.beautyRenderTarget=new c.WebGLRenderTarget(this.width,this.height),this.normalRenderTarget=new c.WebGLRenderTarget(this.width,this.height,{minFilter:c.NearestFilter,magFilter:c.NearestFilter,depthTexture:i}),this.ssaoRenderTarget=new c.WebGLRenderTarget(this.width,this.height),this.blurRenderTarget=this.ssaoRenderTarget.clone(),oi===void 0&&console.error("THREE.SSAOPass: The pass relies on SSAOShader."),this.ssaoMaterial=new c.ShaderMaterial({defines:Object.assign({},oi.defines),uniforms:c.UniformsUtils.clone(oi.uniforms),vertexShader:oi.vertexShader,fragmentShader:oi.fragmentShader,blending:c.NoBlending}),this.ssaoMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.ssaoMaterial.uniforms.tNormal.value=this.normalRenderTarget.texture,this.ssaoMaterial.uniforms.tDepth.value=this.normalRenderTarget.depthTexture,this.ssaoMaterial.uniforms.tNoise.value=this.noiseTexture,this.ssaoMaterial.uniforms.kernel.value=this.kernel,this.ssaoMaterial.uniforms.cameraNear.value=this.camera.near,this.ssaoMaterial.uniforms.cameraFar.value=this.camera.far,this.ssaoMaterial.uniforms.resolution.value.set(this.width,this.height),this.ssaoMaterial.uniforms.cameraProjectionMatrix.value.copy(this.camera.projectionMatrix),this.ssaoMaterial.uniforms.cameraInverseProjectionMatrix.value.copy(this.camera.projectionMatrixInverse),this.normalMaterial=new c.MeshNormalMaterial,this.normalMaterial.blending=c.NoBlending,this.blurMaterial=new c.ShaderMaterial({defines:Object.assign({},ds.defines),uniforms:c.UniformsUtils.clone(ds.uniforms),vertexShader:ds.vertexShader,fragmentShader:ds.fragmentShader}),this.blurMaterial.uniforms.tDiffuse.value=this.ssaoRenderTarget.texture,this.blurMaterial.uniforms.resolution.value.set(this.width,this.height),this.depthRenderMaterial=new c.ShaderMaterial({defines:Object.assign({},fs.defines),uniforms:c.UniformsUtils.clone(fs.uniforms),vertexShader:fs.vertexShader,fragmentShader:fs.fragmentShader,blending:c.NoBlending}),this.depthRenderMaterial.uniforms.tDepth.value=this.normalRenderTarget.depthTexture,this.depthRenderMaterial.uniforms.cameraNear.value=this.camera.near,this.depthRenderMaterial.uniforms.cameraFar.value=this.camera.far,this.copyMaterial=new c.ShaderMaterial({uniforms:c.UniformsUtils.clone(Jt.uniforms),vertexShader:Jt.vertexShader,fragmentShader:Jt.fragmentShader,transparent:!0,depthTest:!1,depthWrite:!1,blendSrc:c.DstColorFactor,blendDst:c.ZeroFactor,blendEquation:c.AddEquation,blendSrcAlpha:c.DstAlphaFactor,blendDstAlpha:c.ZeroFactor,blendEquationAlpha:c.AddEquation}),this.fsQuad=new As(null),this.originalClearColor=new c.Color}dispose(){this.beautyRenderTarget.dispose(),this.normalRenderTarget.dispose(),this.ssaoRenderTarget.dispose(),this.blurRenderTarget.dispose(),this.normalMaterial.dispose(),this.blurMaterial.dispose(),this.copyMaterial.dispose(),this.depthRenderMaterial.dispose(),this.fsQuad.dispose()}render(t,e){switch(t.capabilities.isWebGL2===!1&&(this.noiseTexture.format=c.LuminanceFormat),t.setRenderTarget(this.beautyRenderTarget),t.clear(),t.render(this.scene,this.camera),this.overrideVisibility(),this.renderOverride(t,this.normalMaterial,this.normalRenderTarget,7829503,1),this.restoreVisibility(),this.ssaoMaterial.uniforms.kernelRadius.value=this.kernelRadius,this.ssaoMaterial.uniforms.minDistance.value=this.minDistance,this.ssaoMaterial.uniforms.maxDistance.value=this.maxDistance,this.renderPass(t,this.ssaoMaterial,this.ssaoRenderTarget),this.renderPass(t,this.blurMaterial,this.blurRenderTarget),this.output){case ir.OUTPUT.SSAO:this.copyMaterial.uniforms.tDiffuse.value=this.ssaoRenderTarget.texture,this.copyMaterial.blending=c.NoBlending,this.renderPass(t,this.copyMaterial,this.renderToScreen?null:e);break;case ir.OUTPUT.Blur:this.copyMaterial.uniforms.tDiffuse.value=this.blurRenderTarget.texture,this.copyMaterial.blending=c.NoBlending,this.renderPass(t,this.copyMaterial,this.renderToScreen?null:e);break;case ir.OUTPUT.Beauty:this.copyMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.copyMaterial.blending=c.NoBlending,this.renderPass(t,this.copyMaterial,this.renderToScreen?null:e);break;case ir.OUTPUT.Depth:this.renderPass(t,this.depthRenderMaterial,this.renderToScreen?null:e);break;case ir.OUTPUT.Normal:this.copyMaterial.uniforms.tDiffuse.value=this.normalRenderTarget.texture,this.copyMaterial.blending=c.NoBlending,this.renderPass(t,this.copyMaterial,this.renderToScreen?null:e);break;case ir.OUTPUT.Default:this.copyMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.copyMaterial.blending=c.NoBlending,this.renderPass(t,this.copyMaterial,this.renderToScreen?null:e),this.copyMaterial.uniforms.tDiffuse.value=this.blurRenderTarget.texture,this.copyMaterial.blending=c.CustomBlending,this.renderPass(t,this.copyMaterial,this.renderToScreen?null:e);break;default:console.warn("THREE.SSAOPass: Unknown output type.")}}renderPass(t,e,n,r,i){t.getClearColor(this.originalClearColor);const s=t.getClearAlpha(),a=t.autoClear;t.setRenderTarget(n),t.autoClear=!1,r!=null&&(t.setClearColor(r),t.setClearAlpha(i||0),t.clear()),this.fsQuad.material=e,this.fsQuad.render(t),t.autoClear=a,t.setClearColor(this.originalClearColor),t.setClearAlpha(s)}renderOverride(t,e,n,r,i){t.getClearColor(this.originalClearColor);const s=t.getClearAlpha(),a=t.autoClear;t.setRenderTarget(n),t.autoClear=!1,r=e.clearColor||r,i=e.clearAlpha||i,r!=null&&(t.setClearColor(r),t.setClearAlpha(i||0),t.clear()),this.scene.overrideMaterial=e,t.render(this.scene,this.camera),this.scene.overrideMaterial=null,t.autoClear=a,t.setClearColor(this.originalClearColor),t.setClearAlpha(s)}setSize(t,e){this.width=t,this.height=e,this.beautyRenderTarget.setSize(t,e),this.ssaoRenderTarget.setSize(t,e),this.normalRenderTarget.setSize(t,e),this.blurRenderTarget.setSize(t,e),this.ssaoMaterial.uniforms.resolution.value.set(t,e),this.ssaoMaterial.uniforms.cameraProjectionMatrix.value.copy(this.camera.projectionMatrix),this.ssaoMaterial.uniforms.cameraInverseProjectionMatrix.value.copy(this.camera.projectionMatrixInverse),this.blurMaterial.uniforms.resolution.value.set(t,e)}generateSampleKernel(){const t=this.kernelSize,e=this.kernel;for(let n=0;n<t;n++){const r=new c.Vector3;r.x=Math.random()*2-1,r.y=Math.random()*2-1,r.z=Math.random(),r.normalize();let i=n/t;i=c.MathUtils.lerp(.1,1,i*i),r.multiplyScalar(i),e.push(r)}}generateRandomKernelRotations(){ai===void 0&&console.error("THREE.SSAOPass: The pass relies on SimplexNoise.");const n=new ai,r=4*4,i=new Float32Array(r);for(let s=0;s<r;s++){const a=Math.random()*2-1,o=Math.random()*2-1,l=0;i[s]=n.noise3d(a,o,l)}this.noiseTexture=new c.DataTexture(i,4,4,c.RedFormat,c.FloatType),this.noiseTexture.wrapS=c.RepeatWrapping,this.noiseTexture.wrapT=c.RepeatWrapping,this.noiseTexture.needsUpdate=!0}overrideVisibility(){const t=this.scene,e=this._visibilityCache;t.traverse(function(n){e.set(n,n.visible),(n.isPoints||n.isLine)&&(n.visible=!1)})}restoreVisibility(){const t=this.scene,e=this._visibilityCache;t.traverse(function(n){const r=e.get(n);n.visible=r}),e.clear()}};M(ir,"OUTPUT",{Default:0,SSAO:1,Blur:2,Beauty:3,Depth:4,Normal:5});const q5={shaderID:"luminosityHighPass",uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new c.Color(0)},defaultOpacity:{value:0}},vertexShader:["varying vec2 vUv;","void main() {"," vUv = uv;"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join(`
|
|
530
|
+
`),fragmentShader:["uniform sampler2D tDiffuse;","uniform vec3 defaultColor;","uniform float defaultOpacity;","uniform float luminosityThreshold;","uniform float smoothWidth;","varying vec2 vUv;","void main() {"," vec4 texel = texture2D( tDiffuse, vUv );"," vec3 luma = vec3( 0.299, 0.587, 0.114 );"," float v = dot( texel.xyz, luma );"," vec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );"," float alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );"," gl_FragColor = mix( outputColor, texel, alpha );","}"].join(`
|
|
531
|
+
`)},po=class extends us{constructor(t,e,n,r){super(),this.strength=e!==void 0?e:1,this.radius=n,this.threshold=r,this.resolution=t!==void 0?new c.Vector2(t.x,t.y):new c.Vector2(256,256),this.clearColor=new c.Color(0,0,0),this.renderTargetsHorizontal=[],this.renderTargetsVertical=[],this.nMips=5;let i=Math.round(this.resolution.x/2),s=Math.round(this.resolution.y/2);this.renderTargetBright=new c.WebGLRenderTarget(i,s,{type:c.HalfFloatType}),this.renderTargetBright.texture.name="UnrealBloomPass.bright",this.renderTargetBright.texture.generateMipmaps=!1;for(let u=0;u<this.nMips;u++){const A=new c.WebGLRenderTarget(i,s,{type:c.HalfFloatType});A.texture.name="UnrealBloomPass.h"+u,A.texture.generateMipmaps=!1,this.renderTargetsHorizontal.push(A);const f=new c.WebGLRenderTarget(i,s,{type:c.HalfFloatType});f.texture.name="UnrealBloomPass.v"+u,f.texture.generateMipmaps=!1,this.renderTargetsVertical.push(f),i=Math.round(i/2),s=Math.round(s/2)}const a=q5;this.highPassUniforms=c.UniformsUtils.clone(a.uniforms),this.highPassUniforms.luminosityThreshold.value=r,this.highPassUniforms.smoothWidth.value=.01,this.materialHighPassFilter=new c.ShaderMaterial({uniforms:this.highPassUniforms,vertexShader:a.vertexShader,fragmentShader:a.fragmentShader,defines:{}}),this.separableBlurMaterials=[];const o=[3,5,7,9,11];i=Math.round(this.resolution.x/2),s=Math.round(this.resolution.y/2);for(let u=0;u<this.nMips;u++)this.separableBlurMaterials.push(this.getSeperableBlurMaterial(o[u])),this.separableBlurMaterials[u].uniforms.texSize.value=new c.Vector2(i,s),i=Math.round(i/2),s=Math.round(s/2);this.compositeMaterial=this.getCompositeMaterial(this.nMips),this.compositeMaterial.uniforms.blurTexture1.value=this.renderTargetsVertical[0].texture,this.compositeMaterial.uniforms.blurTexture2.value=this.renderTargetsVertical[1].texture,this.compositeMaterial.uniforms.blurTexture3.value=this.renderTargetsVertical[2].texture,this.compositeMaterial.uniforms.blurTexture4.value=this.renderTargetsVertical[3].texture,this.compositeMaterial.uniforms.blurTexture5.value=this.renderTargetsVertical[4].texture,this.compositeMaterial.uniforms.bloomStrength.value=e,this.compositeMaterial.uniforms.bloomRadius.value=.1,this.compositeMaterial.needsUpdate=!0;const l=[1,.8,.6,.4,.2];this.compositeMaterial.uniforms.bloomFactors.value=l,this.bloomTintColors=[new c.Vector3(1,1,1),new c.Vector3(1,1,1),new c.Vector3(1,1,1),new c.Vector3(1,1,1),new c.Vector3(1,1,1)],this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors;const h=Jt;this.copyUniforms=c.UniformsUtils.clone(h.uniforms),this.copyUniforms.opacity.value=1,this.materialCopy=new c.ShaderMaterial({uniforms:this.copyUniforms,vertexShader:h.vertexShader,fragmentShader:h.fragmentShader,blending:c.AdditiveBlending,depthTest:!1,depthWrite:!1,transparent:!0}),this.enabled=!0,this.needsSwap=!1,this._oldClearColor=new c.Color,this.oldClearAlpha=1,this.basic=new c.MeshBasicMaterial,this.fsQuad=new As(null)}dispose(){for(let t=0;t<this.renderTargetsHorizontal.length;t++)this.renderTargetsHorizontal[t].dispose();for(let t=0;t<this.renderTargetsVertical.length;t++)this.renderTargetsVertical[t].dispose();this.renderTargetBright.dispose();for(let t=0;t<this.separableBlurMaterials.length;t++)this.separableBlurMaterials[t].dispose();this.compositeMaterial.dispose(),this.materialCopy.dispose(),this.basic.dispose(),this.fsQuad.dispose()}setSize(t,e){let n=Math.round(t/2),r=Math.round(e/2);this.renderTargetBright.setSize(n,r);for(let i=0;i<this.nMips;i++)this.renderTargetsHorizontal[i].setSize(n,r),this.renderTargetsVertical[i].setSize(n,r),this.separableBlurMaterials[i].uniforms.texSize.value=new c.Vector2(n,r),n=Math.round(n/2),r=Math.round(r/2)}render(t,e,n,r,i){t.getClearColor(this._oldClearColor),this.oldClearAlpha=t.getClearAlpha();const s=t.autoClear;t.autoClear=!1,t.setClearColor(this.clearColor,0),i&&t.state.buffers.stencil.setTest(!1),this.renderToScreen&&(this.fsQuad.material=this.basic,this.basic.map=n.texture,t.setRenderTarget(null),t.clear(),this.fsQuad.render(t)),this.highPassUniforms.tDiffuse.value=n.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this.fsQuad.material=this.materialHighPassFilter,t.setRenderTarget(this.renderTargetBright),t.clear(),this.fsQuad.render(t);let a=this.renderTargetBright;for(let o=0;o<this.nMips;o++)this.fsQuad.material=this.separableBlurMaterials[o],this.separableBlurMaterials[o].uniforms.colorTexture.value=a.texture,this.separableBlurMaterials[o].uniforms.direction.value=po.BlurDirectionX,t.setRenderTarget(this.renderTargetsHorizontal[o]),t.clear(),this.fsQuad.render(t),this.separableBlurMaterials[o].uniforms.colorTexture.value=this.renderTargetsHorizontal[o].texture,this.separableBlurMaterials[o].uniforms.direction.value=po.BlurDirectionY,t.setRenderTarget(this.renderTargetsVertical[o]),t.clear(),this.fsQuad.render(t),a=this.renderTargetsVertical[o];this.fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,t.setRenderTarget(this.renderTargetsHorizontal[0]),t.clear(),this.fsQuad.render(t),this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,i&&t.state.buffers.stencil.setTest(!0),this.renderToScreen?(t.setRenderTarget(null),this.fsQuad.render(t)):(t.setRenderTarget(n),this.fsQuad.render(t)),t.setClearColor(this._oldClearColor,this.oldClearAlpha),t.autoClear=s}getSeperableBlurMaterial(t){return new c.ShaderMaterial({defines:{KERNEL_RADIUS:t,SIGMA:t},uniforms:{colorTexture:{value:null},texSize:{value:new c.Vector2(.5,.5)},direction:{value:new c.Vector2(.5,.5)}},vertexShader:`varying vec2 vUv;
|
|
532
|
+
void main() {
|
|
533
|
+
vUv = uv;
|
|
534
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
535
|
+
}`,fragmentShader:`#include <common>
|
|
536
|
+
varying vec2 vUv;
|
|
537
|
+
uniform sampler2D colorTexture;
|
|
538
|
+
uniform vec2 texSize;
|
|
539
|
+
uniform vec2 direction;
|
|
540
|
+
|
|
541
|
+
float gaussianPdf(in float x, in float sigma) {
|
|
542
|
+
return 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;
|
|
543
|
+
}
|
|
544
|
+
void main() {
|
|
545
|
+
vec2 invSize = 1.0 / texSize;
|
|
546
|
+
float fSigma = float(SIGMA);
|
|
547
|
+
float weightSum = gaussianPdf(0.0, fSigma);
|
|
548
|
+
vec3 diffuseSum = texture2D( colorTexture, vUv).rgb * weightSum;
|
|
549
|
+
for( int i = 1; i < KERNEL_RADIUS; i ++ ) {
|
|
550
|
+
float x = float(i);
|
|
551
|
+
float w = gaussianPdf(x, fSigma);
|
|
552
|
+
vec2 uvOffset = direction * invSize * x;
|
|
553
|
+
vec3 sample1 = texture2D( colorTexture, vUv + uvOffset).rgb;
|
|
554
|
+
vec3 sample2 = texture2D( colorTexture, vUv - uvOffset).rgb;
|
|
555
|
+
diffuseSum += (sample1 + sample2) * w;
|
|
556
|
+
weightSum += 2.0 * w;
|
|
557
|
+
}
|
|
558
|
+
gl_FragColor = vec4(diffuseSum/weightSum, 1.0);
|
|
559
|
+
}`})}getCompositeMaterial(t){return new c.ShaderMaterial({defines:{NUM_MIPS:t},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:`varying vec2 vUv;
|
|
560
|
+
void main() {
|
|
561
|
+
vUv = uv;
|
|
562
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
563
|
+
}`,fragmentShader:`varying vec2 vUv;
|
|
564
|
+
uniform sampler2D blurTexture1;
|
|
565
|
+
uniform sampler2D blurTexture2;
|
|
566
|
+
uniform sampler2D blurTexture3;
|
|
567
|
+
uniform sampler2D blurTexture4;
|
|
568
|
+
uniform sampler2D blurTexture5;
|
|
569
|
+
uniform float bloomStrength;
|
|
570
|
+
uniform float bloomRadius;
|
|
571
|
+
uniform float bloomFactors[NUM_MIPS];
|
|
572
|
+
uniform vec3 bloomTintColors[NUM_MIPS];
|
|
573
|
+
|
|
574
|
+
float lerpBloomFactor(const in float factor) {
|
|
575
|
+
float mirrorFactor = 1.2 - factor;
|
|
576
|
+
return mix(factor, mirrorFactor, bloomRadius);
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
void main() {
|
|
580
|
+
gl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) +
|
|
581
|
+
lerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) +
|
|
582
|
+
lerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) +
|
|
583
|
+
lerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) +
|
|
584
|
+
lerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) );
|
|
585
|
+
}`})}};let R3=po;M(R3,"BlurDirectionX",new c.Vector2(1,0)),M(R3,"BlurDirectionY",new c.Vector2(0,1));const ps={defines:{NUM_SAMPLES:7,NUM_RINGS:4,NORMAL_TEXTURE:0,DIFFUSE_TEXTURE:0,DEPTH_PACKING:1,PERSPECTIVE_CAMERA:1},uniforms:{tDepth:{value:null},tDiffuse:{value:null},tNormal:{value:null},size:{value:new c.Vector2(512,512)},cameraNear:{value:1},cameraFar:{value:100},cameraProjectionMatrix:{value:new c.Matrix4},cameraInverseProjectionMatrix:{value:new c.Matrix4},scale:{value:1},intensity:{value:.1},bias:{value:.5},minResolution:{value:0},kernelRadius:{value:100},randomSeed:{value:0}},vertexShader:["varying vec2 vUv;","void main() {"," vUv = uv;"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join(`
|
|
586
|
+
`),fragmentShader:["#include <common>","varying vec2 vUv;","#if DIFFUSE_TEXTURE == 1","uniform sampler2D tDiffuse;","#endif","uniform sampler2D tDepth;","#if NORMAL_TEXTURE == 1","uniform sampler2D tNormal;","#endif","uniform float cameraNear;","uniform float cameraFar;","uniform mat4 cameraProjectionMatrix;","uniform mat4 cameraInverseProjectionMatrix;","uniform float scale;","uniform float intensity;","uniform float bias;","uniform float kernelRadius;","uniform float minResolution;","uniform vec2 size;","uniform float randomSeed;","// RGBA depth","#include <packing>","vec4 getDefaultColor( const in vec2 screenPosition ) {"," #if DIFFUSE_TEXTURE == 1"," return texture2D( tDiffuse, vUv );"," #else"," return vec4( 1.0 );"," #endif","}","float getDepth( const in vec2 screenPosition ) {"," #if DEPTH_PACKING == 1"," return unpackRGBAToDepth( texture2D( tDepth, screenPosition ) );"," #else"," return texture2D( tDepth, screenPosition ).x;"," #endif","}","float getViewZ( const in float depth ) {"," #if PERSPECTIVE_CAMERA == 1"," return perspectiveDepthToViewZ( depth, cameraNear, cameraFar );"," #else"," return orthographicDepthToViewZ( depth, cameraNear, cameraFar );"," #endif","}","vec3 getViewPosition( const in vec2 screenPosition, const in float depth, const in float viewZ ) {"," float clipW = cameraProjectionMatrix[2][3] * viewZ + cameraProjectionMatrix[3][3];"," vec4 clipPosition = vec4( ( vec3( screenPosition, depth ) - 0.5 ) * 2.0, 1.0 );"," clipPosition *= clipW; // unprojection."," return ( cameraInverseProjectionMatrix * clipPosition ).xyz;","}","vec3 getViewNormal( const in vec3 viewPosition, const in vec2 screenPosition ) {"," #if NORMAL_TEXTURE == 1"," return unpackRGBToNormal( texture2D( tNormal, screenPosition ).xyz );"," #else"," return normalize( cross( dFdx( viewPosition ), dFdy( viewPosition ) ) );"," #endif","}","float scaleDividedByCameraFar;","float minResolutionMultipliedByCameraFar;","float getOcclusion( const in vec3 centerViewPosition, const in vec3 centerViewNormal, const in vec3 sampleViewPosition ) {"," vec3 viewDelta = sampleViewPosition - centerViewPosition;"," float viewDistance = length( viewDelta );"," float scaledScreenDistance = scaleDividedByCameraFar * viewDistance;"," return max(0.0, (dot(centerViewNormal, viewDelta) - minResolutionMultipliedByCameraFar) / scaledScreenDistance - bias) / (1.0 + pow2( scaledScreenDistance ) );","}","// moving costly divides into consts","const float ANGLE_STEP = PI2 * float( NUM_RINGS ) / float( NUM_SAMPLES );","const float INV_NUM_SAMPLES = 1.0 / float( NUM_SAMPLES );","float getAmbientOcclusion( const in vec3 centerViewPosition ) {"," // precompute some variables require in getOcclusion."," scaleDividedByCameraFar = scale / cameraFar;"," minResolutionMultipliedByCameraFar = minResolution * cameraFar;"," vec3 centerViewNormal = getViewNormal( centerViewPosition, vUv );"," // jsfiddle that shows sample pattern: https://jsfiddle.net/a16ff1p7/"," float angle = rand( vUv + randomSeed ) * PI2;"," vec2 radius = vec2( kernelRadius * INV_NUM_SAMPLES ) / size;"," vec2 radiusStep = radius;"," float occlusionSum = 0.0;"," float weightSum = 0.0;"," for( int i = 0; i < NUM_SAMPLES; i ++ ) {"," vec2 sampleUv = vUv + vec2( cos( angle ), sin( angle ) ) * radius;"," radius += radiusStep;"," angle += ANGLE_STEP;"," float sampleDepth = getDepth( sampleUv );"," if( sampleDepth >= ( 1.0 - EPSILON ) ) {"," continue;"," }"," float sampleViewZ = getViewZ( sampleDepth );"," vec3 sampleViewPosition = getViewPosition( sampleUv, sampleDepth, sampleViewZ );"," occlusionSum += getOcclusion( centerViewPosition, centerViewNormal, sampleViewPosition );"," weightSum += 1.0;"," }"," if( weightSum == 0.0 ) discard;"," return occlusionSum * ( intensity / weightSum );","}","void main() {"," float centerDepth = getDepth( vUv );"," if( centerDepth >= ( 1.0 - EPSILON ) ) {"," discard;"," }"," float centerViewZ = getViewZ( centerDepth );"," vec3 viewPosition = getViewPosition( vUv, centerDepth, centerViewZ );"," float ambientOcclusion = getAmbientOcclusion( viewPosition );"," gl_FragColor = getDefaultColor( vUv );"," gl_FragColor.xyz *= 1.0 - ambientOcclusion;","}"].join(`
|
|
587
|
+
`)},Nn={defines:{KERNEL_RADIUS:4,DEPTH_PACKING:1,PERSPECTIVE_CAMERA:1},uniforms:{tDiffuse:{value:null},size:{value:new c.Vector2(512,512)},sampleUvOffsets:{value:[new c.Vector2(0,0)]},sampleWeights:{value:[1]},tDepth:{value:null},cameraNear:{value:10},cameraFar:{value:1e3},depthCutoff:{value:10}},vertexShader:["#include <common>","uniform vec2 size;","varying vec2 vUv;","varying vec2 vInvSize;","void main() {"," vUv = uv;"," vInvSize = 1.0 / size;"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join(`
|
|
588
|
+
`),fragmentShader:["#include <common>","#include <packing>","uniform sampler2D tDiffuse;","uniform sampler2D tDepth;","uniform float cameraNear;","uniform float cameraFar;","uniform float depthCutoff;","uniform vec2 sampleUvOffsets[ KERNEL_RADIUS + 1 ];","uniform float sampleWeights[ KERNEL_RADIUS + 1 ];","varying vec2 vUv;","varying vec2 vInvSize;","float getDepth( const in vec2 screenPosition ) {"," #if DEPTH_PACKING == 1"," return unpackRGBAToDepth( texture2D( tDepth, screenPosition ) );"," #else"," return texture2D( tDepth, screenPosition ).x;"," #endif","}","float getViewZ( const in float depth ) {"," #if PERSPECTIVE_CAMERA == 1"," return perspectiveDepthToViewZ( depth, cameraNear, cameraFar );"," #else"," return orthographicDepthToViewZ( depth, cameraNear, cameraFar );"," #endif","}","void main() {"," float depth = getDepth( vUv );"," if( depth >= ( 1.0 - EPSILON ) ) {"," discard;"," }"," float centerViewZ = -getViewZ( depth );"," bool rBreak = false, lBreak = false;"," float weightSum = sampleWeights[0];"," vec4 diffuseSum = texture2D( tDiffuse, vUv ) * weightSum;"," for( int i = 1; i <= KERNEL_RADIUS; i ++ ) {"," float sampleWeight = sampleWeights[i];"," vec2 sampleUvOffset = sampleUvOffsets[i] * vInvSize;"," vec2 sampleUv = vUv + sampleUvOffset;"," float viewZ = -getViewZ( getDepth( sampleUv ) );"," if( abs( viewZ - centerViewZ ) > depthCutoff ) rBreak = true;"," if( ! rBreak ) {"," diffuseSum += texture2D( tDiffuse, sampleUv ) * sampleWeight;"," weightSum += sampleWeight;"," }"," sampleUv = vUv - sampleUvOffset;"," viewZ = -getViewZ( getDepth( sampleUv ) );"," if( abs( viewZ - centerViewZ ) > depthCutoff ) lBreak = true;"," if( ! lBreak ) {"," diffuseSum += texture2D( tDiffuse, sampleUv ) * sampleWeight;"," weightSum += sampleWeight;"," }"," }"," gl_FragColor = diffuseSum / weightSum;","}"].join(`
|
|
589
|
+
`)},gs={createSampleWeights:(t,e)=>{const n=(i,s)=>Math.exp(-(i*i)/(2*(s*s)))/(Math.sqrt(2*Math.PI)*s),r=[];for(let i=0;i<=t;i++)r.push(n(i,e));return r},createSampleOffsets:(t,e)=>{const n=[];for(let r=0;r<=t;r++)n.push(e.clone().multiplyScalar(r));return n},configure:(t,e,n,r)=>{t.defines.KERNEL_RADIUS=e,t.uniforms.sampleUvOffsets.value=gs.createSampleOffsets(e,r),t.uniforms.sampleWeights.value=gs.createSampleWeights(e,n),t.needsUpdate=!0}};class K5 extends us{constructor(e,n,r=!1,i=!1,s=new c.Vector2(256,256)){super(),this.scene=e,this.camera=n,this.clear=!0,this.needsSwap=!1,this.supportsDepthTextureExtension=r,this.supportsNormalTexture=i,this.originalClearColor=new c.Color,this._oldClearColor=new c.Color,this.oldClearAlpha=1,this.params={output:0,saoBias:.5,saoIntensity:.18,saoScale:1,saoKernelRadius:100,saoMinResolution:0,saoBlur:!0,saoBlurRadius:8,saoBlurStdDev:4,saoBlurDepthCutoff:.01},this.resolution=new c.Vector2(s.x,s.y),this.saoRenderTarget=new c.WebGLRenderTarget(this.resolution.x,this.resolution.y,{type:c.HalfFloatType}),this.blurIntermediateRenderTarget=this.saoRenderTarget.clone(),this.beautyRenderTarget=this.saoRenderTarget.clone(),this.normalRenderTarget=new c.WebGLRenderTarget(this.resolution.x,this.resolution.y,{minFilter:c.NearestFilter,magFilter:c.NearestFilter,type:c.HalfFloatType}),this.depthRenderTarget=this.normalRenderTarget.clone();let a;this.supportsDepthTextureExtension&&(a=new c.DepthTexture,a.type=c.UnsignedShortType,this.beautyRenderTarget.depthTexture=a,this.beautyRenderTarget.depthBuffer=!0),this.depthMaterial=new c.MeshDepthMaterial,this.depthMaterial.depthPacking=c.RGBADepthPacking,this.depthMaterial.blending=c.NoBlending,this.normalMaterial=new c.MeshNormalMaterial,this.normalMaterial.blending=c.NoBlending,this.saoMaterial=new c.ShaderMaterial({defines:Object.assign({},ps.defines),fragmentShader:ps.fragmentShader,vertexShader:ps.vertexShader,uniforms:c.UniformsUtils.clone(ps.uniforms)}),this.saoMaterial.extensions.derivatives=!0,this.saoMaterial.defines.DEPTH_PACKING=this.supportsDepthTextureExtension?0:1,this.saoMaterial.defines.NORMAL_TEXTURE=this.supportsNormalTexture?1:0,this.saoMaterial.defines.PERSPECTIVE_CAMERA=this.camera.isPerspectiveCamera?1:0,this.saoMaterial.uniforms.tDepth.value=this.supportsDepthTextureExtension?a:this.depthRenderTarget.texture,this.saoMaterial.uniforms.tNormal.value=this.normalRenderTarget.texture,this.saoMaterial.uniforms.size.value.set(this.resolution.x,this.resolution.y),this.saoMaterial.uniforms.cameraInverseProjectionMatrix.value.copy(this.camera.projectionMatrixInverse),this.saoMaterial.uniforms.cameraProjectionMatrix.value=this.camera.projectionMatrix,this.saoMaterial.blending=c.NoBlending,this.vBlurMaterial=new c.ShaderMaterial({uniforms:c.UniformsUtils.clone(Nn.uniforms),defines:Object.assign({},Nn.defines),vertexShader:Nn.vertexShader,fragmentShader:Nn.fragmentShader}),this.vBlurMaterial.defines.DEPTH_PACKING=this.supportsDepthTextureExtension?0:1,this.vBlurMaterial.defines.PERSPECTIVE_CAMERA=this.camera.isPerspectiveCamera?1:0,this.vBlurMaterial.uniforms.tDiffuse.value=this.saoRenderTarget.texture,this.vBlurMaterial.uniforms.tDepth.value=this.supportsDepthTextureExtension?a:this.depthRenderTarget.texture,this.vBlurMaterial.uniforms.size.value.set(this.resolution.x,this.resolution.y),this.vBlurMaterial.blending=c.NoBlending,this.hBlurMaterial=new c.ShaderMaterial({uniforms:c.UniformsUtils.clone(Nn.uniforms),defines:Object.assign({},Nn.defines),vertexShader:Nn.vertexShader,fragmentShader:Nn.fragmentShader}),this.hBlurMaterial.defines.DEPTH_PACKING=this.supportsDepthTextureExtension?0:1,this.hBlurMaterial.defines.PERSPECTIVE_CAMERA=this.camera.isPerspectiveCamera?1:0,this.hBlurMaterial.uniforms.tDiffuse.value=this.blurIntermediateRenderTarget.texture,this.hBlurMaterial.uniforms.tDepth.value=this.supportsDepthTextureExtension?a:this.depthRenderTarget.texture,this.hBlurMaterial.uniforms.size.value.set(this.resolution.x,this.resolution.y),this.hBlurMaterial.blending=c.NoBlending,this.materialCopy=new c.ShaderMaterial({uniforms:c.UniformsUtils.clone(Jt.uniforms),vertexShader:Jt.vertexShader,fragmentShader:Jt.fragmentShader,blending:c.NoBlending}),this.materialCopy.transparent=!0,this.materialCopy.depthTest=!1,this.materialCopy.depthWrite=!1,this.materialCopy.blending=c.CustomBlending,this.materialCopy.blendSrc=c.DstColorFactor,this.materialCopy.blendDst=c.ZeroFactor,this.materialCopy.blendEquation=c.AddEquation,this.materialCopy.blendSrcAlpha=c.DstAlphaFactor,this.materialCopy.blendDstAlpha=c.ZeroFactor,this.materialCopy.blendEquationAlpha=c.AddEquation,this.depthCopy=new c.ShaderMaterial({uniforms:c.UniformsUtils.clone(Ao.uniforms),vertexShader:Ao.vertexShader,fragmentShader:Ao.fragmentShader,blending:c.NoBlending}),this.fsQuad=new As(null)}render(e,n,r){if(this.renderToScreen&&(this.materialCopy.blending=c.NoBlending,this.materialCopy.uniforms.tDiffuse.value=r.texture,this.materialCopy.needsUpdate=!0,this.renderPass(e,this.materialCopy,null)),this.params.output===1)return;e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha();const i=e.autoClear;e.autoClear=!1,e.setRenderTarget(this.depthRenderTarget),e.clear(),this.saoMaterial.uniforms.bias.value=this.params.saoBias,this.saoMaterial.uniforms.intensity.value=this.params.saoIntensity,this.saoMaterial.uniforms.scale.value=this.params.saoScale,this.saoMaterial.uniforms.kernelRadius.value=this.params.saoKernelRadius,this.saoMaterial.uniforms.minResolution.value=this.params.saoMinResolution,this.saoMaterial.uniforms.cameraNear.value=this.camera.near,this.saoMaterial.uniforms.cameraFar.value=this.camera.far;const s=this.params.saoBlurDepthCutoff*(this.camera.far-this.camera.near);this.vBlurMaterial.uniforms.depthCutoff.value=s,this.hBlurMaterial.uniforms.depthCutoff.value=s,this.vBlurMaterial.uniforms.cameraNear.value=this.camera.near,this.vBlurMaterial.uniforms.cameraFar.value=this.camera.far,this.hBlurMaterial.uniforms.cameraNear.value=this.camera.near,this.hBlurMaterial.uniforms.cameraFar.value=this.camera.far,this.params.saoBlurRadius=Math.floor(this.params.saoBlurRadius),(this.prevStdDev!==this.params.saoBlurStdDev||this.prevNumSamples!==this.params.saoBlurRadius)&&(gs.configure(this.vBlurMaterial,this.params.saoBlurRadius,this.params.saoBlurStdDev,new c.Vector2(0,1)),gs.configure(this.hBlurMaterial,this.params.saoBlurRadius,this.params.saoBlurStdDev,new c.Vector2(1,0)),this.prevStdDev=this.params.saoBlurStdDev,this.prevNumSamples=this.params.saoBlurRadius),e.setClearColor(0),e.setRenderTarget(this.beautyRenderTarget),e.clear(),e.render(this.scene,this.camera),this.supportsDepthTextureExtension||this.renderOverride(e,this.depthMaterial,this.depthRenderTarget,0,1),this.supportsNormalTexture&&this.renderOverride(e,this.normalMaterial,this.normalRenderTarget,7829503,1),this.renderPass(e,this.saoMaterial,this.saoRenderTarget,16777215,1),this.params.saoBlur&&(this.renderPass(e,this.vBlurMaterial,this.blurIntermediateRenderTarget,16777215,1),this.renderPass(e,this.hBlurMaterial,this.saoRenderTarget,16777215,1));let a=this.materialCopy;this.params.output===3?this.supportsDepthTextureExtension?(this.materialCopy.uniforms.tDiffuse.value=this.beautyRenderTarget.depthTexture,this.materialCopy.needsUpdate=!0):(this.depthCopy.uniforms.tDiffuse.value=this.depthRenderTarget.texture,this.depthCopy.needsUpdate=!0,a=this.depthCopy):this.params.output===4?(this.materialCopy.uniforms.tDiffuse.value=this.normalRenderTarget.texture,this.materialCopy.needsUpdate=!0):(this.materialCopy.uniforms.tDiffuse.value=this.saoRenderTarget.texture,this.materialCopy.needsUpdate=!0),this.params.output===0?a.blending=c.CustomBlending:a.blending=c.NoBlending,this.renderPass(e,a,this.renderToScreen?null:r),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=i}renderPass(e,n,r,i,s){e.getClearColor(this.originalClearColor);const a=e.getClearAlpha(),o=e.autoClear;e.setRenderTarget(r),e.autoClear=!1,i!=null&&(e.setClearColor(i),e.setClearAlpha(s||0),e.clear()),this.fsQuad.material=n,this.fsQuad.render(e),e.autoClear=o,e.setClearColor(this.originalClearColor),e.setClearAlpha(a)}renderOverride(e,n,r,i,s){e.getClearColor(this.originalClearColor);const a=e.getClearAlpha(),o=e.autoClear;e.setRenderTarget(r),e.autoClear=!1,i=n.clearColor||i,s=n.clearAlpha||s,i!=null&&(e.setClearColor(i),e.setClearAlpha(s||0),e.clear()),this.scene.overrideMaterial=n,e.render(this.scene,this.camera),this.scene.overrideMaterial=null,e.autoClear=o,e.setClearColor(this.originalClearColor),e.setClearAlpha(a)}setSize(e,n){this.beautyRenderTarget.setSize(e,n),this.saoRenderTarget.setSize(e,n),this.blurIntermediateRenderTarget.setSize(e,n),this.normalRenderTarget.setSize(e,n),this.depthRenderTarget.setSize(e,n),this.saoMaterial.uniforms.size.value.set(e,n),this.saoMaterial.uniforms.cameraInverseProjectionMatrix.value.copy(this.camera.projectionMatrixInverse),this.saoMaterial.uniforms.cameraProjectionMatrix.value=this.camera.projectionMatrix,this.saoMaterial.needsUpdate=!0,this.vBlurMaterial.uniforms.size.value.set(e,n),this.vBlurMaterial.needsUpdate=!0,this.hBlurMaterial.uniforms.size.value.set(e,n),this.hBlurMaterial.needsUpdate=!0}dispose(){this.saoRenderTarget.dispose(),this.blurIntermediateRenderTarget.dispose(),this.beautyRenderTarget.dispose(),this.normalRenderTarget.dispose(),this.depthRenderTarget.dispose(),this.depthMaterial.dispose(),this.normalMaterial.dispose(),this.saoMaterial.dispose(),this.vBlurMaterial.dispose(),this.hBlurMaterial.dispose(),this.materialCopy.dispose(),this.depthCopy.dispose(),this.fsQuad.dispose()}}M(K5,"OUTPUT",{Beauty:1,Default:0,SAO:2,Depth:3,Normal:4});const Ht={defines:{MAX_STEP:0,isPerspectiveCamera:!0,isDistanceAttenuation:!0,isFresnel:!0,isInfiniteThick:!1,isSelective:!1},uniforms:{tDiffuse:{value:null},tNormal:{value:null},tMetalness:{value:null},tDepth:{value:null},cameraNear:{value:null},cameraFar:{value:null},resolution:{value:new c.Vector2},cameraProjectionMatrix:{value:new c.Matrix4},cameraInverseProjectionMatrix:{value:new c.Matrix4},opacity:{value:.5},maxDistance:{value:180},cameraRange:{value:0},surfDist:{value:.007},thickTolerance:{value:.03}},vertexShader:`
|
|
590
|
+
|
|
591
|
+
varying vec2 vUv;
|
|
592
|
+
|
|
593
|
+
void main() {
|
|
594
|
+
|
|
595
|
+
vUv = uv;
|
|
596
|
+
|
|
597
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
598
|
+
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
`,fragmentShader:`
|
|
602
|
+
// precision highp float;
|
|
603
|
+
precision highp sampler2D;
|
|
604
|
+
varying vec2 vUv;
|
|
605
|
+
uniform sampler2D tDepth;
|
|
606
|
+
uniform sampler2D tNormal;
|
|
607
|
+
uniform sampler2D tMetalness;
|
|
608
|
+
uniform sampler2D tDiffuse;
|
|
609
|
+
uniform float cameraRange;
|
|
610
|
+
uniform vec2 resolution;
|
|
611
|
+
uniform float opacity;
|
|
612
|
+
uniform float cameraNear;
|
|
613
|
+
uniform float cameraFar;
|
|
614
|
+
uniform float maxDistance;
|
|
615
|
+
uniform float surfDist;
|
|
616
|
+
uniform mat4 cameraProjectionMatrix;
|
|
617
|
+
uniform mat4 cameraInverseProjectionMatrix;
|
|
618
|
+
uniform float thickTolerance;
|
|
619
|
+
#include <packing>
|
|
620
|
+
float pointToLineDistance(vec3 x0, vec3 x1, vec3 x2) {
|
|
621
|
+
//x0: point, x1: linePointA, x2: linePointB
|
|
622
|
+
//https://mathworld.wolfram.com/Point-LineDistance3-Dimensional.html
|
|
623
|
+
return length(cross(x0-x1,x0-x2))/length(x2-x1);
|
|
624
|
+
}
|
|
625
|
+
float pointPlaneDistance(vec3 point,vec3 planePoint,vec3 planeNormal){
|
|
626
|
+
// https://mathworld.wolfram.com/Point-PlaneDistance.html
|
|
627
|
+
//// https://en.wikipedia.org/wiki/Plane_(geometry)
|
|
628
|
+
//// http://paulbourke.net/geometry/pointlineplane/
|
|
629
|
+
float a=planeNormal.x,b=planeNormal.y,c=planeNormal.z;
|
|
630
|
+
float x0=point.x,y0=point.y,z0=point.z;
|
|
631
|
+
float x=planePoint.x,y=planePoint.y,z=planePoint.z;
|
|
632
|
+
float d=-(a*x+b*y+c*z);
|
|
633
|
+
float distance=(a*x0+b*y0+c*z0+d)/sqrt(a*a+b*b+c*c);
|
|
634
|
+
return distance;
|
|
635
|
+
}
|
|
636
|
+
float getDepth( const in vec2 uv ) {
|
|
637
|
+
return texture2D( tDepth, uv ).x;
|
|
638
|
+
}
|
|
639
|
+
float getViewZ( const in float depth ) {
|
|
640
|
+
#ifdef isPerspectiveCamera
|
|
641
|
+
return perspectiveDepthToViewZ( depth, cameraNear, cameraFar );
|
|
642
|
+
#else
|
|
643
|
+
return orthographicDepthToViewZ( depth, cameraNear, cameraFar );
|
|
644
|
+
#endif
|
|
645
|
+
}
|
|
646
|
+
vec3 getViewPosition( const in vec2 uv, const in float depth/*clip space*/, const in float clipW ) {
|
|
647
|
+
vec4 clipPosition = vec4( ( vec3( uv, depth ) - 0.5 ) * 2.0, 1.0 );//ndc
|
|
648
|
+
clipPosition *= clipW; //clip
|
|
649
|
+
return ( cameraInverseProjectionMatrix * clipPosition ).xyz;//view
|
|
650
|
+
}
|
|
651
|
+
vec3 getViewNormal( const in vec2 uv ) {
|
|
652
|
+
return unpackRGBToNormal( texture2D( tNormal, uv ).xyz );
|
|
653
|
+
}
|
|
654
|
+
vec2 viewPositionToXY(vec3 viewPosition){
|
|
655
|
+
vec2 xy;
|
|
656
|
+
vec4 clip=cameraProjectionMatrix*vec4(viewPosition,1);
|
|
657
|
+
xy=clip.xy;//clip
|
|
658
|
+
float clipW=clip.w;
|
|
659
|
+
xy/=clipW;//NDC
|
|
660
|
+
xy=(xy+1.)/2.;//uv
|
|
661
|
+
xy*=resolution;//screen
|
|
662
|
+
return xy;
|
|
663
|
+
}
|
|
664
|
+
void main(){
|
|
665
|
+
#ifdef isSelective
|
|
666
|
+
float metalness=texture2D(tMetalness,vUv).r;
|
|
667
|
+
if(metalness==0.) return;
|
|
668
|
+
#endif
|
|
669
|
+
|
|
670
|
+
float depth = getDepth( vUv );
|
|
671
|
+
float viewZ = getViewZ( depth );
|
|
672
|
+
if(-viewZ>=cameraFar) return;
|
|
673
|
+
|
|
674
|
+
float clipW = cameraProjectionMatrix[2][3] * viewZ+cameraProjectionMatrix[3][3];
|
|
675
|
+
vec3 viewPosition=getViewPosition( vUv, depth, clipW );
|
|
676
|
+
|
|
677
|
+
vec2 d0=gl_FragCoord.xy;
|
|
678
|
+
vec2 d1;
|
|
679
|
+
|
|
680
|
+
vec3 viewNormal=getViewNormal( vUv );
|
|
681
|
+
|
|
682
|
+
#ifdef isPerspectiveCamera
|
|
683
|
+
vec3 viewIncidenceDir=normalize(viewPosition);
|
|
684
|
+
vec3 viewReflectDir=reflect(viewIncidenceDir,viewNormal);
|
|
685
|
+
#else
|
|
686
|
+
vec3 viewIncidenceDir=vec3(0,0,-1);
|
|
687
|
+
vec3 viewReflectDir=reflect(viewIncidenceDir,viewNormal);
|
|
688
|
+
#endif
|
|
689
|
+
|
|
690
|
+
float maxReflectRayLen=maxDistance/dot(-viewIncidenceDir,viewNormal);
|
|
691
|
+
// dot(a,b)==length(a)*length(b)*cos(theta) // https://www.mathsisfun.com/algebra/vectors-dot-product.html
|
|
692
|
+
// if(a.isNormalized&&b.isNormalized) dot(a,b)==cos(theta)
|
|
693
|
+
// maxDistance/maxReflectRayLen=cos(theta)
|
|
694
|
+
// maxDistance/maxReflectRayLen==dot(a,b)
|
|
695
|
+
// maxReflectRayLen==maxDistance/dot(a,b)
|
|
696
|
+
|
|
697
|
+
vec3 d1viewPosition=viewPosition+viewReflectDir*maxReflectRayLen;
|
|
698
|
+
#ifdef isPerspectiveCamera
|
|
699
|
+
if(d1viewPosition.z>-cameraNear){
|
|
700
|
+
//https://tutorial.math.lamar.edu/Classes/CalcIII/EqnsOfLines.aspx
|
|
701
|
+
float t=(-cameraNear-viewPosition.z)/viewReflectDir.z;
|
|
702
|
+
d1viewPosition=viewPosition+viewReflectDir*t;
|
|
703
|
+
}
|
|
704
|
+
#endif
|
|
705
|
+
d1=viewPositionToXY(d1viewPosition);
|
|
706
|
+
|
|
707
|
+
float totalLen=length(d1-d0);
|
|
708
|
+
float xLen=d1.x-d0.x;
|
|
709
|
+
float yLen=d1.y-d0.y;
|
|
710
|
+
float totalStep=max(abs(xLen),abs(yLen));
|
|
711
|
+
float xSpan=xLen/totalStep;
|
|
712
|
+
float ySpan=yLen/totalStep;
|
|
713
|
+
for(float i=0.;i<MAX_STEP;i++){
|
|
714
|
+
if(i>=totalStep) break;
|
|
715
|
+
vec2 xy=vec2(d0.x+i*xSpan,d0.y+i*ySpan);
|
|
716
|
+
if(xy.x<0.||xy.x>resolution.x||xy.y<0.||xy.y>resolution.y) break;
|
|
717
|
+
float s=length(xy-d0)/totalLen;
|
|
718
|
+
vec2 uv=xy/resolution;
|
|
719
|
+
|
|
720
|
+
float d = getDepth(uv);
|
|
721
|
+
float vZ = getViewZ( d );
|
|
722
|
+
if(-vZ>=cameraFar) continue;
|
|
723
|
+
float cW = cameraProjectionMatrix[2][3] * vZ+cameraProjectionMatrix[3][3];
|
|
724
|
+
vec3 vP=getViewPosition( uv, d, cW );
|
|
725
|
+
|
|
726
|
+
#ifdef isPerspectiveCamera
|
|
727
|
+
// https://www.comp.nus.edu.sg/~lowkl/publications/lowk_persp_interp_techrep.pdf
|
|
728
|
+
float recipVPZ=1./viewPosition.z;
|
|
729
|
+
float viewReflectRayZ=1./(recipVPZ+s*(1./d1viewPosition.z-recipVPZ));
|
|
730
|
+
float sD=surfDist*cW;
|
|
731
|
+
#else
|
|
732
|
+
float viewReflectRayZ=viewPosition.z+s*(d1viewPosition.z-viewPosition.z);
|
|
733
|
+
float sD=surfDist;
|
|
734
|
+
#endif
|
|
735
|
+
if(viewReflectRayZ-sD>vZ) continue;
|
|
736
|
+
|
|
737
|
+
#ifdef isInfiniteThick
|
|
738
|
+
if(viewReflectRayZ+thickTolerance*clipW<vP.z) break;
|
|
739
|
+
#endif
|
|
740
|
+
float away=pointToLineDistance(vP,viewPosition,d1viewPosition);
|
|
741
|
+
|
|
742
|
+
float op=opacity;
|
|
743
|
+
|
|
744
|
+
if(away<sD){
|
|
745
|
+
vec3 vN=getViewNormal( uv );
|
|
746
|
+
if(dot(viewReflectDir,vN)>=0.) continue;
|
|
747
|
+
float distance=pointPlaneDistance(vP,viewPosition,viewNormal);
|
|
748
|
+
if(distance>maxDistance) break;
|
|
749
|
+
#ifdef isDistanceAttenuation
|
|
750
|
+
float ratio=1.-(distance/maxDistance);
|
|
751
|
+
float attenuation=ratio*ratio;
|
|
752
|
+
op=opacity*attenuation;
|
|
753
|
+
#endif
|
|
754
|
+
#ifdef isFresnel
|
|
755
|
+
float fresnel=(dot(viewIncidenceDir,viewReflectDir)+1.)/2.;
|
|
756
|
+
op*=fresnel;
|
|
757
|
+
#endif
|
|
758
|
+
vec4 reflectColor=texture2D(tDiffuse,uv);
|
|
759
|
+
gl_FragColor.xyz=reflectColor.xyz;
|
|
760
|
+
gl_FragColor.a=op;
|
|
761
|
+
break;
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
`},ms={defines:{PERSPECTIVE_CAMERA:1},uniforms:{tDepth:{value:null},cameraNear:{value:null},cameraFar:{value:null}},vertexShader:`
|
|
766
|
+
|
|
767
|
+
varying vec2 vUv;
|
|
768
|
+
|
|
769
|
+
void main() {
|
|
770
|
+
|
|
771
|
+
vUv = uv;
|
|
772
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
773
|
+
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
`,fragmentShader:`
|
|
777
|
+
|
|
778
|
+
uniform sampler2D tDepth;
|
|
779
|
+
|
|
780
|
+
uniform float cameraNear;
|
|
781
|
+
uniform float cameraFar;
|
|
782
|
+
|
|
783
|
+
varying vec2 vUv;
|
|
784
|
+
|
|
785
|
+
#include <packing>
|
|
786
|
+
|
|
787
|
+
float getLinearDepth( const in vec2 uv ) {
|
|
788
|
+
|
|
789
|
+
#if PERSPECTIVE_CAMERA == 1
|
|
790
|
+
|
|
791
|
+
float fragCoordZ = texture2D( tDepth, uv ).x;
|
|
792
|
+
float viewZ = perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar );
|
|
793
|
+
return viewZToOrthographicDepth( viewZ, cameraNear, cameraFar );
|
|
794
|
+
|
|
795
|
+
#else
|
|
796
|
+
|
|
797
|
+
return texture2D( tDepth, uv ).x;
|
|
798
|
+
|
|
799
|
+
#endif
|
|
800
|
+
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
void main() {
|
|
804
|
+
|
|
805
|
+
float depth = getLinearDepth( vUv );
|
|
806
|
+
float d = 1.0 - depth;
|
|
807
|
+
// d=(d-.999)*1000.;
|
|
808
|
+
gl_FragColor = vec4( vec3( d ), 1.0 );
|
|
809
|
+
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
`},Gn={uniforms:{tDiffuse:{value:null},resolution:{value:new c.Vector2},opacity:{value:.5}},vertexShader:`
|
|
813
|
+
|
|
814
|
+
varying vec2 vUv;
|
|
815
|
+
|
|
816
|
+
void main() {
|
|
817
|
+
|
|
818
|
+
vUv = uv;
|
|
819
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
820
|
+
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
`,fragmentShader:`
|
|
824
|
+
|
|
825
|
+
uniform sampler2D tDiffuse;
|
|
826
|
+
uniform vec2 resolution;
|
|
827
|
+
varying vec2 vUv;
|
|
828
|
+
void main() {
|
|
829
|
+
//reverse engineering from PhotoShop blur filter, then change coefficient
|
|
830
|
+
|
|
831
|
+
vec2 texelSize = ( 1.0 / resolution );
|
|
832
|
+
|
|
833
|
+
vec4 c=texture2D(tDiffuse,vUv);
|
|
834
|
+
|
|
835
|
+
vec2 offset;
|
|
836
|
+
|
|
837
|
+
offset=(vec2(-1,0))*texelSize;
|
|
838
|
+
vec4 cl=texture2D(tDiffuse,vUv+offset);
|
|
839
|
+
|
|
840
|
+
offset=(vec2(1,0))*texelSize;
|
|
841
|
+
vec4 cr=texture2D(tDiffuse,vUv+offset);
|
|
842
|
+
|
|
843
|
+
offset=(vec2(0,-1))*texelSize;
|
|
844
|
+
vec4 cb=texture2D(tDiffuse,vUv+offset);
|
|
845
|
+
|
|
846
|
+
offset=(vec2(0,1))*texelSize;
|
|
847
|
+
vec4 ct=texture2D(tDiffuse,vUv+offset);
|
|
848
|
+
|
|
849
|
+
// float coeCenter=.5;
|
|
850
|
+
// float coeSide=.125;
|
|
851
|
+
float coeCenter=.2;
|
|
852
|
+
float coeSide=.2;
|
|
853
|
+
float a=c.a*coeCenter+cl.a*coeSide+cr.a*coeSide+cb.a*coeSide+ct.a*coeSide;
|
|
854
|
+
vec3 rgb=(c.rgb*c.a*coeCenter+cl.rgb*cl.a*coeSide+cr.rgb*cr.a*coeSide+cb.rgb*cb.a*coeSide+ct.rgb*ct.a*coeSide)/a;
|
|
855
|
+
gl_FragColor=vec4(rgb,a);
|
|
856
|
+
|
|
857
|
+
}
|
|
858
|
+
`},sr=class extends us{constructor({renderer:t,scene:e,camera:n,width:r,height:i,selects:s,bouncing:a=!1,groundReflector:o}){super(),this.width=r!==void 0?r:512,this.height=i!==void 0?i:512,this.clear=!0,this.renderer=t,this.scene=e,this.camera=n,this.groundReflector=o,this.opacity=Ht.uniforms.opacity.value,this.output=0,this.maxDistance=Ht.uniforms.maxDistance.value,this.thickness=Ht.uniforms.thickness.value,this.tempColor=new c.Color,this._selects=s,this.selective=Array.isArray(this._selects),Object.defineProperty(this,"selects",{get(){return this._selects},set(h){this._selects!==h&&(this._selects=h,Array.isArray(h)?(this.selective=!0,this.ssrMaterial.defines.SELECTIVE=!0,this.ssrMaterial.needsUpdate=!0):(this.selective=!1,this.ssrMaterial.defines.SELECTIVE=!1,this.ssrMaterial.needsUpdate=!0))}}),this._bouncing=a,Object.defineProperty(this,"bouncing",{get(){return this._bouncing},set(h){this._bouncing!==h&&(this._bouncing=h,h?this.ssrMaterial.uniforms.tDiffuse.value=this.prevRenderTarget.texture:this.ssrMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture)}}),this.blur=!0,this._distanceAttenuation=Ht.defines.DISTANCE_ATTENUATION,Object.defineProperty(this,"distanceAttenuation",{get(){return this._distanceAttenuation},set(h){this._distanceAttenuation!==h&&(this._distanceAttenuation=h,this.ssrMaterial.defines.DISTANCE_ATTENUATION=h,this.ssrMaterial.needsUpdate=!0)}}),this._fresnel=Ht.defines.FRESNEL,Object.defineProperty(this,"fresnel",{get(){return this._fresnel},set(h){this._fresnel!==h&&(this._fresnel=h,this.ssrMaterial.defines.FRESNEL=h,this.ssrMaterial.needsUpdate=!0)}}),this._infiniteThick=Ht.defines.INFINITE_THICK,Object.defineProperty(this,"infiniteThick",{get(){return this._infiniteThick},set(h){this._infiniteThick!==h&&(this._infiniteThick=h,this.ssrMaterial.defines.INFINITE_THICK=h,this.ssrMaterial.needsUpdate=!0)}});const l=new c.DepthTexture;l.type=c.UnsignedShortType,l.minFilter=c.NearestFilter,l.magFilter=c.NearestFilter,this.beautyRenderTarget=new c.WebGLRenderTarget(this.width,this.height,{minFilter:c.NearestFilter,magFilter:c.NearestFilter,type:c.HalfFloatType,depthTexture:l,depthBuffer:!0}),this.prevRenderTarget=new c.WebGLRenderTarget(this.width,this.height,{minFilter:c.NearestFilter,magFilter:c.NearestFilter}),this.normalRenderTarget=new c.WebGLRenderTarget(this.width,this.height,{minFilter:c.NearestFilter,magFilter:c.NearestFilter,type:c.HalfFloatType}),this.metalnessRenderTarget=new c.WebGLRenderTarget(this.width,this.height,{minFilter:c.NearestFilter,magFilter:c.NearestFilter,type:c.HalfFloatType}),this.ssrRenderTarget=new c.WebGLRenderTarget(this.width,this.height,{minFilter:c.NearestFilter,magFilter:c.NearestFilter}),this.blurRenderTarget=this.ssrRenderTarget.clone(),this.blurRenderTarget2=this.ssrRenderTarget.clone(),this.ssrMaterial=new c.ShaderMaterial({defines:Object.assign({},Ht.defines,{MAX_STEP:Math.sqrt(this.width*this.width+this.height*this.height)}),uniforms:c.UniformsUtils.clone(Ht.uniforms),vertexShader:Ht.vertexShader,fragmentShader:Ht.fragmentShader,blending:c.NoBlending}),this.ssrMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.ssrMaterial.uniforms.tNormal.value=this.normalRenderTarget.texture,this.ssrMaterial.defines.SELECTIVE=this.selective,this.ssrMaterial.needsUpdate=!0,this.ssrMaterial.uniforms.tMetalness.value=this.metalnessRenderTarget.texture,this.ssrMaterial.uniforms.tDepth.value=this.beautyRenderTarget.depthTexture,this.ssrMaterial.uniforms.cameraNear.value=this.camera.near,this.ssrMaterial.uniforms.cameraFar.value=this.camera.far,this.ssrMaterial.uniforms.thickness.value=this.thickness,this.ssrMaterial.uniforms.resolution.value.set(this.width,this.height),this.ssrMaterial.uniforms.cameraProjectionMatrix.value.copy(this.camera.projectionMatrix),this.ssrMaterial.uniforms.cameraInverseProjectionMatrix.value.copy(this.camera.projectionMatrixInverse),this.normalMaterial=new c.MeshNormalMaterial,this.normalMaterial.blending=c.NoBlending,this.metalnessOnMaterial=new c.MeshBasicMaterial({color:"white"}),this.metalnessOffMaterial=new c.MeshBasicMaterial({color:"black"}),this.blurMaterial=new c.ShaderMaterial({defines:Object.assign({},Gn.defines),uniforms:c.UniformsUtils.clone(Gn.uniforms),vertexShader:Gn.vertexShader,fragmentShader:Gn.fragmentShader}),this.blurMaterial.uniforms.tDiffuse.value=this.ssrRenderTarget.texture,this.blurMaterial.uniforms.resolution.value.set(this.width,this.height),this.blurMaterial2=new c.ShaderMaterial({defines:Object.assign({},Gn.defines),uniforms:c.UniformsUtils.clone(Gn.uniforms),vertexShader:Gn.vertexShader,fragmentShader:Gn.fragmentShader}),this.blurMaterial2.uniforms.tDiffuse.value=this.blurRenderTarget.texture,this.blurMaterial2.uniforms.resolution.value.set(this.width,this.height),this.depthRenderMaterial=new c.ShaderMaterial({defines:Object.assign({},ms.defines),uniforms:c.UniformsUtils.clone(ms.uniforms),vertexShader:ms.vertexShader,fragmentShader:ms.fragmentShader,blending:c.NoBlending}),this.depthRenderMaterial.uniforms.tDepth.value=this.beautyRenderTarget.depthTexture,this.depthRenderMaterial.uniforms.cameraNear.value=this.camera.near,this.depthRenderMaterial.uniforms.cameraFar.value=this.camera.far,this.copyMaterial=new c.ShaderMaterial({uniforms:c.UniformsUtils.clone(Jt.uniforms),vertexShader:Jt.vertexShader,fragmentShader:Jt.fragmentShader,transparent:!0,depthTest:!1,depthWrite:!1,blendSrc:c.SrcAlphaFactor,blendDst:c.OneMinusSrcAlphaFactor,blendEquation:c.AddEquation,blendSrcAlpha:c.SrcAlphaFactor,blendDstAlpha:c.OneMinusSrcAlphaFactor,blendEquationAlpha:c.AddEquation}),this.fsQuad=new As(null),this.originalClearColor=new c.Color}dispose(){this.beautyRenderTarget.dispose(),this.prevRenderTarget.dispose(),this.normalRenderTarget.dispose(),this.metalnessRenderTarget.dispose(),this.ssrRenderTarget.dispose(),this.blurRenderTarget.dispose(),this.blurRenderTarget2.dispose(),this.normalMaterial.dispose(),this.metalnessOnMaterial.dispose(),this.metalnessOffMaterial.dispose(),this.blurMaterial.dispose(),this.blurMaterial2.dispose(),this.copyMaterial.dispose(),this.depthRenderMaterial.dispose(),this.fsQuad.dispose()}render(t,e){switch(t.setRenderTarget(this.beautyRenderTarget),t.clear(),this.groundReflector&&(this.groundReflector.visible=!1,this.groundReflector.doRender(this.renderer,this.scene,this.camera),this.groundReflector.visible=!0),t.render(this.scene,this.camera),this.groundReflector&&(this.groundReflector.visible=!1),this.renderOverride(t,this.normalMaterial,this.normalRenderTarget,0,0),this.selective&&this.renderMetalness(t,this.metalnessOnMaterial,this.metalnessRenderTarget,0,0),this.ssrMaterial.uniforms.opacity.value=this.opacity,this.ssrMaterial.uniforms.maxDistance.value=this.maxDistance,this.ssrMaterial.uniforms.thickness.value=this.thickness,this.renderPass(t,this.ssrMaterial,this.ssrRenderTarget),this.blur&&(this.renderPass(t,this.blurMaterial,this.blurRenderTarget),this.renderPass(t,this.blurMaterial2,this.blurRenderTarget2)),this.output){case sr.OUTPUT.Default:this.bouncing?(this.copyMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.copyMaterial.blending=c.NoBlending,this.renderPass(t,this.copyMaterial,this.prevRenderTarget),this.blur?this.copyMaterial.uniforms.tDiffuse.value=this.blurRenderTarget2.texture:this.copyMaterial.uniforms.tDiffuse.value=this.ssrRenderTarget.texture,this.copyMaterial.blending=c.NormalBlending,this.renderPass(t,this.copyMaterial,this.prevRenderTarget),this.copyMaterial.uniforms.tDiffuse.value=this.prevRenderTarget.texture,this.copyMaterial.blending=c.NoBlending,this.renderPass(t,this.copyMaterial,this.renderToScreen?null:e)):(this.copyMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.copyMaterial.blending=c.NoBlending,this.renderPass(t,this.copyMaterial,this.renderToScreen?null:e),this.blur?this.copyMaterial.uniforms.tDiffuse.value=this.blurRenderTarget2.texture:this.copyMaterial.uniforms.tDiffuse.value=this.ssrRenderTarget.texture,this.copyMaterial.blending=c.NormalBlending,this.renderPass(t,this.copyMaterial,this.renderToScreen?null:e));break;case sr.OUTPUT.SSR:this.blur?this.copyMaterial.uniforms.tDiffuse.value=this.blurRenderTarget2.texture:this.copyMaterial.uniforms.tDiffuse.value=this.ssrRenderTarget.texture,this.copyMaterial.blending=c.NoBlending,this.renderPass(t,this.copyMaterial,this.renderToScreen?null:e),this.bouncing&&(this.blur?this.copyMaterial.uniforms.tDiffuse.value=this.blurRenderTarget2.texture:this.copyMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.copyMaterial.blending=c.NoBlending,this.renderPass(t,this.copyMaterial,this.prevRenderTarget),this.copyMaterial.uniforms.tDiffuse.value=this.ssrRenderTarget.texture,this.copyMaterial.blending=c.NormalBlending,this.renderPass(t,this.copyMaterial,this.prevRenderTarget));break;case sr.OUTPUT.Beauty:this.copyMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.copyMaterial.blending=c.NoBlending,this.renderPass(t,this.copyMaterial,this.renderToScreen?null:e);break;case sr.OUTPUT.Depth:this.renderPass(t,this.depthRenderMaterial,this.renderToScreen?null:e);break;case sr.OUTPUT.Normal:this.copyMaterial.uniforms.tDiffuse.value=this.normalRenderTarget.texture,this.copyMaterial.blending=c.NoBlending,this.renderPass(t,this.copyMaterial,this.renderToScreen?null:e);break;case sr.OUTPUT.Metalness:this.copyMaterial.uniforms.tDiffuse.value=this.metalnessRenderTarget.texture,this.copyMaterial.blending=c.NoBlending,this.renderPass(t,this.copyMaterial,this.renderToScreen?null:e);break;default:console.warn("THREE.SSRPass: Unknown output type.")}}renderPass(t,e,n,r,i){this.originalClearColor.copy(t.getClearColor(this.tempColor));const s=t.getClearAlpha(this.tempColor),a=t.autoClear;t.setRenderTarget(n),t.autoClear=!1,r!=null&&(t.setClearColor(r),t.setClearAlpha(i||0),t.clear()),this.fsQuad.material=e,this.fsQuad.render(t),t.autoClear=a,t.setClearColor(this.originalClearColor),t.setClearAlpha(s)}renderOverride(t,e,n,r,i){this.originalClearColor.copy(t.getClearColor(this.tempColor));const s=t.getClearAlpha(this.tempColor),a=t.autoClear;t.setRenderTarget(n),t.autoClear=!1,r=e.clearColor||r,i=e.clearAlpha||i,r!=null&&(t.setClearColor(r),t.setClearAlpha(i||0),t.clear()),this.scene.overrideMaterial=e,t.render(this.scene,this.camera),this.scene.overrideMaterial=null,t.autoClear=a,t.setClearColor(this.originalClearColor),t.setClearAlpha(s)}renderMetalness(t,e,n,r,i){this.originalClearColor.copy(t.getClearColor(this.tempColor));const s=t.getClearAlpha(this.tempColor),a=t.autoClear;t.setRenderTarget(n),t.autoClear=!1,r=e.clearColor||r,i=e.clearAlpha||i,r!=null&&(t.setClearColor(r),t.setClearAlpha(i||0),t.clear()),this.scene.traverseVisible(o=>{o._SSRPassBackupMaterial=o.material,this._selects.includes(o)?o.material=this.metalnessOnMaterial:o.material=this.metalnessOffMaterial}),t.render(this.scene,this.camera),this.scene.traverseVisible(o=>{o.material=o._SSRPassBackupMaterial}),t.autoClear=a,t.setClearColor(this.originalClearColor),t.setClearAlpha(s)}setSize(t,e){this.width=t,this.height=e,this.ssrMaterial.defines.MAX_STEP=Math.sqrt(t*t+e*e),this.ssrMaterial.needsUpdate=!0,this.beautyRenderTarget.setSize(t,e),this.prevRenderTarget.setSize(t,e),this.ssrRenderTarget.setSize(t,e),this.normalRenderTarget.setSize(t,e),this.metalnessRenderTarget.setSize(t,e),this.blurRenderTarget.setSize(t,e),this.blurRenderTarget2.setSize(t,e),this.ssrMaterial.uniforms.resolution.value.set(t,e),this.ssrMaterial.uniforms.cameraProjectionMatrix.value.copy(this.camera.projectionMatrix),this.ssrMaterial.uniforms.cameraInverseProjectionMatrix.value.copy(this.camera.projectionMatrixInverse),this.blurMaterial.uniforms.resolution.value.set(t,e),this.blurMaterial2.uniforms.resolution.value.set(t,e)}};M(sr,"OUTPUT",{Default:0,SSR:1,Beauty:3,Depth:4,Normal:5,Metalness:7});class X5 extends c.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(n){return new ep(n)}),this.register(function(n){return new lp(n)}),this.register(function(n){return new cp(n)}),this.register(function(n){return new hp(n)}),this.register(function(n){return new np(n)}),this.register(function(n){return new rp(n)}),this.register(function(n){return new ip(n)}),this.register(function(n){return new sp(n)}),this.register(function(n){return new $5(n)}),this.register(function(n){return new ap(n)}),this.register(function(n){return new tp(n)}),this.register(function(n){return new op(n)}),this.register(function(n){return new J5(n)}),this.register(function(n){return new up(n)}),this.register(function(n){return new Ap(n)})}load(e,n,r,i){const s=this;let a;this.resourcePath!==""?a=this.resourcePath:this.path!==""?a=this.path:a=c.LoaderUtils.extractUrlBase(e),this.manager.itemStart(e);const o=function(h){i?i(h):console.error(h),s.manager.itemError(e),s.manager.itemEnd(e)},l=new c.FileLoader(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(h){try{s.parse(h,a,function(u){n(u),s.manager.itemEnd(e)},o)}catch(u){o(u)}},r,o)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,n,r,i){let s;const a={},o={};if(typeof e=="string")s=JSON.parse(e);else if(e instanceof ArrayBuffer)if(c.LoaderUtils.decodeText(new Uint8Array(e.slice(0,4)))===U3){try{a[_e.KHR_BINARY_GLTF]=new fp(e)}catch(u){i&&i(u);return}s=JSON.parse(a[_e.KHR_BINARY_GLTF].content)}else s=JSON.parse(c.LoaderUtils.decodeText(new Uint8Array(e)));else s=e;if(s.asset===void 0||s.asset.version[0]<2){i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const l=new bp(s,{path:n||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let h=0;h<this.pluginCallbacks.length;h++){const u=this.pluginCallbacks[h](l);o[u.name]=u,a[u.name]=!0}if(s.extensionsUsed)for(let h=0;h<s.extensionsUsed.length;++h){const u=s.extensionsUsed[h],A=s.extensionsRequired||[];switch(u){case _e.KHR_MATERIALS_UNLIT:a[u]=new H5;break;case _e.KHR_DRACO_MESH_COMPRESSION:a[u]=new dp(s,this.dracoLoader);break;case _e.KHR_TEXTURE_TRANSFORM:a[u]=new pp;break;case _e.KHR_MESH_QUANTIZATION:a[u]=new gp;break;default:A.indexOf(u)>=0&&o[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}l.setExtensions(a),l.setPlugins(o),l.parse(r,i)}parseAsync(e,n){const r=this;return new Promise(function(i,s){r.parse(e,n,i,s)})}}function Z5(){let t={};return{get:function(e){return t[e]},add:function(e,n){t[e]=n},remove:function(e){delete t[e]},removeAll:function(){t={}}}}const _e={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class J5{constructor(e){this.parser=e,this.name=_e.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,n=this.parser.json.nodes||[];for(let r=0,i=n.length;r<i;r++){const s=n[r];s.extensions&&s.extensions[this.name]&&s.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,s.extensions[this.name].light)}}_loadLight(e){const n=this.parser,r="light:"+e;let i=n.cache.get(r);if(i)return i;const s=n.json,l=((s.extensions&&s.extensions[this.name]||{}).lights||[])[e];let h;const u=new c.Color(16777215);l.color!==void 0&&u.fromArray(l.color);const A=l.range!==void 0?l.range:0;switch(l.type){case"directional":h=new c.DirectionalLight(u),h.target.position.set(0,0,-1),h.add(h.target);break;case"point":h=new c.PointLight(u),h.distance=A;break;case"spot":h=new c.SpotLight(u),h.distance=A,l.spot=l.spot||{},l.spot.innerConeAngle=l.spot.innerConeAngle!==void 0?l.spot.innerConeAngle:0,l.spot.outerConeAngle=l.spot.outerConeAngle!==void 0?l.spot.outerConeAngle:Math.PI/4,h.angle=l.spot.outerConeAngle,h.penumbra=1-l.spot.innerConeAngle/l.spot.outerConeAngle,h.target.position.set(0,0,-1),h.add(h.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+l.type)}return h.position.set(0,0,0),h.decay=2,zn(h,l),l.intensity!==void 0&&(h.intensity=l.intensity),h.name=n.createUniqueName(l.name||"light_"+e),i=Promise.resolve(h),n.cache.add(r,i),i}getDependency(e,n){if(e==="light")return this._loadLight(n)}createNodeAttachment(e){const n=this,r=this.parser,s=r.json.nodes[e],o=(s.extensions&&s.extensions[this.name]||{}).light;return o===void 0?null:this._loadLight(o).then(function(l){return r._getNodeRef(n.cache,o,l)})}}class H5{constructor(){this.name=_e.KHR_MATERIALS_UNLIT}getMaterialType(){return c.MeshBasicMaterial}extendParams(e,n,r){const i=[];e.color=new c.Color(1,1,1),e.opacity=1;const s=n.pbrMetallicRoughness;if(s){if(Array.isArray(s.baseColorFactor)){const a=s.baseColorFactor;e.color.fromArray(a),e.opacity=a[3]}s.baseColorTexture!==void 0&&i.push(r.assignTexture(e,"map",s.baseColorTexture,3001))}return Promise.all(i)}}class $5{constructor(e){this.parser=e,this.name=_e.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,n){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=i.extensions[this.name].emissiveStrength;return s!==void 0&&(n.emissiveIntensity=s),Promise.resolve()}}class ep{constructor(e){this.parser=e,this.name=_e.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:c.MeshPhysicalMaterial}extendMaterialParams(e,n){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],a=i.extensions[this.name];if(a.clearcoatFactor!==void 0&&(n.clearcoat=a.clearcoatFactor),a.clearcoatTexture!==void 0&&s.push(r.assignTexture(n,"clearcoatMap",a.clearcoatTexture)),a.clearcoatRoughnessFactor!==void 0&&(n.clearcoatRoughness=a.clearcoatRoughnessFactor),a.clearcoatRoughnessTexture!==void 0&&s.push(r.assignTexture(n,"clearcoatRoughnessMap",a.clearcoatRoughnessTexture)),a.clearcoatNormalTexture!==void 0&&(s.push(r.assignTexture(n,"clearcoatNormalMap",a.clearcoatNormalTexture)),a.clearcoatNormalTexture.scale!==void 0)){const o=a.clearcoatNormalTexture.scale;n.clearcoatNormalScale=new c.Vector2(o,o)}return Promise.all(s)}}class tp{constructor(e){this.parser=e,this.name=_e.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:c.MeshPhysicalMaterial}extendMaterialParams(e,n){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],a=i.extensions[this.name];return a.iridescenceFactor!==void 0&&(n.iridescence=a.iridescenceFactor),a.iridescenceTexture!==void 0&&s.push(r.assignTexture(n,"iridescenceMap",a.iridescenceTexture)),a.iridescenceIor!==void 0&&(n.iridescenceIOR=a.iridescenceIor),n.iridescenceThicknessRange===void 0&&(n.iridescenceThicknessRange=[100,400]),a.iridescenceThicknessMinimum!==void 0&&(n.iridescenceThicknessRange[0]=a.iridescenceThicknessMinimum),a.iridescenceThicknessMaximum!==void 0&&(n.iridescenceThicknessRange[1]=a.iridescenceThicknessMaximum),a.iridescenceThicknessTexture!==void 0&&s.push(r.assignTexture(n,"iridescenceThicknessMap",a.iridescenceThicknessTexture)),Promise.all(s)}}class np{constructor(e){this.parser=e,this.name=_e.KHR_MATERIALS_SHEEN}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:c.MeshPhysicalMaterial}extendMaterialParams(e,n){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[];n.sheenColor=new c.Color(0,0,0),n.sheenRoughness=0,n.sheen=1;const a=i.extensions[this.name];return a.sheenColorFactor!==void 0&&n.sheenColor.fromArray(a.sheenColorFactor),a.sheenRoughnessFactor!==void 0&&(n.sheenRoughness=a.sheenRoughnessFactor),a.sheenColorTexture!==void 0&&s.push(r.assignTexture(n,"sheenColorMap",a.sheenColorTexture,3001)),a.sheenRoughnessTexture!==void 0&&s.push(r.assignTexture(n,"sheenRoughnessMap",a.sheenRoughnessTexture)),Promise.all(s)}}class rp{constructor(e){this.parser=e,this.name=_e.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:c.MeshPhysicalMaterial}extendMaterialParams(e,n){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],a=i.extensions[this.name];return a.transmissionFactor!==void 0&&(n.transmission=a.transmissionFactor),a.transmissionTexture!==void 0&&s.push(r.assignTexture(n,"transmissionMap",a.transmissionTexture)),Promise.all(s)}}class ip{constructor(e){this.parser=e,this.name=_e.KHR_MATERIALS_VOLUME}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:c.MeshPhysicalMaterial}extendMaterialParams(e,n){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],a=i.extensions[this.name];n.thickness=a.thicknessFactor!==void 0?a.thicknessFactor:0,a.thicknessTexture!==void 0&&s.push(r.assignTexture(n,"thicknessMap",a.thicknessTexture)),n.attenuationDistance=a.attenuationDistance||1/0;const o=a.attenuationColor||[1,1,1];return n.attenuationColor=new c.Color(o[0],o[1],o[2]),Promise.all(s)}}class sp{constructor(e){this.parser=e,this.name=_e.KHR_MATERIALS_IOR}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:c.MeshPhysicalMaterial}extendMaterialParams(e,n){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=i.extensions[this.name];return n.ior=s.ior!==void 0?s.ior:1.5,Promise.resolve()}}class ap{constructor(e){this.parser=e,this.name=_e.KHR_MATERIALS_SPECULAR}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:c.MeshPhysicalMaterial}extendMaterialParams(e,n){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],a=i.extensions[this.name];n.specularIntensity=a.specularFactor!==void 0?a.specularFactor:1,a.specularTexture!==void 0&&s.push(r.assignTexture(n,"specularIntensityMap",a.specularTexture));const o=a.specularColorFactor||[1,1,1];return n.specularColor=new c.Color(o[0],o[1],o[2]),a.specularColorTexture!==void 0&&s.push(r.assignTexture(n,"specularColorMap",a.specularColorTexture,3001)),Promise.all(s)}}class op{constructor(e){this.parser=e,this.name=_e.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:c.MeshPhysicalMaterial}extendMaterialParams(e,n){const r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const s=[],a=i.extensions[this.name];return a.anisotropyStrength!==void 0&&(n.anisotropy=a.anisotropyStrength),a.anisotropyRotation!==void 0&&(n.anisotropyRotation=a.anisotropyRotation),a.anisotropyTexture!==void 0&&s.push(r.assignTexture(n,"anisotropyMap",a.anisotropyTexture)),Promise.all(s)}}class lp{constructor(e){this.parser=e,this.name=_e.KHR_TEXTURE_BASISU}loadTexture(e){const n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[this.name])return null;const s=i.extensions[this.name],a=n.options.ktx2Loader;if(!a){if(r.extensionsRequired&&r.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return n.loadTextureImage(e,s.source,a)}}class cp{constructor(e){this.parser=e,this.name=_e.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const n=this.name,r=this.parser,i=r.json,s=i.textures[e];if(!s.extensions||!s.extensions[n])return null;const a=s.extensions[n],o=i.images[a.source];let l=r.textureLoader;if(o.uri){const h=r.options.manager.getHandler(o.uri);h!==null&&(l=h)}return this.detectSupport().then(function(h){if(h)return r.loadTextureImage(e,a.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(n)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const n=new Image;n.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",n.onload=n.onerror=function(){e(n.height===1)}})),this.isSupported}}class hp{constructor(e){this.parser=e,this.name=_e.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const n=this.name,r=this.parser,i=r.json,s=i.textures[e];if(!s.extensions||!s.extensions[n])return null;const a=s.extensions[n],o=i.images[a.source];let l=r.textureLoader;if(o.uri){const h=r.options.manager.getHandler(o.uri);h!==null&&(l=h)}return this.detectSupport().then(function(h){if(h)return r.loadTextureImage(e,a.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(n)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const n=new Image;n.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",n.onload=n.onerror=function(){e(n.height===1)}})),this.isSupported}}class up{constructor(e){this.name=_e.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const n=this.parser.json,r=n.bufferViews[e];if(r.extensions&&r.extensions[this.name]){const i=r.extensions[this.name],s=this.parser.getDependency("buffer",i.buffer),a=this.parser.options.meshoptDecoder;if(!a||!a.supported){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(o){const l=i.byteOffset||0,h=i.byteLength||0,u=i.count,A=i.byteStride,f=new Uint8Array(o,l,h);return a.decodeGltfBufferAsync?a.decodeGltfBufferAsync(u,A,f,i.mode,i.filter).then(function(d){return d.buffer}):a.ready.then(function(){const d=new ArrayBuffer(u*A);return a.decodeGltfBuffer(new Uint8Array(d),u,A,f,i.mode,i.filter),d})})}else return null}}class Ap{constructor(e){this.name=_e.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const n=this.parser.json,r=n.nodes[e];if(!r.extensions||!r.extensions[this.name]||r.mesh===void 0)return null;const i=n.meshes[r.mesh];for(const h of i.primitives)if(h.mode!==bt.TRIANGLES&&h.mode!==bt.TRIANGLE_STRIP&&h.mode!==bt.TRIANGLE_FAN&&h.mode!==void 0)return null;const a=r.extensions[this.name].attributes,o=[],l={};for(const h in a)o.push(this.parser.getDependency("accessor",a[h]).then(u=>(l[h]=u,l[h])));return o.length<1?null:(o.push(this.parser.createNodeMesh(e)),Promise.all(o).then(h=>{const u=h.pop(),A=u.isGroup?u.children:[u],f=h[0].count,d=[];for(const m of A){const y=new c.Matrix4,C=new c.Vector3,x=new c.Quaternion,I=new c.Vector3(1,1,1),g=new c.InstancedMesh(m.geometry,m.material,f);for(let v=0;v<f;v++)l.TRANSLATION&&C.fromBufferAttribute(l.TRANSLATION,v),l.ROTATION&&x.fromBufferAttribute(l.ROTATION,v),l.SCALE&&I.fromBufferAttribute(l.SCALE,v),g.setMatrixAt(v,y.compose(C,x,I));for(const v in l)v!=="TRANSLATION"&&v!=="ROTATION"&&v!=="SCALE"&&m.geometry.setAttribute(v,l[v]);c.Object3D.prototype.copy.call(g,m),this.parser.assignFinalMaterial(g),d.push(g)}return u.isGroup?(u.clear(),u.add(...d),u):d[0]}))}}const U3="glTF",li=12,Q3={JSON:1313821514,BIN:5130562};class fp{constructor(e){this.name=_e.KHR_BINARY_GLTF,this.content=null,this.body=null;const n=new DataView(e,0,li);if(this.header={magic:c.LoaderUtils.decodeText(new Uint8Array(e.slice(0,4))),version:n.getUint32(4,!0),length:n.getUint32(8,!0)},this.header.magic!==U3)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const r=this.header.length-li,i=new DataView(e,li);let s=0;for(;s<r;){const a=i.getUint32(s,!0);s+=4;const o=i.getUint32(s,!0);if(s+=4,o===Q3.JSON){const l=new Uint8Array(e,li+s,a);this.content=c.LoaderUtils.decodeText(l)}else if(o===Q3.BIN){const l=li+s;this.body=e.slice(l,l+a)}s+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class dp{constructor(e,n){if(!n)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=_e.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=n,this.dracoLoader.preload()}decodePrimitive(e,n){const r=this.json,i=this.dracoLoader,s=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,o={},l={},h={};for(const u in a){const A=mo[u]||u.toLowerCase();o[A]=a[u]}for(const u in e.attributes){const A=mo[u]||u.toLowerCase();if(a[u]!==void 0){const f=r.accessors[e.attributes[u]],d=Lr[f.componentType];h[A]=d.name,l[A]=f.normalized===!0}}return n.getDependency("bufferView",s).then(function(u){return new Promise(function(A){i.decodeDracoFile(u,function(f){for(const d in f.attributes){const m=f.attributes[d],y=l[d];y!==void 0&&(m.normalized=y)}A(f)},o,h)})})}}class pp{constructor(){this.name=_e.KHR_TEXTURE_TRANSFORM}extendTexture(e,n){return(n.texCoord===void 0||n.texCoord===e.channel)&&n.offset===void 0&&n.rotation===void 0&&n.scale===void 0||(e=e.clone(),n.texCoord!==void 0&&(e.channel=n.texCoord),n.offset!==void 0&&e.offset.fromArray(n.offset),n.rotation!==void 0&&(e.rotation=n.rotation),n.scale!==void 0&&e.repeat.fromArray(n.scale),e.needsUpdate=!0),e}}class gp{constructor(){this.name=_e.KHR_MESH_QUANTIZATION}}class N3 extends c.Interpolant{constructor(e,n,r,i){super(e,n,r,i)}copySampleValue_(e){const n=this.resultBuffer,r=this.sampleValues,i=this.valueSize,s=e*i*3+i;for(let a=0;a!==i;a++)n[a]=r[s+a];return n}interpolate_(e,n,r,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=o*2,h=o*3,u=i-n,A=(r-n)/u,f=A*A,d=f*A,m=e*h,y=m-h,C=-2*d+3*f,x=d-f,I=1-C,g=x-f+A;for(let v=0;v!==o;v++){const w=a[y+v+o],b=a[y+v+l]*u,B=a[m+v+o],_=a[m+v]*u;s[v]=I*w+g*b+C*B+x*_}return s}}const mp=new c.Quaternion;class vp extends N3{interpolate_(e,n,r,i){const s=super.interpolate_(e,n,r,i);return mp.fromArray(s).normalize().toArray(s),s}}const bt={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},Lr={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},G3={9728:c.NearestFilter,9729:c.LinearFilter,9984:c.NearestMipmapNearestFilter,9985:c.LinearMipmapNearestFilter,9986:c.NearestMipmapLinearFilter,9987:c.LinearMipmapLinearFilter},V3={33071:c.ClampToEdgeWrapping,33648:c.MirroredRepeatWrapping,10497:c.RepeatWrapping},go={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},mo={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",...c.REVISION.replace(/\D+/g,"")>=152?{TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3"}:{TEXCOORD_0:"uv",TEXCOORD_1:"uv2"},COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Vn={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},yp={CUBICSPLINE:void 0,LINEAR:c.InterpolateLinear,STEP:c.InterpolateDiscrete},vo={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function Cp(t){return t.DefaultMaterial===void 0&&(t.DefaultMaterial=new c.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:c.FrontSide})),t.DefaultMaterial}function ar(t,e,n){for(const r in n.extensions)t[r]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[r]=n.extensions[r])}function zn(t,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(t.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function Ip(t,e,n){let r=!1,i=!1,s=!1;for(let h=0,u=e.length;h<u;h++){const A=e[h];if(A.POSITION!==void 0&&(r=!0),A.NORMAL!==void 0&&(i=!0),A.COLOR_0!==void 0&&(s=!0),r&&i&&s)break}if(!r&&!i&&!s)return Promise.resolve(t);const a=[],o=[],l=[];for(let h=0,u=e.length;h<u;h++){const A=e[h];if(r){const f=A.POSITION!==void 0?n.getDependency("accessor",A.POSITION):t.attributes.position;a.push(f)}if(i){const f=A.NORMAL!==void 0?n.getDependency("accessor",A.NORMAL):t.attributes.normal;o.push(f)}if(s){const f=A.COLOR_0!==void 0?n.getDependency("accessor",A.COLOR_0):t.attributes.color;l.push(f)}}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(l)]).then(function(h){const u=h[0],A=h[1],f=h[2];return r&&(t.morphAttributes.position=u),i&&(t.morphAttributes.normal=A),s&&(t.morphAttributes.color=f),t.morphTargetsRelative=!0,t})}function xp(t,e){if(t.updateMorphTargets(),e.weights!==void 0)for(let n=0,r=e.weights.length;n<r;n++)t.morphTargetInfluences[n]=e.weights[n];if(e.extras&&Array.isArray(e.extras.targetNames)){const n=e.extras.targetNames;if(t.morphTargetInfluences.length===n.length){t.morphTargetDictionary={};for(let r=0,i=n.length;r<i;r++)t.morphTargetDictionary[n[r]]=r}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Sp(t){let e;const n=t.extensions&&t.extensions[_e.KHR_DRACO_MESH_COMPRESSION];if(n?e="draco:"+n.bufferView+":"+n.indices+":"+yo(n.attributes):e=t.indices+":"+yo(t.attributes)+":"+t.mode,t.targets!==void 0)for(let r=0,i=t.targets.length;r<i;r++)e+=":"+yo(t.targets[r]);return e}function yo(t){let e="";const n=Object.keys(t).sort();for(let r=0,i=n.length;r<i;r++)e+=n[r]+":"+t[n[r]]+";";return e}function Co(t){switch(t){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function Bp(t){return t.search(/\.jpe?g($|\?)/i)>0||t.search(/^data\:image\/jpeg/)===0?"image/jpeg":t.search(/\.webp($|\?)/i)>0||t.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const wp=new c.Matrix4;class bp{constructor(e={},n={}){this.json=e,this.extensions={},this.plugins={},this.options=n,this.cache=new Z5,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let r=!1,i=!1,s=-1;typeof navigator<"u"&&typeof navigator.userAgent<"u"&&(r=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,i=navigator.userAgent.indexOf("Firefox")>-1,s=i?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||r||i&&s<98?this.textureLoader=new c.TextureLoader(this.options.manager):this.textureLoader=new c.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new c.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,n){const r=this,i=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(a){return a._markDefs&&a._markDefs()}),Promise.all(this._invokeAll(function(a){return a.beforeRoot&&a.beforeRoot()})).then(function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])}).then(function(a){const o={scene:a[0][i.scene||0],scenes:a[0],animations:a[1],cameras:a[2],asset:i.asset,parser:r,userData:{}};ar(s,o,i),zn(o,i),Promise.all(r._invokeAll(function(l){return l.afterRoot&&l.afterRoot(o)})).then(function(){e(o)})}).catch(n)}_markDefs(){const e=this.json.nodes||[],n=this.json.skins||[],r=this.json.meshes||[];for(let i=0,s=n.length;i<s;i++){const a=n[i].joints;for(let o=0,l=a.length;o<l;o++)e[a[o]].isBone=!0}for(let i=0,s=e.length;i<s;i++){const a=e[i];a.mesh!==void 0&&(this._addNodeRef(this.meshCache,a.mesh),a.skin!==void 0&&(r[a.mesh].isSkinnedMesh=!0)),a.camera!==void 0&&this._addNodeRef(this.cameraCache,a.camera)}}_addNodeRef(e,n){n!==void 0&&(e.refs[n]===void 0&&(e.refs[n]=e.uses[n]=0),e.refs[n]++)}_getNodeRef(e,n,r){if(e.refs[n]<=1)return r;const i=r.clone(),s=(a,o)=>{const l=this.associations.get(a);l!=null&&this.associations.set(o,l);for(const[h,u]of a.children.entries())s(u,o.children[h])};return s(r,i),i.name+="_instance_"+e.uses[n]++,i}_invokeOne(e){const n=Object.values(this.plugins);n.push(this);for(let r=0;r<n.length;r++){const i=e(n[r]);if(i)return i}return null}_invokeAll(e){const n=Object.values(this.plugins);n.unshift(this);const r=[];for(let i=0;i<n.length;i++){const s=e(n[i]);s&&r.push(s)}return r}getDependency(e,n){const r=e+":"+n;let i=this.cache.get(r);if(!i){switch(e){case"scene":i=this.loadScene(n);break;case"node":i=this._invokeOne(function(s){return s.loadNode&&s.loadNode(n)});break;case"mesh":i=this._invokeOne(function(s){return s.loadMesh&&s.loadMesh(n)});break;case"accessor":i=this.loadAccessor(n);break;case"bufferView":i=this._invokeOne(function(s){return s.loadBufferView&&s.loadBufferView(n)});break;case"buffer":i=this.loadBuffer(n);break;case"material":i=this._invokeOne(function(s){return s.loadMaterial&&s.loadMaterial(n)});break;case"texture":i=this._invokeOne(function(s){return s.loadTexture&&s.loadTexture(n)});break;case"skin":i=this.loadSkin(n);break;case"animation":i=this._invokeOne(function(s){return s.loadAnimation&&s.loadAnimation(n)});break;case"camera":i=this.loadCamera(n);break;default:if(i=this._invokeOne(function(s){return s!=this&&s.getDependency&&s.getDependency(e,n)}),!i)throw new Error("Unknown type: "+e);break}this.cache.add(r,i)}return i}getDependencies(e){let n=this.cache.get(e);if(!n){const r=this,i=this.json[e+(e==="mesh"?"es":"s")]||[];n=Promise.all(i.map(function(s,a){return r.getDependency(e,a)})),this.cache.add(e,n)}return n}loadBuffer(e){const n=this.json.buffers[e],r=this.fileLoader;if(n.type&&n.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+n.type+" buffer type is not supported.");if(n.uri===void 0&&e===0)return Promise.resolve(this.extensions[_e.KHR_BINARY_GLTF].body);const i=this.options;return new Promise(function(s,a){r.load(c.LoaderUtils.resolveURL(n.uri,i.path),s,void 0,function(){a(new Error('THREE.GLTFLoader: Failed to load buffer "'+n.uri+'".'))})})}loadBufferView(e){const n=this.json.bufferViews[e];return this.getDependency("buffer",n.buffer).then(function(r){const i=n.byteLength||0,s=n.byteOffset||0;return r.slice(s,s+i)})}loadAccessor(e){const n=this,r=this.json,i=this.json.accessors[e];if(i.bufferView===void 0&&i.sparse===void 0){const a=go[i.type],o=Lr[i.componentType],l=i.normalized===!0,h=new o(i.count*a);return Promise.resolve(new c.BufferAttribute(h,a,l))}const s=[];return i.bufferView!==void 0?s.push(this.getDependency("bufferView",i.bufferView)):s.push(null),i.sparse!==void 0&&(s.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),s.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(s).then(function(a){const o=a[0],l=go[i.type],h=Lr[i.componentType],u=h.BYTES_PER_ELEMENT,A=u*l,f=i.byteOffset||0,d=i.bufferView!==void 0?r.bufferViews[i.bufferView].byteStride:void 0,m=i.normalized===!0;let y,C;if(d&&d!==A){const x=Math.floor(f/d),I="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+x+":"+i.count;let g=n.cache.get(I);g||(y=new h(o,x*d,i.count*d/u),g=new c.InterleavedBuffer(y,d/u),n.cache.add(I,g)),C=new c.InterleavedBufferAttribute(g,l,f%d/u,m)}else o===null?y=new h(i.count*l):y=new h(o,f,i.count*l),C=new c.BufferAttribute(y,l,m);if(i.sparse!==void 0){const x=go.SCALAR,I=Lr[i.sparse.indices.componentType],g=i.sparse.indices.byteOffset||0,v=i.sparse.values.byteOffset||0,w=new I(a[1],g,i.sparse.count*x),b=new h(a[2],v,i.sparse.count*l);o!==null&&(C=new c.BufferAttribute(C.array.slice(),C.itemSize,C.normalized));for(let B=0,_=w.length;B<_;B++){const E=w[B];if(C.setX(E,b[B*l]),l>=2&&C.setY(E,b[B*l+1]),l>=3&&C.setZ(E,b[B*l+2]),l>=4&&C.setW(E,b[B*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return C})}loadTexture(e){const n=this.json,r=this.options,s=n.textures[e].source,a=n.images[s];let o=this.textureLoader;if(a.uri){const l=r.manager.getHandler(a.uri);l!==null&&(o=l)}return this.loadTextureImage(e,s,o)}loadTextureImage(e,n,r){const i=this,s=this.json,a=s.textures[e],o=s.images[n],l=(o.uri||o.bufferView)+":"+a.sampler;if(this.textureCache[l])return this.textureCache[l];const h=this.loadImageSource(n,r).then(function(u){u.flipY=!1,u.name=a.name||o.name||"",u.name===""&&typeof o.uri=="string"&&o.uri.startsWith("data:image/")===!1&&(u.name=o.uri);const f=(s.samplers||{})[a.sampler]||{};return u.magFilter=G3[f.magFilter]||c.LinearFilter,u.minFilter=G3[f.minFilter]||c.LinearMipmapLinearFilter,u.wrapS=V3[f.wrapS]||c.RepeatWrapping,u.wrapT=V3[f.wrapT]||c.RepeatWrapping,i.associations.set(u,{textures:e}),u}).catch(function(){return null});return this.textureCache[l]=h,h}loadImageSource(e,n){const r=this,i=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(A=>A.clone());const a=i.images[e],o=self.URL||self.webkitURL;let l=a.uri||"",h=!1;if(a.bufferView!==void 0)l=r.getDependency("bufferView",a.bufferView).then(function(A){h=!0;const f=new Blob([A],{type:a.mimeType});return l=o.createObjectURL(f),l});else if(a.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const u=Promise.resolve(l).then(function(A){return new Promise(function(f,d){let m=f;n.isImageBitmapLoader===!0&&(m=function(y){const C=new c.Texture(y);C.needsUpdate=!0,f(C)}),n.load(c.LoaderUtils.resolveURL(A,s.path),m,void 0,d)})}).then(function(A){return h===!0&&o.revokeObjectURL(l),A.userData.mimeType=a.mimeType||Bp(a.uri),A}).catch(function(A){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),A});return this.sourceCache[e]=u,u}assignTexture(e,n,r,i){const s=this;return this.getDependency("texture",r.index).then(function(a){if(!a)return null;if(r.texCoord!==void 0&&r.texCoord>0&&(a=a.clone(),a.channel=r.texCoord),s.extensions[_e.KHR_TEXTURE_TRANSFORM]){const o=r.extensions!==void 0?r.extensions[_e.KHR_TEXTURE_TRANSFORM]:void 0;if(o){const l=s.associations.get(a);a=s.extensions[_e.KHR_TEXTURE_TRANSFORM].extendTexture(a,o),s.associations.set(a,l)}}return i!==void 0&&("colorSpace"in a?a.colorSpace=i===3001?"srgb":"srgb-linear":a.encoding=i),e[n]=a,a})}assignFinalMaterial(e){const n=e.geometry;let r=e.material;const i=n.attributes.tangent===void 0,s=n.attributes.color!==void 0,a=n.attributes.normal===void 0;if(e.isPoints){const o="PointsMaterial:"+r.uuid;let l=this.cache.get(o);l||(l=new c.PointsMaterial,c.Material.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,l.sizeAttenuation=!1,this.cache.add(o,l)),r=l}else if(e.isLine){const o="LineBasicMaterial:"+r.uuid;let l=this.cache.get(o);l||(l=new c.LineBasicMaterial,c.Material.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,this.cache.add(o,l)),r=l}if(i||s||a){let o="ClonedMaterial:"+r.uuid+":";i&&(o+="derivative-tangents:"),s&&(o+="vertex-colors:"),a&&(o+="flat-shading:");let l=this.cache.get(o);l||(l=r.clone(),s&&(l.vertexColors=!0),a&&(l.flatShading=!0),i&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(o,l),this.associations.set(l,this.associations.get(r))),r=l}e.material=r}getMaterialType(){return c.MeshStandardMaterial}loadMaterial(e){const n=this,r=this.json,i=this.extensions,s=r.materials[e];let a;const o={},l=s.extensions||{},h=[];if(l[_e.KHR_MATERIALS_UNLIT]){const A=i[_e.KHR_MATERIALS_UNLIT];a=A.getMaterialType(),h.push(A.extendParams(o,s,n))}else{const A=s.pbrMetallicRoughness||{};if(o.color=new c.Color(1,1,1),o.opacity=1,Array.isArray(A.baseColorFactor)){const f=A.baseColorFactor;o.color.fromArray(f),o.opacity=f[3]}A.baseColorTexture!==void 0&&h.push(n.assignTexture(o,"map",A.baseColorTexture,3001)),o.metalness=A.metallicFactor!==void 0?A.metallicFactor:1,o.roughness=A.roughnessFactor!==void 0?A.roughnessFactor:1,A.metallicRoughnessTexture!==void 0&&(h.push(n.assignTexture(o,"metalnessMap",A.metallicRoughnessTexture)),h.push(n.assignTexture(o,"roughnessMap",A.metallicRoughnessTexture))),a=this._invokeOne(function(f){return f.getMaterialType&&f.getMaterialType(e)}),h.push(Promise.all(this._invokeAll(function(f){return f.extendMaterialParams&&f.extendMaterialParams(e,o)})))}s.doubleSided===!0&&(o.side=c.DoubleSide);const u=s.alphaMode||vo.OPAQUE;if(u===vo.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,u===vo.MASK&&(o.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&a!==c.MeshBasicMaterial&&(h.push(n.assignTexture(o,"normalMap",s.normalTexture)),o.normalScale=new c.Vector2(1,1),s.normalTexture.scale!==void 0)){const A=s.normalTexture.scale;o.normalScale.set(A,A)}return s.occlusionTexture!==void 0&&a!==c.MeshBasicMaterial&&(h.push(n.assignTexture(o,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&a!==c.MeshBasicMaterial&&(o.emissive=new c.Color().fromArray(s.emissiveFactor)),s.emissiveTexture!==void 0&&a!==c.MeshBasicMaterial&&h.push(n.assignTexture(o,"emissiveMap",s.emissiveTexture,3001)),Promise.all(h).then(function(){const A=new a(o);return s.name&&(A.name=s.name),zn(A,s),n.associations.set(A,{materials:e}),s.extensions&&ar(i,A,s),A})}createUniqueName(e){const n=c.PropertyBinding.sanitizeNodeName(e||"");return n in this.nodeNamesUsed?n+"_"+ ++this.nodeNamesUsed[n]:(this.nodeNamesUsed[n]=0,n)}loadGeometries(e){const n=this,r=this.extensions,i=this.primitiveCache;function s(o){return r[_e.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(o,n).then(function(l){return z3(l,o,n)})}const a=[];for(let o=0,l=e.length;o<l;o++){const h=e[o],u=Sp(h),A=i[u];if(A)a.push(A.promise);else{let f;h.extensions&&h.extensions[_e.KHR_DRACO_MESH_COMPRESSION]?f=s(h):f=z3(new c.BufferGeometry,h,n),i[u]={primitive:h,promise:f},a.push(f)}}return Promise.all(a)}loadMesh(e){const n=this,r=this.json,i=this.extensions,s=r.meshes[e],a=s.primitives,o=[];for(let l=0,h=a.length;l<h;l++){const u=a[l].material===void 0?Cp(this.cache):this.getDependency("material",a[l].material);o.push(u)}return o.push(n.loadGeometries(a)),Promise.all(o).then(function(l){const h=l.slice(0,l.length-1),u=l[l.length-1],A=[];for(let d=0,m=u.length;d<m;d++){const y=u[d],C=a[d];let x;const I=h[d];if(C.mode===bt.TRIANGLES||C.mode===bt.TRIANGLE_STRIP||C.mode===bt.TRIANGLE_FAN||C.mode===void 0)x=s.isSkinnedMesh===!0?new c.SkinnedMesh(y,I):new c.Mesh(y,I),x.isSkinnedMesh===!0&&x.normalizeSkinWeights(),C.mode===bt.TRIANGLE_STRIP?x.geometry=w3(x.geometry,c.TriangleStripDrawMode):C.mode===bt.TRIANGLE_FAN&&(x.geometry=w3(x.geometry,c.TriangleFanDrawMode));else if(C.mode===bt.LINES)x=new c.LineSegments(y,I);else if(C.mode===bt.LINE_STRIP)x=new c.Line(y,I);else if(C.mode===bt.LINE_LOOP)x=new c.LineLoop(y,I);else if(C.mode===bt.POINTS)x=new c.Points(y,I);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+C.mode);Object.keys(x.geometry.morphAttributes).length>0&&xp(x,s),x.name=n.createUniqueName(s.name||"mesh_"+e),zn(x,s),C.extensions&&ar(i,x,C),n.assignFinalMaterial(x),A.push(x)}for(let d=0,m=A.length;d<m;d++)n.associations.set(A[d],{meshes:e,primitives:d});if(A.length===1)return s.extensions&&ar(i,A[0],s),A[0];const f=new c.Group;s.extensions&&ar(i,f,s),n.associations.set(f,{meshes:e});for(let d=0,m=A.length;d<m;d++)f.add(A[d]);return f})}loadCamera(e){let n;const r=this.json.cameras[e],i=r[r.type];if(!i){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return r.type==="perspective"?n=new c.PerspectiveCamera(c.MathUtils.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):r.type==="orthographic"&&(n=new c.OrthographicCamera(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),r.name&&(n.name=this.createUniqueName(r.name)),zn(n,r),Promise.resolve(n)}loadSkin(e){const n=this.json.skins[e],r=[];for(let i=0,s=n.joints.length;i<s;i++)r.push(this._loadNodeShallow(n.joints[i]));return n.inverseBindMatrices!==void 0?r.push(this.getDependency("accessor",n.inverseBindMatrices)):r.push(null),Promise.all(r).then(function(i){const s=i.pop(),a=i,o=[],l=[];for(let h=0,u=a.length;h<u;h++){const A=a[h];if(A){o.push(A);const f=new c.Matrix4;s!==null&&f.fromArray(s.array,h*16),l.push(f)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',n.joints[h])}return new c.Skeleton(o,l)})}loadAnimation(e){const r=this.json.animations[e],i=r.name?r.name:"animation_"+e,s=[],a=[],o=[],l=[],h=[];for(let u=0,A=r.channels.length;u<A;u++){const f=r.channels[u],d=r.samplers[f.sampler],m=f.target,y=m.node,C=r.parameters!==void 0?r.parameters[d.input]:d.input,x=r.parameters!==void 0?r.parameters[d.output]:d.output;m.node!==void 0&&(s.push(this.getDependency("node",y)),a.push(this.getDependency("accessor",C)),o.push(this.getDependency("accessor",x)),l.push(d),h.push(m))}return Promise.all([Promise.all(s),Promise.all(a),Promise.all(o),Promise.all(l),Promise.all(h)]).then(function(u){const A=u[0],f=u[1],d=u[2],m=u[3],y=u[4],C=[];for(let x=0,I=A.length;x<I;x++){const g=A[x],v=f[x],w=d[x],b=m[x],B=y[x];if(g===void 0)continue;g.updateMatrix();let _;switch(Vn[B.path]){case Vn.weights:_=c.NumberKeyframeTrack;break;case Vn.rotation:_=c.QuaternionKeyframeTrack;break;case Vn.position:case Vn.scale:default:_=c.VectorKeyframeTrack;break}const E=g.name?g.name:g.uuid,T=b.interpolation!==void 0?yp[b.interpolation]:c.InterpolateLinear,L=[];Vn[B.path]===Vn.weights?g.traverse(function(V){V.morphTargetInfluences&&L.push(V.name?V.name:V.uuid)}):L.push(E);let R=w.array;if(w.normalized){const V=Co(R.constructor),Y=new Float32Array(R.length);for(let q=0,ne=R.length;q<ne;q++)Y[q]=R[q]*V;R=Y}for(let V=0,Y=L.length;V<Y;V++){const q=new _(L[V]+"."+Vn[B.path],v.array,R,T);b.interpolation==="CUBICSPLINE"&&(q.createInterpolant=function(X){const G=this instanceof c.QuaternionKeyframeTrack?vp:N3;return new G(this.times,this.values,this.getValueSize()/3,X)},q.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),C.push(q)}}return new c.AnimationClip(i,void 0,C)})}createNodeMesh(e){const n=this.json,r=this,i=n.nodes[e];return i.mesh===void 0?null:r.getDependency("mesh",i.mesh).then(function(s){const a=r._getNodeRef(r.meshCache,i.mesh,s);return i.weights!==void 0&&a.traverse(function(o){if(o.isMesh)for(let l=0,h=i.weights.length;l<h;l++)o.morphTargetInfluences[l]=i.weights[l]}),a})}loadNode(e){const n=this.json,r=this,i=n.nodes[e],s=r._loadNodeShallow(e),a=[],o=i.children||[];for(let h=0,u=o.length;h<u;h++)a.push(r.getDependency("node",o[h]));const l=i.skin===void 0?Promise.resolve(null):r.getDependency("skin",i.skin);return Promise.all([s,Promise.all(a),l]).then(function(h){const u=h[0],A=h[1],f=h[2];f!==null&&u.traverse(function(d){d.isSkinnedMesh&&d.bind(f,wp)});for(let d=0,m=A.length;d<m;d++)u.add(A[d]);return u})}_loadNodeShallow(e){const n=this.json,r=this.extensions,i=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const s=n.nodes[e],a=s.name?i.createUniqueName(s.name):"",o=[],l=i._invokeOne(function(h){return h.createNodeMesh&&h.createNodeMesh(e)});return l&&o.push(l),s.camera!==void 0&&o.push(i.getDependency("camera",s.camera).then(function(h){return i._getNodeRef(i.cameraCache,s.camera,h)})),i._invokeAll(function(h){return h.createNodeAttachment&&h.createNodeAttachment(e)}).forEach(function(h){o.push(h)}),this.nodeCache[e]=Promise.all(o).then(function(h){let u;if(s.isBone===!0?u=new c.Bone:h.length>1?u=new c.Group:h.length===1?u=h[0]:u=new c.Object3D,u!==h[0])for(let A=0,f=h.length;A<f;A++)u.add(h[A]);if(s.name&&(u.userData.name=s.name,u.name=a),zn(u,s),s.extensions&&ar(r,u,s),s.matrix!==void 0){const A=new c.Matrix4;A.fromArray(s.matrix),u.applyMatrix4(A)}else s.translation!==void 0&&u.position.fromArray(s.translation),s.rotation!==void 0&&u.quaternion.fromArray(s.rotation),s.scale!==void 0&&u.scale.fromArray(s.scale);return i.associations.has(u)||i.associations.set(u,{}),i.associations.get(u).nodes=e,u}),this.nodeCache[e]}loadScene(e){const n=this.extensions,r=this.json.scenes[e],i=this,s=new c.Group;r.name&&(s.name=i.createUniqueName(r.name)),zn(s,r),r.extensions&&ar(n,s,r);const a=r.nodes||[],o=[];for(let l=0,h=a.length;l<h;l++)o.push(i.getDependency("node",a[l]));return Promise.all(o).then(function(l){for(let u=0,A=l.length;u<A;u++)s.add(l[u]);const h=u=>{const A=new Map;for(const[f,d]of i.associations)(f instanceof c.Material||f instanceof c.Texture)&&A.set(f,d);return u.traverse(f=>{const d=i.associations.get(f);d!=null&&A.set(f,d)}),A};return i.associations=h(s),s})}}function _p(t,e,n){const r=e.attributes,i=new c.Box3;if(r.POSITION!==void 0){const o=n.json.accessors[r.POSITION],l=o.min,h=o.max;if(l!==void 0&&h!==void 0){if(i.set(new c.Vector3(l[0],l[1],l[2]),new c.Vector3(h[0],h[1],h[2])),o.normalized){const u=Co(Lr[o.componentType]);i.min.multiplyScalar(u),i.max.multiplyScalar(u)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const s=e.targets;if(s!==void 0){const o=new c.Vector3,l=new c.Vector3;for(let h=0,u=s.length;h<u;h++){const A=s[h];if(A.POSITION!==void 0){const f=n.json.accessors[A.POSITION],d=f.min,m=f.max;if(d!==void 0&&m!==void 0){if(l.setX(Math.max(Math.abs(d[0]),Math.abs(m[0]))),l.setY(Math.max(Math.abs(d[1]),Math.abs(m[1]))),l.setZ(Math.max(Math.abs(d[2]),Math.abs(m[2]))),f.normalized){const y=Co(Lr[f.componentType]);l.multiplyScalar(y)}o.max(l)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}i.expandByVector(o)}t.boundingBox=i;const a=new c.Sphere;i.getCenter(a.center),a.radius=i.min.distanceTo(i.max)/2,t.boundingSphere=a}function z3(t,e,n){const r=e.attributes,i=[];function s(a,o){return n.getDependency("accessor",a).then(function(l){t.setAttribute(o,l)})}for(const a in r){const o=mo[a]||a.toLowerCase();o in t.attributes||i.push(s(r[a],o))}if(e.indices!==void 0&&!t.index){const a=n.getDependency("accessor",e.indices).then(function(o){t.setIndex(o)});i.push(a)}return zn(t,e),_p(t,e,n),Promise.all(i).then(function(){return e.targets!==void 0?Ip(t,e.targets,n):t})}const Io=class{static createButton(t,e={}){const n=document.createElement("button");function r(){let o=null;async function l(u){u.addEventListener("end",h),await t.xr.setSession(u),n.textContent="EXIT VR",o=u}function h(){o.removeEventListener("end",h),n.textContent="ENTER VR",o=null}n.style.display="",n.style.cursor="pointer",n.style.left="calc(50% - 50px)",n.style.width="100px",n.textContent="ENTER VR",n.onmouseenter=()=>{n.style.opacity="1.0"},n.onmouseleave=()=>{n.style.opacity="0.5"},n.onclick=()=>{var u;if(o===null){const A=[e.optionalFeatures,"local-floor","bounded-floor","hand-tracking"].flat().filter(Boolean);(u=navigator.xr)==null||u.requestSession("immersive-vr",{...e,optionalFeatures:A}).then(l)}else o.end()}}function i(){n.style.display="",n.style.cursor="auto",n.style.left="calc(50% - 75px)",n.style.width="150px",n.onmouseenter=null,n.onmouseleave=null,n.onclick=null}function s(){i(),n.textContent="VR NOT SUPPORTED"}function a(o){o.style.position="absolute",o.style.bottom="20px",o.style.padding="12px 6px",o.style.border="1px solid #fff",o.style.borderRadius="4px",o.style.background="rgba(0,0,0,0.1)",o.style.color="#fff",o.style.font="normal 13px sans-serif",o.style.textAlign="center",o.style.opacity="0.5",o.style.outline="none",o.style.zIndex="999"}if("xr"in navigator)return a(n),n.id="VRButton",n.style.display="none",navigator.xr.isSessionSupported("immersive-vr").then(o=>{o?r():s(),o&&Io.xrSessionIsGranted&&n.click()}),n;{const o=document.createElement("a");return window.isSecureContext===!1?(o.href=document.location.href.replace(/^http:/,"https:"),o.innerHTML="WEBXR NEEDS HTTPS"):(o.href="https://immersiveweb.dev/",o.innerHTML="WEBXR NOT AVAILABLE"),o.style.left="calc(50% - 90px)",o.style.width="180px",o.style.textDecoration="none",a(o),o}}static registerSessionGrantedListener(){"xr"in navigator&&navigator.xr.addEventListener("sessiongranted",()=>{Io.xrSessionIsGranted=!0})}};M(Io,"xrSessionIsGranted",!1);class W3 extends c.ExtrudeGeometry{constructor(e,n={}){const{bevelEnabled:r=!1,bevelSize:i=8,bevelThickness:s=10,font:a,height:o=50,size:l=100,lineHeight:h=1,letterSpacing:u=0,...A}=n;if(a===void 0)super();else{const f=a.generateShapes(e,l,{lineHeight:h,letterSpacing:u});super(f,{...A,bevelEnabled:r,bevelSize:i,bevelThickness:s,depth:o})}this.type="TextGeometry"}}const Ep={uniforms:{tDiffuse:{value:null},h:{value:1/512}},vertexShader:`
|
|
859
|
+
varying vec2 vUv;
|
|
860
|
+
|
|
861
|
+
void main() {
|
|
862
|
+
|
|
863
|
+
vUv = uv;
|
|
864
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
865
|
+
|
|
866
|
+
}
|
|
867
|
+
`,fragmentShader:`
|
|
868
|
+
uniform sampler2D tDiffuse;
|
|
869
|
+
uniform float h;
|
|
870
|
+
|
|
871
|
+
varying vec2 vUv;
|
|
872
|
+
|
|
873
|
+
void main() {
|
|
874
|
+
|
|
875
|
+
vec4 sum = vec4( 0.0 );
|
|
876
|
+
|
|
877
|
+
sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;
|
|
878
|
+
sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;
|
|
879
|
+
sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;
|
|
880
|
+
sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;
|
|
881
|
+
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;
|
|
882
|
+
sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;
|
|
883
|
+
sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;
|
|
884
|
+
sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;
|
|
885
|
+
sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;
|
|
886
|
+
|
|
887
|
+
gl_FragColor = sum;
|
|
888
|
+
|
|
889
|
+
}
|
|
890
|
+
`},Tp={uniforms:{tDiffuse:{value:null},v:{value:1/512}},vertexShader:`
|
|
891
|
+
varying vec2 vUv;
|
|
892
|
+
|
|
893
|
+
void main() {
|
|
894
|
+
|
|
895
|
+
vUv = uv;
|
|
896
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
897
|
+
|
|
898
|
+
}
|
|
899
|
+
`,fragmentShader:`
|
|
900
|
+
|
|
901
|
+
uniform sampler2D tDiffuse;
|
|
902
|
+
uniform float v;
|
|
903
|
+
|
|
904
|
+
varying vec2 vUv;
|
|
905
|
+
|
|
906
|
+
void main() {
|
|
907
|
+
|
|
908
|
+
vec4 sum = vec4( 0.0 );
|
|
909
|
+
|
|
910
|
+
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;
|
|
911
|
+
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;
|
|
912
|
+
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;
|
|
913
|
+
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;
|
|
914
|
+
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;
|
|
915
|
+
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;
|
|
916
|
+
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;
|
|
917
|
+
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;
|
|
918
|
+
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;
|
|
919
|
+
|
|
920
|
+
gl_FragColor = sum;
|
|
921
|
+
|
|
922
|
+
}
|
|
923
|
+
`};function Y3(t,e,n){const r=n.length-t-1;if(e>=n[r])return r-1;if(e<=n[t])return t;let i=t,s=r,a=Math.floor((i+s)/2);for(;e<n[a]||e>=n[a+1];)e<n[a]?s=a:i=a,a=Math.floor((i+s)/2);return a}function Mp(t,e,n,r){const i=[],s=[],a=[];i[0]=1;for(let o=1;o<=n;++o){s[o]=e-r[t+1-o],a[o]=r[t+o]-e;let l=0;for(let h=0;h<o;++h){const u=a[h+1],A=s[o-h],f=i[h]/(u+A);i[h]=l+u*f,l=A*f}i[o]=l}return i}function Dp(t,e,n,r){const i=Y3(t,r,e),s=Mp(i,r,t,e),a=new c.Vector4(0,0,0,0);for(let o=0;o<=t;++o){const l=n[i-t+o],h=s[o],u=l.w*h;a.x+=l.x*u,a.y+=l.y*u,a.z+=l.z*u,a.w+=l.w*h}return a}function Lp(t,e,n,r,i){const s=[];for(let A=0;A<=n;++A)s[A]=0;const a=[];for(let A=0;A<=r;++A)a[A]=s.slice(0);const o=[];for(let A=0;A<=n;++A)o[A]=s.slice(0);o[0][0]=1;const l=s.slice(0),h=s.slice(0);for(let A=1;A<=n;++A){l[A]=e-i[t+1-A],h[A]=i[t+A]-e;let f=0;for(let d=0;d<A;++d){const m=h[d+1],y=l[A-d];o[A][d]=m+y;const C=o[d][A-1]/o[A][d];o[d][A]=f+m*C,f=y*C}o[A][A]=f}for(let A=0;A<=n;++A)a[0][A]=o[A][n];for(let A=0;A<=n;++A){let f=0,d=1;const m=[];for(let y=0;y<=n;++y)m[y]=s.slice(0);m[0][0]=1;for(let y=1;y<=r;++y){let C=0;const x=A-y,I=n-y;A>=y&&(m[d][0]=m[f][0]/o[I+1][x],C=m[d][0]*o[x][I]);const g=x>=-1?1:-x,v=A-1<=I?y-1:n-A;for(let b=g;b<=v;++b)m[d][b]=(m[f][b]-m[f][b-1])/o[I+1][x+b],C+=m[d][b]*o[x+b][I];A<=I&&(m[d][y]=-m[f][y-1]/o[I+1][A],C+=m[d][y]*o[A][I]),a[y][A]=C;const w=f;f=d,d=w}}let u=n;for(let A=1;A<=r;++A){for(let f=0;f<=n;++f)a[A][f]*=u;u*=n-A}return a}function Pp(t,e,n,r,i){const s=i<t?i:t,a=[],o=Y3(t,r,e),l=Lp(o,r,t,s,e),h=[];for(let u=0;u<n.length;++u){const A=n[u].clone(),f=A.w;A.x*=f,A.y*=f,A.z*=f,h[u]=A}for(let u=0;u<=s;++u){const A=h[o-t].clone().multiplyScalar(l[u][0]);for(let f=1;f<=t;++f)A.add(h[o-t+f].clone().multiplyScalar(l[u][f]));a[u]=A}for(let u=s+1;u<=i+1;++u)a[u]=new c.Vector4(0,0,0);return a}function Fp(t,e){let n=1;for(let i=2;i<=t;++i)n*=i;let r=1;for(let i=2;i<=e;++i)r*=i;for(let i=2;i<=t-e;++i)r*=i;return n/r}function kp(t){const e=t.length,n=[],r=[];for(let s=0;s<e;++s){const a=t[s];n[s]=new c.Vector3(a.x,a.y,a.z),r[s]=a.w}const i=[];for(let s=0;s<e;++s){const a=n[s].clone();for(let o=1;o<=s;++o)a.sub(i[s-o].clone().multiplyScalar(Fp(s,o)*r[o]));i[s]=a.divideScalar(r[0])}return i}function Op(t,e,n,r,i){const s=Pp(t,e,n,r,i);return kp(s)}class j3 extends c.Curve{constructor(e,n,r,i,s){super(),this.degree=e,this.knots=n,this.controlPoints=[],this.startKnot=i||0,this.endKnot=s||this.knots.length-1;for(let a=0;a<r.length;++a){const o=r[a];this.controlPoints[a]=new c.Vector4(o.x,o.y,o.z,o.w)}}getPoint(e,n){const r=n||new c.Vector3,i=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),s=Dp(this.degree,this.knots,this.controlPoints,i);return s.w!=1&&s.divideScalar(s.w),r.set(s.x,s.y,s.z)}getTangent(e,n){const r=n||new c.Vector3,i=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),s=Op(this.degree,this.knots,this.controlPoints,i,1);return r.copy(s[1]).normalize(),r}}let we,je,At;class Rp extends c.Loader{constructor(e){super(e)}load(e,n,r,i){const s=this,a=s.path===""?c.LoaderUtils.extractUrlBase(e):s.path,o=new c.FileLoader(this.manager);o.setPath(s.path),o.setResponseType("arraybuffer"),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(l){try{n(s.parse(l,a))}catch(h){i?i(h):console.error(h),s.manager.itemError(e)}},r,i)}parse(e,n){if(zp(e))we=new Vp().parse(e);else{const i=H3(e);if(!Wp(i))throw new Error("THREE.FBXLoader: Unknown format.");if(X3(i)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+X3(i));we=new Gp().parse(i)}const r=new c.TextureLoader(this.manager).setPath(this.resourcePath||n).setCrossOrigin(this.crossOrigin);return new Up(r,this.manager).parse(we)}}class Up{constructor(e,n){this.textureLoader=e,this.manager=n}parse(){je=this.parseConnections();const e=this.parseImages(),n=this.parseTextures(e),r=this.parseMaterials(n),i=this.parseDeformers(),s=new Qp().parse(i);return this.parseScene(i,s,r),At}parseConnections(){const e=new Map;return"Connections"in we&&we.Connections.connections.forEach(function(r){const i=r[0],s=r[1],a=r[2];e.has(i)||e.set(i,{parents:[],children:[]});const o={ID:s,relationship:a};e.get(i).parents.push(o),e.has(s)||e.set(s,{parents:[],children:[]});const l={ID:i,relationship:a};e.get(s).children.push(l)}),e}parseImages(){const e={},n={};if("Video"in we.Objects){const r=we.Objects.Video;for(const i in r){const s=r[i],a=parseInt(i);if(e[a]=s.RelativeFilename||s.Filename,"Content"in s){const o=s.Content instanceof ArrayBuffer&&s.Content.byteLength>0,l=typeof s.Content=="string"&&s.Content!=="";if(o||l){const h=this.parseImage(r[i]);n[s.RelativeFilename||s.Filename]=h}}}}for(const r in e){const i=e[r];n[i]!==void 0?e[r]=n[i]:e[r]=e[r].split("\\").pop()}return e}parseImage(e){const n=e.Content,r=e.RelativeFilename||e.Filename,i=r.slice(r.lastIndexOf(".")+1).toLowerCase();let s;switch(i){case"bmp":s="image/bmp";break;case"jpg":case"jpeg":s="image/jpeg";break;case"png":s="image/png";break;case"tif":s="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",r),s="image/tga";break;default:console.warn('FBXLoader: Image type "'+i+'" is not supported.');return}if(typeof n=="string")return"data:"+s+";base64,"+n;{const a=new Uint8Array(n);return window.URL.createObjectURL(new Blob([a],{type:s}))}}parseTextures(e){const n=new Map;if("Texture"in we.Objects){const r=we.Objects.Texture;for(const i in r){const s=this.parseTexture(r[i],e);n.set(parseInt(i),s)}}return n}parseTexture(e,n){const r=this.loadTexture(e,n);r.ID=e.id,r.name=e.attrName;const i=e.WrapModeU,s=e.WrapModeV,a=i!==void 0?i.value:0,o=s!==void 0?s.value:0;if(r.wrapS=a===0?c.RepeatWrapping:c.ClampToEdgeWrapping,r.wrapT=o===0?c.RepeatWrapping:c.ClampToEdgeWrapping,"Scaling"in e){const l=e.Scaling.value;r.repeat.x=l[0],r.repeat.y=l[1]}return r}loadTexture(e,n){let r;const i=this.textureLoader.path,s=je.get(e.id).children;s!==void 0&&s.length>0&&n[s[0].ID]!==void 0&&(r=n[s[0].ID],(r.indexOf("blob:")===0||r.indexOf("data:")===0)&&this.textureLoader.setPath(void 0));let a;const o=e.FileName.slice(-3).toLowerCase();if(o==="tga"){const l=this.manager.getHandler(".tga");l===null?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),a=new c.Texture):(l.setPath(this.textureLoader.path),a=l.load(r))}else o==="psd"?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),a=new c.Texture):a=this.textureLoader.load(r);return this.textureLoader.setPath(i),a}parseMaterials(e){const n=new Map;if("Material"in we.Objects){const r=we.Objects.Material;for(const i in r){const s=this.parseMaterial(r[i],e);s!==null&&n.set(parseInt(i),s)}}return n}parseMaterial(e,n){const r=e.id,i=e.attrName;let s=e.ShadingModel;if(typeof s=="object"&&(s=s.value),!je.has(r))return null;const a=this.parseParameters(e,n,r);let o;switch(s.toLowerCase()){case"phong":o=new c.MeshPhongMaterial;break;case"lambert":o=new c.MeshLambertMaterial;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',s),o=new c.MeshPhongMaterial;break}return o.setValues(a),o.name=i,o}parseParameters(e,n,r){const i={};e.BumpFactor&&(i.bumpScale=e.BumpFactor.value),e.Diffuse?i.color=new c.Color().fromArray(e.Diffuse.value):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(i.color=new c.Color().fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(i.displacementScale=e.DisplacementFactor.value),e.Emissive?i.emissive=new c.Color().fromArray(e.Emissive.value):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(i.emissive=new c.Color().fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(i.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(i.opacity=parseFloat(e.Opacity.value)),i.opacity<1&&(i.transparent=!0),e.ReflectionFactor&&(i.reflectivity=e.ReflectionFactor.value),e.Shininess&&(i.shininess=e.Shininess.value),e.Specular?i.specular=new c.Color().fromArray(e.Specular.value):e.SpecularColor&&e.SpecularColor.type==="Color"&&(i.specular=new c.Color().fromArray(e.SpecularColor.value));const s=this;return je.get(r).children.forEach(function(a){const o=a.relationship;switch(o){case"Bump":i.bumpMap=s.getTexture(n,a.ID);break;case"Maya|TEX_ao_map":i.aoMap=s.getTexture(n,a.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":i.map=s.getTexture(n,a.ID),i.map!==void 0&&("colorSpace"in i.map?i.map.colorSpace="srgb":i.map.encoding=3001);break;case"DisplacementColor":i.displacementMap=s.getTexture(n,a.ID);break;case"EmissiveColor":i.emissiveMap=s.getTexture(n,a.ID),i.emissiveMap!==void 0&&("colorSpace"in i.emissiveMap?i.emissiveMap.colorSpace="srgb":i.emissiveMap.encoding=3001);break;case"NormalMap":case"Maya|TEX_normal_map":i.normalMap=s.getTexture(n,a.ID);break;case"ReflectionColor":i.envMap=s.getTexture(n,a.ID),i.envMap!==void 0&&(i.envMap.mapping=c.EquirectangularReflectionMapping,"colorSpace"in i.envMap?i.envMap.colorSpace="srgb":i.envMap.encoding=3001);break;case"SpecularColor":i.specularMap=s.getTexture(n,a.ID),i.specularMap!==void 0&&("colorSpace"in i.specularMap?i.specularMap.colorSpace="srgb":i.specularMap.encoding=3001);break;case"TransparentColor":case"TransparencyFactor":i.alphaMap=s.getTexture(n,a.ID),i.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",o);break}}),i}getTexture(e,n){return"LayeredTexture"in we.Objects&&n in we.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),n=je.get(n).children[0].ID),e.get(n)}parseDeformers(){const e={},n={};if("Deformer"in we.Objects){const r=we.Objects.Deformer;for(const i in r){const s=r[i],a=je.get(parseInt(i));if(s.attrType==="Skin"){const o=this.parseSkeleton(a,r);o.ID=i,a.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),o.geometryID=a.parents[0].ID,e[i]=o}else if(s.attrType==="BlendShape"){const o={id:i};o.rawTargets=this.parseMorphTargets(a,r),o.id=i,a.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),n[i]=o}}}return{skeletons:e,morphTargets:n}}parseSkeleton(e,n){const r=[];return e.children.forEach(function(i){const s=n[i.ID];if(s.attrType!=="Cluster")return;const a={ID:i.ID,indices:[],weights:[],transformLink:new c.Matrix4().fromArray(s.TransformLink.a)};"Indexes"in s&&(a.indices=s.Indexes.a,a.weights=s.Weights.a),r.push(a)}),{rawBones:r,bones:[]}}parseMorphTargets(e,n){const r=[];for(let i=0;i<e.children.length;i++){const s=e.children[i],a=n[s.ID],o={name:a.attrName,initialWeight:a.DeformPercent,id:a.id,fullWeights:a.FullWeights.a};if(a.attrType!=="BlendShapeChannel")return;o.geoID=je.get(parseInt(s.ID)).children.filter(function(l){return l.relationship===void 0})[0].ID,r.push(o)}return r}parseScene(e,n,r){At=new c.Group;const i=this.parseModels(e.skeletons,n,r),s=we.Objects.Model,a=this;i.forEach(function(l){const h=s[l.ID];a.setLookAtProperties(l,h),je.get(l.ID).parents.forEach(function(A){const f=i.get(A.ID);f!==void 0&&f.add(l)}),l.parent===null&&At.add(l)}),this.bindSkeleton(e.skeletons,n,i),this.createAmbientLight(),At.traverse(function(l){if(l.userData.transformData){l.parent&&(l.userData.transformData.parentMatrix=l.parent.matrix,l.userData.transformData.parentMatrixWorld=l.parent.matrixWorld);const h=Z3(l.userData.transformData);l.applyMatrix4(h),l.updateWorldMatrix()}});const o=new Np().parse();At.children.length===1&&At.children[0].isGroup&&(At.children[0].animations=o,At=At.children[0]),At.animations=o}parseModels(e,n,r){const i=new Map,s=we.Objects.Model;for(const a in s){const o=parseInt(a),l=s[a],h=je.get(o);let u=this.buildSkeleton(h,e,o,l.attrName);if(!u){switch(l.attrType){case"Camera":u=this.createCamera(h);break;case"Light":u=this.createLight(h);break;case"Mesh":u=this.createMesh(h,n,r);break;case"NurbsCurve":u=this.createCurve(h,n);break;case"LimbNode":case"Root":u=new c.Bone;break;case"Null":default:u=new c.Group;break}u.name=l.attrName?c.PropertyBinding.sanitizeNodeName(l.attrName):"",u.ID=o}this.getTransformData(u,l),i.set(o,u)}return i}buildSkeleton(e,n,r,i){let s=null;return e.parents.forEach(function(a){for(const o in n){const l=n[o];l.rawBones.forEach(function(h,u){if(h.ID===a.ID){const A=s;s=new c.Bone,s.matrixWorld.copy(h.transformLink),s.name=i?c.PropertyBinding.sanitizeNodeName(i):"",s.ID=r,l.bones[u]=s,A!==null&&s.add(A)}})}}),s}createCamera(e){let n,r;if(e.children.forEach(function(i){const s=we.Objects.NodeAttribute[i.ID];s!==void 0&&(r=s)}),r===void 0)n=new c.Object3D;else{let i=0;r.CameraProjectionType!==void 0&&r.CameraProjectionType.value===1&&(i=1);let s=1;r.NearPlane!==void 0&&(s=r.NearPlane.value/1e3);let a=1e3;r.FarPlane!==void 0&&(a=r.FarPlane.value/1e3);let o=window.innerWidth,l=window.innerHeight;r.AspectWidth!==void 0&&r.AspectHeight!==void 0&&(o=r.AspectWidth.value,l=r.AspectHeight.value);const h=o/l;let u=45;r.FieldOfView!==void 0&&(u=r.FieldOfView.value);const A=r.FocalLength?r.FocalLength.value:null;switch(i){case 0:n=new c.PerspectiveCamera(u,h,s,a),A!==null&&n.setFocalLength(A);break;case 1:n=new c.OrthographicCamera(-o/2,o/2,l/2,-l/2,s,a);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+i+"."),n=new c.Object3D;break}}return n}createLight(e){let n,r;if(e.children.forEach(function(i){const s=we.Objects.NodeAttribute[i.ID];s!==void 0&&(r=s)}),r===void 0)n=new c.Object3D;else{let i;r.LightType===void 0?i=0:i=r.LightType.value;let s=16777215;r.Color!==void 0&&(s=new c.Color().fromArray(r.Color.value));let a=r.Intensity===void 0?1:r.Intensity.value/100;r.CastLightOnObject!==void 0&&r.CastLightOnObject.value===0&&(a=0);let o=0;r.FarAttenuationEnd!==void 0&&(r.EnableFarAttenuation!==void 0&&r.EnableFarAttenuation.value===0?o=0:o=r.FarAttenuationEnd.value);const l=1;switch(i){case 0:n=new c.PointLight(s,a,o,l);break;case 1:n=new c.DirectionalLight(s,a);break;case 2:let h=Math.PI/3;r.InnerAngle!==void 0&&(h=c.MathUtils.degToRad(r.InnerAngle.value));let u=0;r.OuterAngle!==void 0&&(u=c.MathUtils.degToRad(r.OuterAngle.value),u=Math.max(u,1)),n=new c.SpotLight(s,a,o,h,u,l);break;default:console.warn("THREE.FBXLoader: Unknown light type "+r.LightType.value+", defaulting to a PointLight."),n=new c.PointLight(s,a);break}r.CastShadows!==void 0&&r.CastShadows.value===1&&(n.castShadow=!0)}return n}createMesh(e,n,r){let i,s=null,a=null;const o=[];return e.children.forEach(function(l){n.has(l.ID)&&(s=n.get(l.ID)),r.has(l.ID)&&o.push(r.get(l.ID))}),o.length>1?a=o:o.length>0?a=o[0]:(a=new c.MeshPhongMaterial({color:13421772}),o.push(a)),"color"in s.attributes&&o.forEach(function(l){l.vertexColors=!0}),s.FBX_Deformer?(i=new c.SkinnedMesh(s,a),i.normalizeSkinWeights()):i=new c.Mesh(s,a),i}createCurve(e,n){const r=e.children.reduce(function(s,a){return n.has(a.ID)&&(s=n.get(a.ID)),s},null),i=new c.LineBasicMaterial({color:3342591,linewidth:1});return new c.Line(r,i)}getTransformData(e,n){const r={};"InheritType"in n&&(r.inheritType=parseInt(n.InheritType.value)),"RotationOrder"in n?r.eulerOrder=J3(n.RotationOrder.value):r.eulerOrder="ZYX","Lcl_Translation"in n&&(r.translation=n.Lcl_Translation.value),"PreRotation"in n&&(r.preRotation=n.PreRotation.value),"Lcl_Rotation"in n&&(r.rotation=n.Lcl_Rotation.value),"PostRotation"in n&&(r.postRotation=n.PostRotation.value),"Lcl_Scaling"in n&&(r.scale=n.Lcl_Scaling.value),"ScalingOffset"in n&&(r.scalingOffset=n.ScalingOffset.value),"ScalingPivot"in n&&(r.scalingPivot=n.ScalingPivot.value),"RotationOffset"in n&&(r.rotationOffset=n.RotationOffset.value),"RotationPivot"in n&&(r.rotationPivot=n.RotationPivot.value),e.userData.transformData=r}setLookAtProperties(e,n){"LookAtProperty"in n&&je.get(e.ID).children.forEach(function(i){if(i.relationship==="LookAtProperty"){const s=we.Objects.Model[i.ID];if("Lcl_Translation"in s){const a=s.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(a),At.add(e.target)):e.lookAt(new c.Vector3().fromArray(a))}}})}bindSkeleton(e,n,r){const i=this.parsePoseNodes();for(const s in e){const a=e[s];je.get(parseInt(a.ID)).parents.forEach(function(l){if(n.has(l.ID)){const h=l.ID;je.get(h).parents.forEach(function(A){r.has(A.ID)&&r.get(A.ID).bind(new c.Skeleton(a.bones),i[A.ID])})}})}}parsePoseNodes(){const e={};if("Pose"in we.Objects){const n=we.Objects.Pose;for(const r in n)if(n[r].attrType==="BindPose"&&n[r].NbPoseNodes>0){const i=n[r].PoseNode;Array.isArray(i)?i.forEach(function(s){e[s.Node]=new c.Matrix4().fromArray(s.Matrix.a)}):e[i.Node]=new c.Matrix4().fromArray(i.Matrix.a)}}return e}createAmbientLight(){if("GlobalSettings"in we&&"AmbientColor"in we.GlobalSettings){const e=we.GlobalSettings.AmbientColor.value,n=e[0],r=e[1],i=e[2];if(n!==0||r!==0||i!==0){const s=new c.Color(n,r,i);At.add(new c.AmbientLight(s,1))}}}}let Qp=class{parse(e){const n=new Map;if("Geometry"in we.Objects){const r=we.Objects.Geometry;for(const i in r){const s=je.get(parseInt(i)),a=this.parseGeometry(s,r[i],e);n.set(parseInt(i),a)}}return n}parseGeometry(e,n,r){switch(n.attrType){case"Mesh":return this.parseMeshGeometry(e,n,r);case"NurbsCurve":return this.parseNurbsGeometry(n)}}parseMeshGeometry(e,n,r){const i=r.skeletons,s=[],a=e.parents.map(function(A){return we.Objects.Model[A.ID]});if(a.length===0)return;const o=e.children.reduce(function(A,f){return i[f.ID]!==void 0&&(A=i[f.ID]),A},null);e.children.forEach(function(A){r.morphTargets[A.ID]!==void 0&&s.push(r.morphTargets[A.ID])});const l=a[0],h={};"RotationOrder"in l&&(h.eulerOrder=J3(l.RotationOrder.value)),"InheritType"in l&&(h.inheritType=parseInt(l.InheritType.value)),"GeometricTranslation"in l&&(h.translation=l.GeometricTranslation.value),"GeometricRotation"in l&&(h.rotation=l.GeometricRotation.value),"GeometricScaling"in l&&(h.scale=l.GeometricScaling.value);const u=Z3(h);return this.genGeometry(n,o,s,u)}genGeometry(e,n,r,i){const s=new c.BufferGeometry;e.attrName&&(s.name=e.attrName);const a=this.parseGeoNode(e,n),o=this.genBuffers(a),l=new c.Float32BufferAttribute(o.vertex,3);if(l.applyMatrix4(i),s.setAttribute("position",l),o.colors.length>0&&s.setAttribute("color",new c.Float32BufferAttribute(o.colors,3)),n&&(s.setAttribute("skinIndex",new c.Uint16BufferAttribute(o.weightsIndices,4)),s.setAttribute("skinWeight",new c.Float32BufferAttribute(o.vertexWeights,4)),s.FBX_Deformer=n),o.normal.length>0){const h=new c.Matrix3().getNormalMatrix(i),u=new c.Float32BufferAttribute(o.normal,3);u.applyNormalMatrix(h),s.setAttribute("normal",u)}if(o.uvs.forEach(function(h,u){let A="uv"+(u+1).toString();u===0&&(A="uv"),s.setAttribute(A,new c.Float32BufferAttribute(o.uvs[u],2))}),a.material&&a.material.mappingType!=="AllSame"){let h=o.materialIndex[0],u=0;if(o.materialIndex.forEach(function(A,f){A!==h&&(s.addGroup(u,f-u,h),h=A,u=f)}),s.groups.length>0){const A=s.groups[s.groups.length-1],f=A.start+A.count;f!==o.materialIndex.length&&s.addGroup(f,o.materialIndex.length-f,h)}s.groups.length===0&&s.addGroup(0,o.materialIndex.length,o.materialIndex[0])}return this.addMorphTargets(s,e,r,i),s}parseGeoNode(e,n){const r={};if(r.vertexPositions=e.Vertices!==void 0?e.Vertices.a:[],r.vertexIndices=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(r.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(r.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(r.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){r.uv=[];let i=0;for(;e.LayerElementUV[i];)e.LayerElementUV[i].UV&&r.uv.push(this.parseUVs(e.LayerElementUV[i])),i++}return r.weightTable={},n!==null&&(r.skeleton=n,n.rawBones.forEach(function(i,s){i.indices.forEach(function(a,o){r.weightTable[a]===void 0&&(r.weightTable[a]=[]),r.weightTable[a].push({id:s,weight:i.weights[o]})})})),r}genBuffers(e){const n={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let r=0,i=0,s=!1,a=[],o=[],l=[],h=[],u=[],A=[];const f=this;return e.vertexIndices.forEach(function(d,m){let y,C=!1;d<0&&(d=d^-1,C=!0);let x=[],I=[];if(a.push(d*3,d*3+1,d*3+2),e.color){const g=vs(m,r,d,e.color);l.push(g[0],g[1],g[2])}if(e.skeleton){if(e.weightTable[d]!==void 0&&e.weightTable[d].forEach(function(g){I.push(g.weight),x.push(g.id)}),I.length>4){s||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),s=!0);const g=[0,0,0,0],v=[0,0,0,0];I.forEach(function(w,b){let B=w,_=x[b];v.forEach(function(E,T,L){if(B>E){L[T]=B,B=E;const R=g[T];g[T]=_,_=R}})}),x=g,I=v}for(;I.length<4;)I.push(0),x.push(0);for(let g=0;g<4;++g)u.push(I[g]),A.push(x[g])}if(e.normal){const g=vs(m,r,d,e.normal);o.push(g[0],g[1],g[2])}e.material&&e.material.mappingType!=="AllSame"&&(y=vs(m,r,d,e.material)[0]),e.uv&&e.uv.forEach(function(g,v){const w=vs(m,r,d,g);h[v]===void 0&&(h[v]=[]),h[v].push(w[0]),h[v].push(w[1])}),i++,C&&(f.genFace(n,e,a,y,o,l,h,u,A,i),r++,i=0,a=[],o=[],l=[],h=[],u=[],A=[])}),n}genFace(e,n,r,i,s,a,o,l,h,u){for(let A=2;A<u;A++)e.vertex.push(n.vertexPositions[r[0]]),e.vertex.push(n.vertexPositions[r[1]]),e.vertex.push(n.vertexPositions[r[2]]),e.vertex.push(n.vertexPositions[r[(A-1)*3]]),e.vertex.push(n.vertexPositions[r[(A-1)*3+1]]),e.vertex.push(n.vertexPositions[r[(A-1)*3+2]]),e.vertex.push(n.vertexPositions[r[A*3]]),e.vertex.push(n.vertexPositions[r[A*3+1]]),e.vertex.push(n.vertexPositions[r[A*3+2]]),n.skeleton&&(e.vertexWeights.push(l[0]),e.vertexWeights.push(l[1]),e.vertexWeights.push(l[2]),e.vertexWeights.push(l[3]),e.vertexWeights.push(l[(A-1)*4]),e.vertexWeights.push(l[(A-1)*4+1]),e.vertexWeights.push(l[(A-1)*4+2]),e.vertexWeights.push(l[(A-1)*4+3]),e.vertexWeights.push(l[A*4]),e.vertexWeights.push(l[A*4+1]),e.vertexWeights.push(l[A*4+2]),e.vertexWeights.push(l[A*4+3]),e.weightsIndices.push(h[0]),e.weightsIndices.push(h[1]),e.weightsIndices.push(h[2]),e.weightsIndices.push(h[3]),e.weightsIndices.push(h[(A-1)*4]),e.weightsIndices.push(h[(A-1)*4+1]),e.weightsIndices.push(h[(A-1)*4+2]),e.weightsIndices.push(h[(A-1)*4+3]),e.weightsIndices.push(h[A*4]),e.weightsIndices.push(h[A*4+1]),e.weightsIndices.push(h[A*4+2]),e.weightsIndices.push(h[A*4+3])),n.color&&(e.colors.push(a[0]),e.colors.push(a[1]),e.colors.push(a[2]),e.colors.push(a[(A-1)*3]),e.colors.push(a[(A-1)*3+1]),e.colors.push(a[(A-1)*3+2]),e.colors.push(a[A*3]),e.colors.push(a[A*3+1]),e.colors.push(a[A*3+2])),n.material&&n.material.mappingType!=="AllSame"&&(e.materialIndex.push(i),e.materialIndex.push(i),e.materialIndex.push(i)),n.normal&&(e.normal.push(s[0]),e.normal.push(s[1]),e.normal.push(s[2]),e.normal.push(s[(A-1)*3]),e.normal.push(s[(A-1)*3+1]),e.normal.push(s[(A-1)*3+2]),e.normal.push(s[A*3]),e.normal.push(s[A*3+1]),e.normal.push(s[A*3+2])),n.uv&&n.uv.forEach(function(f,d){e.uvs[d]===void 0&&(e.uvs[d]=[]),e.uvs[d].push(o[d][0]),e.uvs[d].push(o[d][1]),e.uvs[d].push(o[d][(A-1)*2]),e.uvs[d].push(o[d][(A-1)*2+1]),e.uvs[d].push(o[d][A*2]),e.uvs[d].push(o[d][A*2+1])})}addMorphTargets(e,n,r,i){if(r.length===0)return;e.morphTargetsRelative=!0,e.morphAttributes.position=[];const s=this;r.forEach(function(a){a.rawTargets.forEach(function(o){const l=we.Objects.Geometry[o.geoID];l!==void 0&&s.genMorphGeometry(e,n,l,i,o.name)})})}genMorphGeometry(e,n,r,i,s){const a=n.PolygonVertexIndex!==void 0?n.PolygonVertexIndex.a:[],o=r.Vertices!==void 0?r.Vertices.a:[],l=r.Indexes!==void 0?r.Indexes.a:[],h=e.attributes.position.count*3,u=new Float32Array(h);for(let m=0;m<l.length;m++){const y=l[m]*3;u[y]=o[m*3],u[y+1]=o[m*3+1],u[y+2]=o[m*3+2]}const A={vertexIndices:a,vertexPositions:u},f=this.genBuffers(A),d=new c.Float32BufferAttribute(f.vertex,3);d.name=s||r.attrName,d.applyMatrix4(i),e.morphAttributes.position.push(d)}parseNormals(e){const n=e.MappingInformationType,r=e.ReferenceInformationType,i=e.Normals.a;let s=[];return r==="IndexToDirect"&&("NormalIndex"in e?s=e.NormalIndex.a:"NormalsIndex"in e&&(s=e.NormalsIndex.a)),{dataSize:3,buffer:i,indices:s,mappingType:n,referenceType:r}}parseUVs(e){const n=e.MappingInformationType,r=e.ReferenceInformationType,i=e.UV.a;let s=[];return r==="IndexToDirect"&&(s=e.UVIndex.a),{dataSize:2,buffer:i,indices:s,mappingType:n,referenceType:r}}parseVertexColors(e){const n=e.MappingInformationType,r=e.ReferenceInformationType,i=e.Colors.a;let s=[];return r==="IndexToDirect"&&(s=e.ColorIndex.a),{dataSize:4,buffer:i,indices:s,mappingType:n,referenceType:r}}parseMaterialIndices(e){const n=e.MappingInformationType,r=e.ReferenceInformationType;if(n==="NoMappingInformation")return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:r};const i=e.Materials.a,s=[];for(let a=0;a<i.length;++a)s.push(a);return{dataSize:1,buffer:i,indices:s,mappingType:n,referenceType:r}}parseNurbsGeometry(e){if(j3===void 0)return console.error("THREE.FBXLoader: The loader relies on NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry."),new c.BufferGeometry;const n=parseInt(e.Order);if(isNaN(n))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",e.Order,e.id),new c.BufferGeometry;const r=n-1,i=e.KnotVector.a,s=[],a=e.Points.a;for(let A=0,f=a.length;A<f;A+=4)s.push(new c.Vector4().fromArray(a,A));let o,l;if(e.Form==="Closed")s.push(s[0]);else if(e.Form==="Periodic"){o=r,l=i.length-1-o;for(let A=0;A<r;++A)s.push(s[A])}const u=new j3(r,i,s,o,l).getPoints(s.length*12);return new c.BufferGeometry().setFromPoints(u)}};class Np{parse(){const e=[],n=this.parseClips();if(n!==void 0)for(const r in n){const i=n[r],s=this.addClip(i);e.push(s)}return e}parseClips(){if(we.Objects.AnimationCurve===void 0)return;const e=this.parseAnimationCurveNodes();this.parseAnimationCurves(e);const n=this.parseAnimationLayers(e);return this.parseAnimStacks(n)}parseAnimationCurveNodes(){const e=we.Objects.AnimationCurveNode,n=new Map;for(const r in e){const i=e[r];if(i.attrName.match(/S|R|T|DeformPercent/)!==null){const s={id:i.id,attr:i.attrName,curves:{}};n.set(s.id,s)}}return n}parseAnimationCurves(e){const n=we.Objects.AnimationCurve;for(const r in n){const i={id:n[r].id,times:n[r].KeyTime.a.map(Yp),values:n[r].KeyValueFloat.a},s=je.get(i.id);if(s!==void 0){const a=s.parents[0].ID,o=s.parents[0].relationship;o.match(/X/)?e.get(a).curves.x=i:o.match(/Y/)?e.get(a).curves.y=i:o.match(/Z/)?e.get(a).curves.z=i:o.match(/d|DeformPercent/)&&e.has(a)&&(e.get(a).curves.morph=i)}}}parseAnimationLayers(e){const n=we.Objects.AnimationLayer,r=new Map;for(const i in n){const s=[],a=je.get(parseInt(i));a!==void 0&&(a.children.forEach(function(l,h){if(e.has(l.ID)){const u=e.get(l.ID);if(u.curves.x!==void 0||u.curves.y!==void 0||u.curves.z!==void 0){if(s[h]===void 0){const A=je.get(l.ID).parents.filter(function(f){return f.relationship!==void 0})[0].ID;if(A!==void 0){const f=we.Objects.Model[A.toString()];if(f===void 0){console.warn("THREE.FBXLoader: Encountered a unused curve.",l);return}const d={modelName:f.attrName?c.PropertyBinding.sanitizeNodeName(f.attrName):"",ID:f.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};At.traverse(function(m){m.ID===f.id&&(d.transform=m.matrix,m.userData.transformData&&(d.eulerOrder=m.userData.transformData.eulerOrder))}),d.transform||(d.transform=new c.Matrix4),"PreRotation"in f&&(d.preRotation=f.PreRotation.value),"PostRotation"in f&&(d.postRotation=f.PostRotation.value),s[h]=d}}s[h]&&(s[h][u.attr]=u)}else if(u.curves.morph!==void 0){if(s[h]===void 0){const A=je.get(l.ID).parents.filter(function(x){return x.relationship!==void 0})[0].ID,f=je.get(A).parents[0].ID,d=je.get(f).parents[0].ID,m=je.get(d).parents[0].ID,y=we.Objects.Model[m],C={modelName:y.attrName?c.PropertyBinding.sanitizeNodeName(y.attrName):"",morphName:we.Objects.Deformer[A].attrName};s[h]=C}s[h][u.attr]=u}}}),r.set(parseInt(i),s))}return r}parseAnimStacks(e){const n=we.Objects.AnimationStack,r={};for(const i in n){const s=je.get(parseInt(i)).children;s.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const a=e.get(s[0].ID);r[i]={name:n[i].attrName,layer:a}}return r}addClip(e){let n=[];const r=this;return e.layer.forEach(function(i){n=n.concat(r.generateTracks(i))}),new c.AnimationClip(e.name,-1,n)}generateTracks(e){const n=[];let r=new c.Vector3,i=new c.Quaternion,s=new c.Vector3;if(e.transform&&e.transform.decompose(r,i,s),r=r.toArray(),i=new c.Euler().setFromQuaternion(i,e.eulerOrder).toArray(),s=s.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){const a=this.generateVectorTrack(e.modelName,e.T.curves,r,"position");a!==void 0&&n.push(a)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){const a=this.generateRotationTrack(e.modelName,e.R.curves,i,e.preRotation,e.postRotation,e.eulerOrder);a!==void 0&&n.push(a)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){const a=this.generateVectorTrack(e.modelName,e.S.curves,s,"scale");a!==void 0&&n.push(a)}if(e.DeformPercent!==void 0){const a=this.generateMorphTrack(e);a!==void 0&&n.push(a)}return n}generateVectorTrack(e,n,r,i){const s=this.getTimesForAllAxes(n),a=this.getKeyframeTrackValues(s,n,r);return new c.VectorKeyframeTrack(e+"."+i,s,a)}generateRotationTrack(e,n,r,i,s,a){n.x!==void 0&&(this.interpolateRotations(n.x),n.x.values=n.x.values.map(c.MathUtils.degToRad)),n.y!==void 0&&(this.interpolateRotations(n.y),n.y.values=n.y.values.map(c.MathUtils.degToRad)),n.z!==void 0&&(this.interpolateRotations(n.z),n.z.values=n.z.values.map(c.MathUtils.degToRad));const o=this.getTimesForAllAxes(n),l=this.getKeyframeTrackValues(o,n,r);i!==void 0&&(i=i.map(c.MathUtils.degToRad),i.push(a),i=new c.Euler().fromArray(i),i=new c.Quaternion().setFromEuler(i)),s!==void 0&&(s=s.map(c.MathUtils.degToRad),s.push(a),s=new c.Euler().fromArray(s),s=new c.Quaternion().setFromEuler(s).invert());const h=new c.Quaternion,u=new c.Euler,A=[];for(let f=0;f<l.length;f+=3)u.set(l[f],l[f+1],l[f+2],a),h.setFromEuler(u),i!==void 0&&h.premultiply(i),s!==void 0&&h.multiply(s),h.toArray(A,f/3*4);return new c.QuaternionKeyframeTrack(e+".quaternion",o,A)}generateMorphTrack(e){const n=e.DeformPercent.curves.morph,r=n.values.map(function(s){return s/100}),i=At.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new c.NumberKeyframeTrack(e.modelName+".morphTargetInfluences["+i+"]",n.times,r)}getTimesForAllAxes(e){let n=[];if(e.x!==void 0&&(n=n.concat(e.x.times)),e.y!==void 0&&(n=n.concat(e.y.times)),e.z!==void 0&&(n=n.concat(e.z.times)),n=n.sort(function(r,i){return r-i}),n.length>1){let r=1,i=n[0];for(let s=1;s<n.length;s++){const a=n[s];a!==i&&(n[r]=a,i=a,r++)}n=n.slice(0,r)}return n}getKeyframeTrackValues(e,n,r){const i=r,s=[];let a=-1,o=-1,l=-1;return e.forEach(function(h){if(n.x&&(a=n.x.times.indexOf(h)),n.y&&(o=n.y.times.indexOf(h)),n.z&&(l=n.z.times.indexOf(h)),a!==-1){const u=n.x.values[a];s.push(u),i[0]=u}else s.push(i[0]);if(o!==-1){const u=n.y.values[o];s.push(u),i[1]=u}else s.push(i[1]);if(l!==-1){const u=n.z.values[l];s.push(u),i[2]=u}else s.push(i[2])}),s}interpolateRotations(e){for(let n=1;n<e.values.length;n++){const r=e.values[n-1],i=e.values[n]-r,s=Math.abs(i);if(s>=180){const a=s/180,o=i/a;let l=r+o;const h=e.times[n-1],A=(e.times[n]-h)/a;let f=h+A;const d=[],m=[];for(;f<e.times[n];)d.push(f),f+=A,m.push(l),l+=o;e.times=$3(e.times,n,d),e.values=$3(e.values,n,m)}}}}class Gp{getPrevNode(){return this.nodeStack[this.currentIndent-2]}getCurrentNode(){return this.nodeStack[this.currentIndent-1]}getCurrentProp(){return this.currentProp}pushStack(e){this.nodeStack.push(e),this.currentIndent+=1}popStack(){this.nodeStack.pop(),this.currentIndent-=1}setCurrentProp(e,n){this.currentProp=e,this.currentPropName=n}parse(e){this.currentIndent=0,this.allNodes=new K3,this.nodeStack=[],this.currentProp=[],this.currentPropName="";const n=this,r=e.split(/[\r\n]+/);return r.forEach(function(i,s){const a=i.match(/^[\s\t]*;/),o=i.match(/^[\s\t]*$/);if(a||o)return;const l=i.match("^\\t{"+n.currentIndent+"}(\\w+):(.*){",""),h=i.match("^\\t{"+n.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),u=i.match("^\\t{"+(n.currentIndent-1)+"}}");l?n.parseNodeBegin(i,l):h?n.parseNodeProperty(i,h,r[++s]):u?n.popStack():i.match(/^[^\s\t}]/)&&n.parseNodePropertyContinued(i)}),this.allNodes}parseNodeBegin(e,n){const r=n[1].trim().replace(/^"/,"").replace(/"$/,""),i=n[2].split(",").map(function(l){return l.trim().replace(/^"/,"").replace(/"$/,"")}),s={name:r},a=this.parseNodeAttr(i),o=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(r,s):r in o?(r==="PoseNode"?o.PoseNode.push(s):o[r].id!==void 0&&(o[r]={},o[r][o[r].id]=o[r]),a.id!==""&&(o[r][a.id]=s)):typeof a.id=="number"?(o[r]={},o[r][a.id]=s):r!=="Properties70"&&(r==="PoseNode"?o[r]=[s]:o[r]=s),typeof a.id=="number"&&(s.id=a.id),a.name!==""&&(s.attrName=a.name),a.type!==""&&(s.attrType=a.type),this.pushStack(s)}parseNodeAttr(e){let n=e[0];e[0]!==""&&(n=parseInt(e[0]),isNaN(n)&&(n=e[0]));let r="",i="";return e.length>1&&(r=e[1].replace(/^(\w+)::/,""),i=e[2]),{id:n,name:r,type:i}}parseNodeProperty(e,n,r){let i=n[1].replace(/^"/,"").replace(/"$/,"").trim(),s=n[2].replace(/^"/,"").replace(/"$/,"").trim();i==="Content"&&s===","&&(s=r.replace(/"/g,"").replace(/,$/,"").trim());const a=this.getCurrentNode();if(a.name==="Properties70"){this.parseNodeSpecialProperty(e,i,s);return}if(i==="C"){const l=s.split(",").slice(1),h=parseInt(l[0]),u=parseInt(l[1]);let A=s.split(",").slice(3);A=A.map(function(f){return f.trim().replace(/^"/,"")}),i="connections",s=[h,u],qp(s,A),a[i]===void 0&&(a[i]=[])}i==="Node"&&(a.id=s),i in a&&Array.isArray(a[i])?a[i].push(s):i!=="a"?a[i]=s:a.a=s,this.setCurrentProp(a,i),i==="a"&&s.slice(-1)!==","&&(a.a=So(s))}parseNodePropertyContinued(e){const n=this.getCurrentNode();n.a+=e,e.slice(-1)!==","&&(n.a=So(n.a))}parseNodeSpecialProperty(e,n,r){const i=r.split('",').map(function(u){return u.trim().replace(/^\"/,"").replace(/\s/,"_")}),s=i[0],a=i[1],o=i[2],l=i[3];let h=i[4];switch(a){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":h=parseFloat(h);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":h=So(h);break}this.getPrevNode()[s]={type:a,type2:o,flag:l,value:h},this.setCurrentProp(this.getPrevNode(),s)}}class Vp{parse(e){const n=new q3(e);n.skip(23);const r=n.getUint32();if(r<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+r);const i=new K3;for(;!this.endOfContent(n);){const s=this.parseNode(n,r);s!==null&&i.add(s.name,s)}return i}endOfContent(e){return e.size()%16===0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,n){const r={},i=n>=7500?e.getUint64():e.getUint32(),s=n>=7500?e.getUint64():e.getUint32();n>=7500?e.getUint64():e.getUint32();const a=e.getUint8(),o=e.getString(a);if(i===0)return null;const l=[];for(let f=0;f<s;f++)l.push(this.parseProperty(e));const h=l.length>0?l[0]:"",u=l.length>1?l[1]:"",A=l.length>2?l[2]:"";for(r.singleProperty=s===1&&e.getOffset()===i;i>e.getOffset();){const f=this.parseNode(e,n);f!==null&&this.parseSubNode(o,r,f)}return r.propertyList=l,typeof h=="number"&&(r.id=h),u!==""&&(r.attrName=u),A!==""&&(r.attrType=A),o!==""&&(r.name=o),r}parseSubNode(e,n,r){if(r.singleProperty===!0){const i=r.propertyList[0];Array.isArray(i)?(n[r.name]=r,r.a=i):n[r.name]=i}else if(e==="Connections"&&r.name==="C"){const i=[];r.propertyList.forEach(function(s,a){a!==0&&i.push(s)}),n.connections===void 0&&(n.connections=[]),n.connections.push(i)}else if(r.name==="Properties70")Object.keys(r).forEach(function(s){n[s]=r[s]});else if(e==="Properties70"&&r.name==="P"){let i=r.propertyList[0],s=r.propertyList[1];const a=r.propertyList[2],o=r.propertyList[3];let l;i.indexOf("Lcl ")===0&&(i=i.replace("Lcl ","Lcl_")),s.indexOf("Lcl ")===0&&(s=s.replace("Lcl ","Lcl_")),s==="Color"||s==="ColorRGB"||s==="Vector"||s==="Vector3D"||s.indexOf("Lcl_")===0?l=[r.propertyList[4],r.propertyList[5],r.propertyList[6]]:l=r.propertyList[4],n[i]={type:s,type2:a,flag:o,value:l}}else n[r.name]===void 0?typeof r.id=="number"?(n[r.name]={},n[r.name][r.id]=r):n[r.name]=r:r.name==="PoseNode"?(Array.isArray(n[r.name])||(n[r.name]=[n[r.name]]),n[r.name].push(r)):n[r.name][r.id]===void 0&&(n[r.name][r.id]=r)}parseProperty(e){const n=e.getString(1);let r;switch(n){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return r=e.getUint32(),e.getArrayBuffer(r);case"S":return r=e.getUint32(),e.getString(r);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const i=e.getUint32(),s=e.getUint32(),a=e.getUint32();if(s===0)switch(n){case"b":case"c":return e.getBooleanArray(i);case"d":return e.getFloat64Array(i);case"f":return e.getFloat32Array(i);case"i":return e.getInt32Array(i);case"l":return e.getInt64Array(i)}const o=B2(new Uint8Array(e.getArrayBuffer(a))),l=new q3(o.buffer);switch(n){case"b":case"c":return l.getBooleanArray(i);case"d":return l.getFloat64Array(i);case"f":return l.getFloat32Array(i);case"i":return l.getInt32Array(i);case"l":return l.getInt64Array(i)}default:throw new Error("THREE.FBXLoader: Unknown property type "+n)}}}class q3{constructor(e,n){this.dv=new DataView(e),this.offset=0,this.littleEndian=n!==void 0?n:!0}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)===1}getBooleanArray(e){const n=[];for(let r=0;r<e;r++)n.push(this.getBoolean());return n}getUint8(){const e=this.dv.getUint8(this.offset);return this.offset+=1,e}getInt16(){const e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}getInt32(){const e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}getInt32Array(e){const n=[];for(let r=0;r<e;r++)n.push(this.getInt32());return n}getUint32(){const e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}getInt64(){let e,n;return this.littleEndian?(e=this.getUint32(),n=this.getUint32()):(n=this.getUint32(),e=this.getUint32()),n&2147483648?(n=~n&4294967295,e=~e&4294967295,e===4294967295&&(n=n+1&4294967295),e=e+1&4294967295,-(n*4294967296+e)):n*4294967296+e}getInt64Array(e){const n=[];for(let r=0;r<e;r++)n.push(this.getInt64());return n}getUint64(){let e,n;return this.littleEndian?(e=this.getUint32(),n=this.getUint32()):(n=this.getUint32(),e=this.getUint32()),n*4294967296+e}getFloat32(){const e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}getFloat32Array(e){const n=[];for(let r=0;r<e;r++)n.push(this.getFloat32());return n}getFloat64(){const e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}getFloat64Array(e){const n=[];for(let r=0;r<e;r++)n.push(this.getFloat64());return n}getArrayBuffer(e){const n=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,n}getString(e){let n=[];for(let i=0;i<e;i++)n[i]=this.getUint8();const r=n.indexOf(0);return r>=0&&(n=n.slice(0,r)),c.LoaderUtils.decodeText(new Uint8Array(n))}}class K3{add(e,n){this[e]=n}}function zp(t){const e="Kaydara FBX Binary \0";return t.byteLength>=e.length&&e===H3(t,0,e.length)}function Wp(t){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let n=0;function r(i){const s=t[i-1];return t=t.slice(n+i),n++,s}for(let i=0;i<e.length;++i)if(r(1)===e[i])return!1;return!0}function X3(t){const e=/FBXVersion: (\d+)/,n=t.match(e);if(n)return parseInt(n[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function Yp(t){return t/46186158e3}const jp=[];function vs(t,e,n,r){let i;switch(r.mappingType){case"ByPolygonVertex":i=t;break;case"ByPolygon":i=e;break;case"ByVertice":i=n;break;case"AllSame":i=r.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+r.mappingType)}r.referenceType==="IndexToDirect"&&(i=r.indices[i]);const s=i*r.dataSize,a=s+r.dataSize;return Kp(jp,r.buffer,s,a)}const xo=new c.Euler,Pr=new c.Vector3;function Z3(t){const e=new c.Matrix4,n=new c.Matrix4,r=new c.Matrix4,i=new c.Matrix4,s=new c.Matrix4,a=new c.Matrix4,o=new c.Matrix4,l=new c.Matrix4,h=new c.Matrix4,u=new c.Matrix4,A=new c.Matrix4,f=new c.Matrix4,d=t.inheritType?t.inheritType:0;if(t.translation&&e.setPosition(Pr.fromArray(t.translation)),t.preRotation){const T=t.preRotation.map(c.MathUtils.degToRad);T.push(t.eulerOrder),n.makeRotationFromEuler(xo.fromArray(T))}if(t.rotation){const T=t.rotation.map(c.MathUtils.degToRad);T.push(t.eulerOrder),r.makeRotationFromEuler(xo.fromArray(T))}if(t.postRotation){const T=t.postRotation.map(c.MathUtils.degToRad);T.push(t.eulerOrder),i.makeRotationFromEuler(xo.fromArray(T)),i.invert()}t.scale&&s.scale(Pr.fromArray(t.scale)),t.scalingOffset&&o.setPosition(Pr.fromArray(t.scalingOffset)),t.scalingPivot&&a.setPosition(Pr.fromArray(t.scalingPivot)),t.rotationOffset&&l.setPosition(Pr.fromArray(t.rotationOffset)),t.rotationPivot&&h.setPosition(Pr.fromArray(t.rotationPivot)),t.parentMatrixWorld&&(A.copy(t.parentMatrix),u.copy(t.parentMatrixWorld));const m=n.clone().multiply(r).multiply(i),y=new c.Matrix4;y.extractRotation(u);const C=new c.Matrix4;C.copyPosition(u);const x=C.clone().invert().multiply(u),I=y.clone().invert().multiply(x),g=s,v=new c.Matrix4;if(d===0)v.copy(y).multiply(m).multiply(I).multiply(g);else if(d===1)v.copy(y).multiply(I).multiply(m).multiply(g);else{const L=new c.Matrix4().scale(new c.Vector3().setFromMatrixScale(A)).clone().invert(),R=I.clone().multiply(L);v.copy(y).multiply(m).multiply(R).multiply(g)}const w=h.clone().invert(),b=a.clone().invert();let B=e.clone().multiply(l).multiply(h).multiply(n).multiply(r).multiply(i).multiply(w).multiply(o).multiply(a).multiply(s).multiply(b);const _=new c.Matrix4().copyPosition(B),E=u.clone().multiply(_);return f.copyPosition(E),B=f.clone().multiply(v),B.premultiply(u.invert()),B}function J3(t){t=t||0;const e=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return t===6?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),e[0]):e[t]}function So(t){return t.split(",").map(function(n){return parseFloat(n)})}function H3(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=t.byteLength),c.LoaderUtils.decodeText(new Uint8Array(t,e,n))}function qp(t,e){for(let n=0,r=t.length,i=e.length;n<i;n++,r++)t[r]=e[n]}function Kp(t,e,n,r){for(let i=n,s=0;i<r;i++,s++)t[s]=e[i];return t}function $3(t,e,n){return t.slice(0,e).concat(n).concat(t.slice(e))}class Xp extends c.Loader{constructor(e){super(e)}load(e,n,r,i){const s=new c.FileLoader(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,a=>{if(typeof a!="string")throw new Error("unsupported data type");const o=JSON.parse(a),l=this.parse(o);n&&n(l)},r,i)}loadAsync(e,n){return super.loadAsync(e,n)}parse(e){return new Bo(e)}}class Bo{constructor(e){M(this,"data"),this.data=e}generateShapes(e,n=100,r){const i=[],s={letterSpacing:0,lineHeight:1,...r},a=Zp(e,n,this.data,s);for(let o=0,l=a.length;o<l;o++)Array.prototype.push.apply(i,a[o].toShapes(!1));return i}}M(Bo,"isFont"),M(Bo,"type");function Zp(t,e,n,r){const i=Array.from(t),s=e/n.resolution,a=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*s,o=[];let l=0,h=0;for(let u=0;u<i.length;u++){const A=i[u];if(A===`
|
|
924
|
+
`)l=0,h-=a*r.lineHeight;else{const f=Jp(A,s,l,h,n);f&&(l+=f.offsetX+r.letterSpacing,o.push(f.path))}}return o}function Jp(t,e,n,r,i){const s=i.glyphs[t]||i.glyphs["?"];if(!s){console.error('THREE.Font: character "'+t+'" does not exists in font family '+i.familyName+".");return}const a=new c.ShapePath;let o,l,h,u,A,f,d,m;if(s.o){const y=s._cachedOutline||(s._cachedOutline=s.o.split(" "));for(let C=0,x=y.length;C<x;)switch(y[C++]){case"m":o=parseInt(y[C++])*e+n,l=parseInt(y[C++])*e+r,a.moveTo(o,l);break;case"l":o=parseInt(y[C++])*e+n,l=parseInt(y[C++])*e+r,a.lineTo(o,l);break;case"q":h=parseInt(y[C++])*e+n,u=parseInt(y[C++])*e+r,A=parseInt(y[C++])*e+n,f=parseInt(y[C++])*e+r,a.quadraticCurveTo(A,f,h,u);break;case"b":h=parseInt(y[C++])*e+n,u=parseInt(y[C++])*e+r,A=parseInt(y[C++])*e+n,f=parseInt(y[C++])*e+r,d=parseInt(y[C++])*e+n,m=parseInt(y[C++])*e+r,a.bezierCurveTo(A,f,d,m,h,u);break}}return{offsetX:s.ha*e,path:a}}class Hp extends c.Texture{constructor(e=null,n=1,r=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:n,height:r,depth:i},this.magFilter=c.NearestFilter,this.minFilter=c.NearestFilter,this.wrapR=c.ClampToEdgeWrapping,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}var $p=typeof global=="object"&&global&&global.Object===Object&&global;const eh=$p;var e6=typeof self=="object"&&self&&self.Object===Object&&self,t6=eh||e6||Function("return this")();const $t=t6;var n6=$t.Symbol;const _t=n6;var th=Object.prototype,r6=th.hasOwnProperty,i6=th.toString,ci=_t?_t.toStringTag:void 0;function s6(t){var e=r6.call(t,ci),n=t[ci];try{t[ci]=void 0;var r=!0}catch{}var i=i6.call(t);return r&&(e?t[ci]=n:delete t[ci]),i}var a6=Object.prototype,o6=a6.toString;function l6(t){return o6.call(t)}var c6="[object Null]",h6="[object Undefined]",nh=_t?_t.toStringTag:void 0;function Wn(t){return t==null?t===void 0?h6:c6:nh&&nh in Object(t)?s6(t):l6(t)}function Qt(t){return t!=null&&typeof t=="object"}var u6="[object Symbol]";function ys(t){return typeof t=="symbol"||Qt(t)&&Wn(t)==u6}function hi(t,e){for(var n=-1,r=t==null?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}var A6=Array.isArray;const Ee=A6;var f6=1/0,rh=_t?_t.prototype:void 0,ih=rh?rh.toString:void 0;function sh(t){if(typeof t=="string")return t;if(Ee(t))return hi(t,sh)+"";if(ys(t))return ih?ih.call(t):"";var e=t+"";return e=="0"&&1/t==-f6?"-0":e}var d6=/\s/;function p6(t){for(var e=t.length;e--&&d6.test(t.charAt(e)););return e}var g6=/^\s+/;function m6(t){return t&&t.slice(0,p6(t)+1).replace(g6,"")}function Et(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var ah=0/0,v6=/^[-+]0x[0-9a-f]+$/i,y6=/^0b[01]+$/i,C6=/^0o[0-7]+$/i,I6=parseInt;function x6(t){if(typeof t=="number")return t;if(ys(t))return ah;if(Et(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Et(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=m6(t);var n=y6.test(t);return n||C6.test(t)?I6(t.slice(2),n?2:8):v6.test(t)?ah:+t}var oh=1/0,S6=17976931348623157e292;function B6(t){if(!t)return t===0?t:0;if(t=x6(t),t===oh||t===-oh){var e=t<0?-1:1;return e*S6}return t===t?t:0}function ui(t){var e=B6(t),n=e%1;return e===e?n?e-n:e:0}function Fr(t){return t}var w6="[object AsyncFunction]",b6="[object Function]",_6="[object GeneratorFunction]",E6="[object Proxy]";function yn(t){if(!Et(t))return!1;var e=Wn(t);return e==b6||e==_6||e==w6||e==E6}var T6=$t["__core-js_shared__"];const wo=T6;var lh=function(){var t=/[^.]+$/.exec(wo&&wo.keys&&wo.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function M6(t){return!!lh&&lh in t}var D6=Function.prototype,L6=D6.toString;function or(t){if(t!=null){try{return L6.call(t)}catch{}try{return t+""}catch{}}return""}var P6=/[\\^$.*+?()[\]{}|]/g,F6=/^\[object .+?Constructor\]$/,k6=Function.prototype,O6=Object.prototype,R6=k6.toString,U6=O6.hasOwnProperty,Q6=RegExp("^"+R6.call(U6).replace(P6,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function N6(t){if(!Et(t)||M6(t))return!1;var e=yn(t)?Q6:F6;return e.test(or(t))}function G6(t,e){return t==null?void 0:t[e]}function lr(t,e){var n=G6(t,e);return N6(n)?n:void 0}var V6=lr($t,"WeakMap");const bo=V6;var ch=Object.create,z6=function(){function t(){}return function(e){if(!Et(e))return{};if(ch)return ch(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();const W6=z6;function Y6(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function Xe(){}function j6(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}var q6=800,K6=16,X6=Date.now;function Z6(t){var e=0,n=0;return function(){var r=X6(),i=K6-(r-n);if(n=r,i>0){if(++e>=q6)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function J6(t){return function(){return t}}var H6=function(){try{var t=lr(Object,"defineProperty");return t({},"",{}),t}catch{}}();const Cs=H6;var $6=Cs?function(t,e){return Cs(t,"toString",{configurable:!0,enumerable:!1,value:J6(e),writable:!0})}:Fr,e1=Z6($6);const t1=e1;function hh(t,e){for(var n=-1,r=t==null?0:t.length;++n<r&&e(t[n],n,t)!==!1;);return t}function uh(t,e,n,r){for(var i=t.length,s=n+(r?1:-1);r?s--:++s<i;)if(e(t[s],s,t))return s;return-1}function n1(t){return t!==t}function r1(t,e,n){for(var r=n-1,i=t.length;++r<i;)if(t[r]===e)return r;return-1}function _o(t,e,n){return e===e?r1(t,e,n):uh(t,n1,n)}function Ah(t,e){var n=t==null?0:t.length;return!!n&&_o(t,e,0)>-1}var i1=9007199254740991,s1=/^(?:0|[1-9]\d*)$/;function Is(t,e){var n=typeof t;return e=e??i1,!!e&&(n=="number"||n!="symbol"&&s1.test(t))&&t>-1&&t%1==0&&t<e}function Eo(t,e,n){e=="__proto__"&&Cs?Cs(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function Ai(t,e){return t===e||t!==t&&e!==e}var a1=Object.prototype,o1=a1.hasOwnProperty;function xs(t,e,n){var r=t[e];(!(o1.call(t,e)&&Ai(r,n))||n===void 0&&!(e in t))&&Eo(t,e,n)}function fi(t,e,n,r){var i=!n;n||(n={});for(var s=-1,a=e.length;++s<a;){var o=e[s],l=r?r(n[o],t[o],o,n,t):void 0;l===void 0&&(l=t[o]),i?Eo(n,o,l):xs(n,o,l)}return n}var fh=Math.max;function l1(t,e,n){return e=fh(e===void 0?t.length-1:e,0),function(){for(var r=arguments,i=-1,s=fh(r.length-e,0),a=Array(s);++i<s;)a[i]=r[e+i];i=-1;for(var o=Array(e+1);++i<e;)o[i]=r[i];return o[e]=n(a),Y6(t,this,o)}}function To(t,e){return t1(l1(t,e,Fr),t+"")}var c1=9007199254740991;function Mo(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=c1}function en(t){return t!=null&&Mo(t.length)&&!yn(t)}function Ss(t,e,n){if(!Et(n))return!1;var r=typeof e;return(r=="number"?en(n)&&Is(e,n.length):r=="string"&&e in n)?Ai(n[e],t):!1}function h1(t){return To(function(e,n){var r=-1,i=n.length,s=i>1?n[i-1]:void 0,a=i>2?n[2]:void 0;for(s=t.length>3&&typeof s=="function"?(i--,s):void 0,a&&Ss(n[0],n[1],a)&&(s=i<3?void 0:s,i=1),e=Object(e);++r<i;){var o=n[r];o&&t(e,o,r,s)}return e})}var u1=Object.prototype;function di(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||u1;return t===n}function A1(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}var f1="[object Arguments]";function dh(t){return Qt(t)&&Wn(t)==f1}var ph=Object.prototype,d1=ph.hasOwnProperty,p1=ph.propertyIsEnumerable,g1=dh(function(){return arguments}())?dh:function(t){return Qt(t)&&d1.call(t,"callee")&&!p1.call(t,"callee")};const Bs=g1;function m1(){return!1}var gh=typeof k=="object"&&k&&!k.nodeType&&k,mh=gh&&typeof module=="object"&&module&&!module.nodeType&&module,v1=mh&&mh.exports===gh,vh=v1?$t.Buffer:void 0,y1=vh?vh.isBuffer:void 0,C1=y1||m1;const pi=C1;var I1="[object Arguments]",x1="[object Array]",S1="[object Boolean]",B1="[object Date]",w1="[object Error]",b1="[object Function]",_1="[object Map]",E1="[object Number]",T1="[object Object]",M1="[object RegExp]",D1="[object Set]",L1="[object String]",P1="[object WeakMap]",F1="[object ArrayBuffer]",k1="[object DataView]",O1="[object Float32Array]",R1="[object Float64Array]",U1="[object Int8Array]",Q1="[object Int16Array]",N1="[object Int32Array]",G1="[object Uint8Array]",V1="[object Uint8ClampedArray]",z1="[object Uint16Array]",W1="[object Uint32Array]",Re={};Re[O1]=Re[R1]=Re[U1]=Re[Q1]=Re[N1]=Re[G1]=Re[V1]=Re[z1]=Re[W1]=!0,Re[I1]=Re[x1]=Re[F1]=Re[S1]=Re[k1]=Re[B1]=Re[w1]=Re[b1]=Re[_1]=Re[E1]=Re[T1]=Re[M1]=Re[D1]=Re[L1]=Re[P1]=!1;function Y1(t){return Qt(t)&&Mo(t.length)&&!!Re[Wn(t)]}function gi(t){return function(e){return t(e)}}var yh=typeof k=="object"&&k&&!k.nodeType&&k,mi=yh&&typeof module=="object"&&module&&!module.nodeType&&module,j1=mi&&mi.exports===yh,Do=j1&&eh.process,q1=function(){try{var t=mi&&mi.require&&mi.require("util").types;return t||Do&&Do.binding&&Do.binding("util")}catch{}}();const Yn=q1;var Ch=Yn&&Yn.isTypedArray,K1=Ch?gi(Ch):Y1;const Lo=K1;var X1=Object.prototype,Z1=X1.hasOwnProperty;function Ih(t,e){var n=Ee(t),r=!n&&Bs(t),i=!n&&!r&&pi(t),s=!n&&!r&&!i&&Lo(t),a=n||r||i||s,o=a?A1(t.length,String):[],l=o.length;for(var h in t)(e||Z1.call(t,h))&&!(a&&(h=="length"||i&&(h=="offset"||h=="parent")||s&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||Is(h,l)))&&o.push(h);return o}function xh(t,e){return function(n){return t(e(n))}}var J1=xh(Object.keys,Object);const H1=J1;var $1=Object.prototype,eg=$1.hasOwnProperty;function Sh(t){if(!di(t))return H1(t);var e=[];for(var n in Object(t))eg.call(t,n)&&n!="constructor"&&e.push(n);return e}function Ct(t){return en(t)?Ih(t):Sh(t)}var tg=Object.prototype,ng=tg.hasOwnProperty,rg=h1(function(t,e){if(di(e)||en(e)){fi(e,Ct(e),t);return}for(var n in e)ng.call(e,n)&&xs(t,n,e[n])});const It=rg;function ig(t){var e=[];if(t!=null)for(var n in Object(t))e.push(n);return e}var sg=Object.prototype,ag=sg.hasOwnProperty;function og(t){if(!Et(t))return ig(t);var e=di(t),n=[];for(var r in t)r=="constructor"&&(e||!ag.call(t,r))||n.push(r);return n}function ws(t){return en(t)?Ih(t,!0):og(t)}var lg=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,cg=/^\w*$/;function Po(t,e){if(Ee(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||ys(t)?!0:cg.test(t)||!lg.test(t)||e!=null&&t in Object(e)}var hg=lr(Object,"create");const vi=hg;function ug(){this.__data__=vi?vi(null):{},this.size=0}function Ag(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var fg="__lodash_hash_undefined__",dg=Object.prototype,pg=dg.hasOwnProperty;function gg(t){var e=this.__data__;if(vi){var n=e[t];return n===fg?void 0:n}return pg.call(e,t)?e[t]:void 0}var mg=Object.prototype,vg=mg.hasOwnProperty;function yg(t){var e=this.__data__;return vi?e[t]!==void 0:vg.call(e,t)}var Cg="__lodash_hash_undefined__";function Ig(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=vi&&e===void 0?Cg:e,this}function cr(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}cr.prototype.clear=ug,cr.prototype.delete=Ag,cr.prototype.get=gg,cr.prototype.has=yg,cr.prototype.set=Ig;function xg(){this.__data__=[],this.size=0}function bs(t,e){for(var n=t.length;n--;)if(Ai(t[n][0],e))return n;return-1}var Sg=Array.prototype,Bg=Sg.splice;function wg(t){var e=this.__data__,n=bs(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():Bg.call(e,n,1),--this.size,!0}function bg(t){var e=this.__data__,n=bs(e,t);return n<0?void 0:e[n][1]}function _g(t){return bs(this.__data__,t)>-1}function Eg(t,e){var n=this.__data__,r=bs(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}function Cn(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}Cn.prototype.clear=xg,Cn.prototype.delete=wg,Cn.prototype.get=bg,Cn.prototype.has=_g,Cn.prototype.set=Eg;var Tg=lr($t,"Map");const yi=Tg;function Mg(){this.size=0,this.__data__={hash:new cr,map:new(yi||Cn),string:new cr}}function Dg(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function _s(t,e){var n=t.__data__;return Dg(e)?n[typeof e=="string"?"string":"hash"]:n.map}function Lg(t){var e=_s(this,t).delete(t);return this.size-=e?1:0,e}function Pg(t){return _s(this,t).get(t)}function Fg(t){return _s(this,t).has(t)}function kg(t,e){var n=_s(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}function In(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}In.prototype.clear=Mg,In.prototype.delete=Lg,In.prototype.get=Pg,In.prototype.has=Fg,In.prototype.set=kg;var Og="Expected a function";function Fo(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(Og);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],s=n.cache;if(s.has(i))return s.get(i);var a=t.apply(this,r);return n.cache=s.set(i,a)||s,a};return n.cache=new(Fo.Cache||In),n}Fo.Cache=In;var Rg=500;function Ug(t){var e=Fo(t,function(r){return n.size===Rg&&n.clear(),r}),n=e.cache;return e}var Qg=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ng=/\\(\\)?/g,Gg=Ug(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(Qg,function(n,r,i,s){e.push(i?s.replace(Ng,"$1"):r||n)}),e});const Vg=Gg;function zg(t){return t==null?"":sh(t)}function Es(t,e){return Ee(t)?t:Po(t,e)?[t]:Vg(zg(t))}var Wg=1/0;function Ci(t){if(typeof t=="string"||ys(t))return t;var e=t+"";return e=="0"&&1/t==-Wg?"-0":e}function ko(t,e){e=Es(e,t);for(var n=0,r=e.length;t!=null&&n<r;)t=t[Ci(e[n++])];return n&&n==r?t:void 0}function Yg(t,e,n){var r=t==null?void 0:ko(t,e);return r===void 0?n:r}function Oo(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}var Bh=_t?_t.isConcatSpreadable:void 0;function jg(t){return Ee(t)||Bs(t)||!!(Bh&&t&&t[Bh])}function Ts(t,e,n,r,i){var s=-1,a=t.length;for(n||(n=jg),i||(i=[]);++s<a;){var o=t[s];e>0&&n(o)?e>1?Ts(o,e-1,n,r,i):Oo(i,o):r||(i[i.length]=o)}return i}function Nt(t){var e=t==null?0:t.length;return e?Ts(t,1):[]}var qg=xh(Object.getPrototypeOf,Object);const wh=qg;function bh(t,e,n){var r=-1,i=t.length;e<0&&(e=-e>i?0:i+e),n=n>i?i:n,n<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var s=Array(i);++r<i;)s[r]=t[r+e];return s}function Kg(t,e,n,r){var i=-1,s=t==null?0:t.length;for(r&&s&&(n=t[++i]);++i<s;)n=e(n,t[i],i,t);return n}function Xg(){this.__data__=new Cn,this.size=0}function Zg(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}function Jg(t){return this.__data__.get(t)}function Hg(t){return this.__data__.has(t)}var $g=200;function e8(t,e){var n=this.__data__;if(n instanceof Cn){var r=n.__data__;if(!yi||r.length<$g-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new In(r)}return n.set(t,e),this.size=n.size,this}function tn(t){var e=this.__data__=new Cn(t);this.size=e.size}tn.prototype.clear=Xg,tn.prototype.delete=Zg,tn.prototype.get=Jg,tn.prototype.has=Hg,tn.prototype.set=e8;function t8(t,e){return t&&fi(e,Ct(e),t)}function n8(t,e){return t&&fi(e,ws(e),t)}var _h=typeof k=="object"&&k&&!k.nodeType&&k,Eh=_h&&typeof module=="object"&&module&&!module.nodeType&&module,r8=Eh&&Eh.exports===_h,Th=r8?$t.Buffer:void 0,Mh=Th?Th.allocUnsafe:void 0;function i8(t,e){if(e)return t.slice();var n=t.length,r=Mh?Mh(n):new t.constructor(n);return t.copy(r),r}function Ro(t,e){for(var n=-1,r=t==null?0:t.length,i=0,s=[];++n<r;){var a=t[n];e(a,n,t)&&(s[i++]=a)}return s}function Dh(){return[]}var s8=Object.prototype,a8=s8.propertyIsEnumerable,Lh=Object.getOwnPropertySymbols,o8=Lh?function(t){return t==null?[]:(t=Object(t),Ro(Lh(t),function(e){return a8.call(t,e)}))}:Dh;const Uo=o8;function l8(t,e){return fi(t,Uo(t),e)}var c8=Object.getOwnPropertySymbols,h8=c8?function(t){for(var e=[];t;)Oo(e,Uo(t)),t=wh(t);return e}:Dh;const Ph=h8;function u8(t,e){return fi(t,Ph(t),e)}function Fh(t,e,n){var r=e(t);return Ee(t)?r:Oo(r,n(t))}function Qo(t){return Fh(t,Ct,Uo)}function kh(t){return Fh(t,ws,Ph)}var A8=lr($t,"DataView");const No=A8;var f8=lr($t,"Promise");const Go=f8;var d8=lr($t,"Set");const kr=d8;var Oh="[object Map]",p8="[object Object]",Rh="[object Promise]",Uh="[object Set]",Qh="[object WeakMap]",Nh="[object DataView]",g8=or(No),m8=or(yi),v8=or(Go),y8=or(kr),C8=or(bo),hr=Wn;(No&&hr(new No(new ArrayBuffer(1)))!=Nh||yi&&hr(new yi)!=Oh||Go&&hr(Go.resolve())!=Rh||kr&&hr(new kr)!=Uh||bo&&hr(new bo)!=Qh)&&(hr=function(t){var e=Wn(t),n=e==p8?t.constructor:void 0,r=n?or(n):"";if(r)switch(r){case g8:return Nh;case m8:return Oh;case v8:return Rh;case y8:return Uh;case C8:return Qh}return e});const Or=hr;var I8=Object.prototype,x8=I8.hasOwnProperty;function S8(t){var e=t.length,n=new t.constructor(e);return e&&typeof t[0]=="string"&&x8.call(t,"index")&&(n.index=t.index,n.input=t.input),n}var B8=$t.Uint8Array;const Ms=B8;function Vo(t){var e=new t.constructor(t.byteLength);return new Ms(e).set(new Ms(t)),e}function w8(t,e){var n=e?Vo(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}var b8=/\w*$/;function _8(t){var e=new t.constructor(t.source,b8.exec(t));return e.lastIndex=t.lastIndex,e}var Gh=_t?_t.prototype:void 0,Vh=Gh?Gh.valueOf:void 0;function E8(t){return Vh?Object(Vh.call(t)):{}}function T8(t,e){var n=e?Vo(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}var M8="[object Boolean]",D8="[object Date]",L8="[object Map]",P8="[object Number]",F8="[object RegExp]",k8="[object Set]",O8="[object String]",R8="[object Symbol]",U8="[object ArrayBuffer]",Q8="[object DataView]",N8="[object Float32Array]",G8="[object Float64Array]",V8="[object Int8Array]",z8="[object Int16Array]",W8="[object Int32Array]",Y8="[object Uint8Array]",j8="[object Uint8ClampedArray]",q8="[object Uint16Array]",K8="[object Uint32Array]";function X8(t,e,n){var r=t.constructor;switch(e){case U8:return Vo(t);case M8:case D8:return new r(+t);case Q8:return w8(t,n);case N8:case G8:case V8:case z8:case W8:case Y8:case j8:case q8:case K8:return T8(t,n);case L8:return new r;case P8:case O8:return new r(t);case F8:return _8(t);case k8:return new r;case R8:return E8(t)}}function Z8(t){return typeof t.constructor=="function"&&!di(t)?W6(wh(t)):{}}var J8="[object Map]";function H8(t){return Qt(t)&&Or(t)==J8}var zh=Yn&&Yn.isMap,$8=zh?gi(zh):H8;const em=$8;var tm="[object Set]";function nm(t){return Qt(t)&&Or(t)==tm}var Wh=Yn&&Yn.isSet,rm=Wh?gi(Wh):nm;const im=rm;var sm=1,am=2,om=4,Yh="[object Arguments]",lm="[object Array]",cm="[object Boolean]",hm="[object Date]",um="[object Error]",jh="[object Function]",Am="[object GeneratorFunction]",fm="[object Map]",dm="[object Number]",qh="[object Object]",pm="[object RegExp]",gm="[object Set]",mm="[object String]",vm="[object Symbol]",ym="[object WeakMap]",Cm="[object ArrayBuffer]",Im="[object DataView]",xm="[object Float32Array]",Sm="[object Float64Array]",Bm="[object Int8Array]",wm="[object Int16Array]",bm="[object Int32Array]",_m="[object Uint8Array]",Em="[object Uint8ClampedArray]",Tm="[object Uint16Array]",Mm="[object Uint32Array]",Pe={};Pe[Yh]=Pe[lm]=Pe[Cm]=Pe[Im]=Pe[cm]=Pe[hm]=Pe[xm]=Pe[Sm]=Pe[Bm]=Pe[wm]=Pe[bm]=Pe[fm]=Pe[dm]=Pe[qh]=Pe[pm]=Pe[gm]=Pe[mm]=Pe[vm]=Pe[_m]=Pe[Em]=Pe[Tm]=Pe[Mm]=!0,Pe[um]=Pe[jh]=Pe[ym]=!1;function Ds(t,e,n,r,i,s){var a,o=e&sm,l=e&am,h=e&om;if(n&&(a=i?n(t,r,i,s):n(t)),a!==void 0)return a;if(!Et(t))return t;var u=Ee(t);if(u){if(a=S8(t),!o)return j6(t,a)}else{var A=Or(t),f=A==jh||A==Am;if(pi(t))return i8(t,o);if(A==qh||A==Yh||f&&!i){if(a=l||f?{}:Z8(t),!o)return l?u8(t,n8(a,t)):l8(t,t8(a,t))}else{if(!Pe[A])return i?t:{};a=X8(t,A,o)}}s||(s=new tn);var d=s.get(t);if(d)return d;s.set(t,a),im(t)?t.forEach(function(C){a.add(Ds(C,e,n,C,t,s))}):em(t)&&t.forEach(function(C,x){a.set(x,Ds(C,e,n,x,t,s))});var m=h?l?kh:Qo:l?ws:Ct,y=u?void 0:m(t);return hh(y||t,function(C,x){y&&(x=C,C=t[x]),xs(a,x,Ds(C,e,n,x,t,s))}),a}var Dm=4;function rt(t){return Ds(t,Dm)}function Ii(t){for(var e=-1,n=t==null?0:t.length,r=0,i=[];++e<n;){var s=t[e];s&&(i[r++]=s)}return i}var Lm="__lodash_hash_undefined__";function Pm(t){return this.__data__.set(t,Lm),this}function Fm(t){return this.__data__.has(t)}function Rr(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new In;++e<n;)this.add(t[e])}Rr.prototype.add=Rr.prototype.push=Pm,Rr.prototype.has=Fm;function Kh(t,e){for(var n=-1,r=t==null?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}function zo(t,e){return t.has(e)}var km=1,Om=2;function Xh(t,e,n,r,i,s){var a=n&km,o=t.length,l=e.length;if(o!=l&&!(a&&l>o))return!1;var h=s.get(t),u=s.get(e);if(h&&u)return h==e&&u==t;var A=-1,f=!0,d=n&Om?new Rr:void 0;for(s.set(t,e),s.set(e,t);++A<o;){var m=t[A],y=e[A];if(r)var C=a?r(y,m,A,e,t,s):r(m,y,A,t,e,s);if(C!==void 0){if(C)continue;f=!1;break}if(d){if(!Kh(e,function(x,I){if(!zo(d,I)&&(m===x||i(m,x,n,r,s)))return d.push(I)})){f=!1;break}}else if(!(m===y||i(m,y,n,r,s))){f=!1;break}}return s.delete(t),s.delete(e),f}function Rm(t){var e=-1,n=Array(t.size);return t.forEach(function(r,i){n[++e]=[i,r]}),n}function Wo(t){var e=-1,n=Array(t.size);return t.forEach(function(r){n[++e]=r}),n}var Um=1,Qm=2,Nm="[object Boolean]",Gm="[object Date]",Vm="[object Error]",zm="[object Map]",Wm="[object Number]",Ym="[object RegExp]",jm="[object Set]",qm="[object String]",Km="[object Symbol]",Xm="[object ArrayBuffer]",Zm="[object DataView]",Zh=_t?_t.prototype:void 0,Yo=Zh?Zh.valueOf:void 0;function Jm(t,e,n,r,i,s,a){switch(n){case Zm:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case Xm:return!(t.byteLength!=e.byteLength||!s(new Ms(t),new Ms(e)));case Nm:case Gm:case Wm:return Ai(+t,+e);case Vm:return t.name==e.name&&t.message==e.message;case Ym:case qm:return t==e+"";case zm:var o=Rm;case jm:var l=r&Um;if(o||(o=Wo),t.size!=e.size&&!l)return!1;var h=a.get(t);if(h)return h==e;r|=Qm,a.set(t,e);var u=Xh(o(t),o(e),r,i,s,a);return a.delete(t),u;case Km:if(Yo)return Yo.call(t)==Yo.call(e)}return!1}var Hm=1,$m=Object.prototype,e4=$m.hasOwnProperty;function t4(t,e,n,r,i,s){var a=n&Hm,o=Qo(t),l=o.length,h=Qo(e),u=h.length;if(l!=u&&!a)return!1;for(var A=l;A--;){var f=o[A];if(!(a?f in e:e4.call(e,f)))return!1}var d=s.get(t),m=s.get(e);if(d&&m)return d==e&&m==t;var y=!0;s.set(t,e),s.set(e,t);for(var C=a;++A<l;){f=o[A];var x=t[f],I=e[f];if(r)var g=a?r(I,x,f,e,t,s):r(x,I,f,t,e,s);if(!(g===void 0?x===I||i(x,I,n,r,s):g)){y=!1;break}C||(C=f=="constructor")}if(y&&!C){var v=t.constructor,w=e.constructor;v!=w&&"constructor"in t&&"constructor"in e&&!(typeof v=="function"&&v instanceof v&&typeof w=="function"&&w instanceof w)&&(y=!1)}return s.delete(t),s.delete(e),y}var n4=1,Jh="[object Arguments]",Hh="[object Array]",Ls="[object Object]",r4=Object.prototype,$h=r4.hasOwnProperty;function i4(t,e,n,r,i,s){var a=Ee(t),o=Ee(e),l=a?Hh:Or(t),h=o?Hh:Or(e);l=l==Jh?Ls:l,h=h==Jh?Ls:h;var u=l==Ls,A=h==Ls,f=l==h;if(f&&pi(t)){if(!pi(e))return!1;a=!0,u=!1}if(f&&!u)return s||(s=new tn),a||Lo(t)?Xh(t,e,n,r,i,s):Jm(t,e,l,n,r,i,s);if(!(n&n4)){var d=u&&$h.call(t,"__wrapped__"),m=A&&$h.call(e,"__wrapped__");if(d||m){var y=d?t.value():t,C=m?e.value():e;return s||(s=new tn),i(y,C,n,r,s)}}return f?(s||(s=new tn),t4(t,e,n,r,i,s)):!1}function jo(t,e,n,r,i){return t===e?!0:t==null||e==null||!Qt(t)&&!Qt(e)?t!==t&&e!==e:i4(t,e,n,r,jo,i)}var s4=1,a4=2;function o4(t,e,n,r){var i=n.length,s=i,a=!r;if(t==null)return!s;for(t=Object(t);i--;){var o=n[i];if(a&&o[2]?o[1]!==t[o[0]]:!(o[0]in t))return!1}for(;++i<s;){o=n[i];var l=o[0],h=t[l],u=o[1];if(a&&o[2]){if(h===void 0&&!(l in t))return!1}else{var A=new tn;if(r)var f=r(h,u,l,t,e,A);if(!(f===void 0?jo(u,h,s4|a4,r,A):f))return!1}}return!0}function eu(t){return t===t&&!Et(t)}function l4(t){for(var e=Ct(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,eu(i)]}return e}function tu(t,e){return function(n){return n==null?!1:n[t]===e&&(e!==void 0||t in Object(n))}}function c4(t){var e=l4(t);return e.length==1&&e[0][2]?tu(e[0][0],e[0][1]):function(n){return n===t||o4(n,t,e)}}function h4(t,e){return t!=null&&e in Object(t)}function nu(t,e,n){e=Es(e,t);for(var r=-1,i=e.length,s=!1;++r<i;){var a=Ci(e[r]);if(!(s=t!=null&&n(t,a)))break;t=t[a]}return s||++r!=i?s:(i=t==null?0:t.length,!!i&&Mo(i)&&Is(a,i)&&(Ee(t)||Bs(t)))}function u4(t,e){return t!=null&&nu(t,e,h4)}var A4=1,f4=2;function d4(t,e){return Po(t)&&eu(e)?tu(Ci(t),e):function(n){var r=Yg(n,t);return r===void 0&&r===e?u4(n,t):jo(e,r,A4|f4)}}function p4(t){return function(e){return e==null?void 0:e[t]}}function g4(t){return function(e){return ko(e,t)}}function m4(t){return Po(t)?p4(Ci(t)):g4(t)}function nn(t){return typeof t=="function"?t:t==null?Fr:typeof t=="object"?Ee(t)?d4(t[0],t[1]):c4(t):m4(t)}function v4(t,e,n,r){for(var i=-1,s=t==null?0:t.length;++i<s;){var a=t[i];e(r,a,n(a),t)}return r}function y4(t){return function(e,n,r){for(var i=-1,s=Object(e),a=r(e),o=a.length;o--;){var l=a[t?o:++i];if(n(s[l],l,s)===!1)break}return e}}var C4=y4();const I4=C4;function x4(t,e){return t&&I4(t,e,Ct)}function S4(t,e){return function(n,r){if(n==null)return n;if(!en(n))return t(n,r);for(var i=n.length,s=e?i:-1,a=Object(n);(e?s--:++s<i)&&r(a[s],s,a)!==!1;);return n}}var B4=S4(x4);const ur=B4;function w4(t,e,n,r){return ur(t,function(i,s,a){e(r,i,n(i),a)}),r}function b4(t,e){return function(n,r){var i=Ee(n)?v4:w4,s=e?e():{};return i(n,t,nn(r),s)}}var ru=Object.prototype,_4=ru.hasOwnProperty,E4=To(function(t,e){t=Object(t);var n=-1,r=e.length,i=r>2?e[2]:void 0;for(i&&Ss(e[0],e[1],i)&&(r=1);++n<r;)for(var s=e[n],a=ws(s),o=-1,l=a.length;++o<l;){var h=a[o],u=t[h];(u===void 0||Ai(u,ru[h])&&!_4.call(t,h))&&(t[h]=s[h])}return t});const qo=E4;function iu(t){return Qt(t)&&en(t)}function su(t,e,n){for(var r=-1,i=t==null?0:t.length;++r<i;)if(n(e,t[r]))return!0;return!1}var T4=200;function M4(t,e,n,r){var i=-1,s=Ah,a=!0,o=t.length,l=[],h=e.length;if(!o)return l;n&&(e=hi(e,gi(n))),r?(s=su,a=!1):e.length>=T4&&(s=zo,a=!1,e=new Rr(e));e:for(;++i<o;){var u=t[i],A=n==null?u:n(u);if(u=r||u!==0?u:0,a&&A===A){for(var f=h;f--;)if(e[f]===A)continue e;l.push(u)}else s(e,A,r)||l.push(u)}return l}var D4=To(function(t,e){return iu(t)?M4(t,Ts(e,1,iu,!0)):[]});const Ps=D4;function Ur(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}function $e(t,e,n){var r=t==null?0:t.length;return r?(e=n||e===void 0?1:ui(e),bh(t,e<0?0:e,r)):[]}function xi(t,e,n){var r=t==null?0:t.length;return r?(e=n||e===void 0?1:ui(e),e=r-e,bh(t,0,e<0?0:e)):[]}function L4(t){return typeof t=="function"?t:Fr}function ge(t,e){var n=Ee(t)?hh:ur;return n(t,L4(e))}function P4(t,e){for(var n=-1,r=t==null?0:t.length;++n<r;)if(!e(t[n],n,t))return!1;return!0}function F4(t,e){var n=!0;return ur(t,function(r,i,s){return n=!!e(r,i,s),n}),n}function Gt(t,e,n){var r=Ee(t)?P4:F4;return n&&Ss(t,e,n)&&(e=void 0),r(t,nn(e))}function au(t,e){var n=[];return ur(t,function(r,i,s){e(r,i,s)&&n.push(r)}),n}function Tt(t,e){var n=Ee(t)?Ro:au;return n(t,nn(e))}function k4(t){return function(e,n,r){var i=Object(e);if(!en(e)){var s=nn(n);e=Ct(e),n=function(o){return s(i[o],o,i)}}var a=t(e,n,r);return a>-1?i[s?e[a]:a]:void 0}}var O4=Math.max;function R4(t,e,n){var r=t==null?0:t.length;if(!r)return-1;var i=n==null?0:ui(n);return i<0&&(i=O4(r+i,0)),uh(t,nn(e),i)}var U4=k4(R4);const Qr=U4;function Vt(t){return t&&t.length?t[0]:void 0}function Q4(t,e){var n=-1,r=en(t)?Array(t.length):[];return ur(t,function(i,s,a){r[++n]=e(i,s,a)}),r}function ue(t,e){var n=Ee(t)?hi:Q4;return n(t,nn(e))}function Mt(t,e){return Ts(ue(t,e),1)}var N4=Object.prototype,G4=N4.hasOwnProperty,V4=b4(function(t,e,n){G4.call(t,n)?t[n].push(e):Eo(t,n,[e])});const z4=V4;var W4=Object.prototype,Y4=W4.hasOwnProperty;function j4(t,e){return t!=null&&Y4.call(t,e)}function pe(t,e){return t!=null&&nu(t,e,j4)}var q4="[object String]";function ft(t){return typeof t=="string"||!Ee(t)&&Qt(t)&&Wn(t)==q4}function K4(t,e){return hi(e,function(n){return t[n]})}function Ze(t){return t==null?[]:K4(t,Ct(t))}var X4=Math.max;function lt(t,e,n,r){t=en(t)?t:Ze(t),n=n&&!r?ui(n):0;var i=t.length;return n<0&&(n=X4(i+n,0)),ft(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&_o(t,e,n)>-1}var Z4=Math.max;function ou(t,e,n){var r=t==null?0:t.length;if(!r)return-1;var i=n==null?0:ui(n);return i<0&&(i=Z4(r+i,0)),_o(t,e,i)}var J4="[object Map]",H4="[object Set]",$4=Object.prototype,e7=$4.hasOwnProperty;function Fe(t){if(t==null)return!0;if(en(t)&&(Ee(t)||typeof t=="string"||typeof t.splice=="function"||pi(t)||Lo(t)||Bs(t)))return!t.length;var e=Or(t);if(e==J4||e==H4)return!t.size;if(di(t))return!Sh(t).length;for(var n in t)if(e7.call(t,n))return!1;return!0}var t7="[object RegExp]";function n7(t){return Qt(t)&&Wn(t)==t7}var lu=Yn&&Yn.isRegExp,r7=lu?gi(lu):n7;const xn=r7;function Sn(t){return t===void 0}var i7="Expected a function";function s7(t){if(typeof t!="function")throw new TypeError(i7);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}function a7(t,e,n,r){if(!Et(t))return t;e=Es(e,t);for(var i=-1,s=e.length,a=s-1,o=t;o!=null&&++i<s;){var l=Ci(e[i]),h=n;if(l==="__proto__"||l==="constructor"||l==="prototype")return t;if(i!=a){var u=o[l];h=r?r(u,l,o):void 0,h===void 0&&(h=Et(u)?u:Is(e[i+1])?[]:{})}xs(o,l,h),o=o[l]}return t}function o7(t,e,n){for(var r=-1,i=e.length,s={};++r<i;){var a=e[r],o=ko(t,a);n(o,a)&&a7(s,Es(a,t),o)}return s}function zt(t,e){if(t==null)return{};var n=hi(kh(t),function(r){return[r]});return e=nn(e),o7(t,n,function(r,i){return e(r,i[0])})}function l7(t,e,n,r,i){return i(t,function(s,a,o){n=r?(r=!1,s):e(n,s,a,o)}),n}function xt(t,e,n){var r=Ee(t)?Kg:l7,i=arguments.length<3;return r(t,nn(e),n,i,ur)}function Fs(t,e){var n=Ee(t)?Ro:au;return n(t,s7(nn(e)))}function c7(t,e){var n;return ur(t,function(r,i,s){return n=e(r,i,s),!n}),!!n}function cu(t,e,n){var r=Ee(t)?Kh:c7;return n&&Ss(t,e,n)&&(e=void 0),r(t,nn(e))}var h7=1/0,u7=kr&&1/Wo(new kr([,-0]))[1]==h7?function(t){return new kr(t)}:Xe;const A7=u7;var f7=200;function d7(t,e,n){var r=-1,i=Ah,s=t.length,a=!0,o=[],l=o;if(n)a=!1,i=su;else if(s>=f7){var h=e?null:A7(t);if(h)return Wo(h);a=!1,i=zo,l=new Rr}else l=e?[]:o;e:for(;++r<s;){var u=t[r],A=e?e(u):u;if(u=n||u!==0?u:0,a&&A===A){for(var f=l.length;f--;)if(l[f]===A)continue e;e&&l.push(A),o.push(u)}else i(l,A,n)||(l!==o&&l.push(A),o.push(u))}return o}function Ko(t){return t&&t.length?d7(t):[]}function Xo(t){console&&console.error&&console.error(`Error: ${t}`)}function hu(t){console&&console.warn&&console.warn(`Warning: ${t}`)}function uu(t){const e=new Date().getTime(),n=t();return{time:new Date().getTime()-e,value:n}}function Au(t){function e(){}e.prototype=t;const n=new e;function r(){return typeof n.bar}return r(),r(),t}function p7(t){return g7(t)?t.LABEL:t.name}function g7(t){return ft(t.LABEL)&&t.LABEL!==""}class rn{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),ge(this.definition,n=>{n.accept(e)})}}class St extends rn{constructor(e){super([]),this.idx=1,It(this,zt(e,n=>n!==void 0))}set definition(e){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(e){e.visit(this)}}class Nr extends rn{constructor(e){super(e.definition),this.orgText="",It(this,zt(e,n=>n!==void 0))}}class dt extends rn{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,It(this,zt(e,n=>n!==void 0))}}class pt extends rn{constructor(e){super(e.definition),this.idx=1,It(this,zt(e,n=>n!==void 0))}}class sn extends rn{constructor(e){super(e.definition),this.idx=1,It(this,zt(e,n=>n!==void 0))}}class an extends rn{constructor(e){super(e.definition),this.idx=1,It(this,zt(e,n=>n!==void 0))}}class Je extends rn{constructor(e){super(e.definition),this.idx=1,It(this,zt(e,n=>n!==void 0))}}class Wt extends rn{constructor(e){super(e.definition),this.idx=1,It(this,zt(e,n=>n!==void 0))}}class Yt extends rn{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){super(e.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,It(this,zt(e,n=>n!==void 0))}}class Ne{constructor(e){this.idx=1,It(this,zt(e,n=>n!==void 0))}accept(e){e.visit(this)}}function m7(t){return ue(t,ks)}function ks(t){function e(n){return ue(n,ks)}if(t instanceof St){const n={type:"NonTerminal",name:t.nonTerminalName,idx:t.idx};return ft(t.label)&&(n.label=t.label),n}else{if(t instanceof dt)return{type:"Alternative",definition:e(t.definition)};if(t instanceof pt)return{type:"Option",idx:t.idx,definition:e(t.definition)};if(t instanceof sn)return{type:"RepetitionMandatory",idx:t.idx,definition:e(t.definition)};if(t instanceof an)return{type:"RepetitionMandatoryWithSeparator",idx:t.idx,separator:ks(new Ne({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof Wt)return{type:"RepetitionWithSeparator",idx:t.idx,separator:ks(new Ne({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof Je)return{type:"Repetition",idx:t.idx,definition:e(t.definition)};if(t instanceof Yt)return{type:"Alternation",idx:t.idx,definition:e(t.definition)};if(t instanceof Ne){const n={type:"Terminal",name:t.terminalType.name,label:p7(t.terminalType),idx:t.idx};ft(t.label)&&(n.terminalLabel=t.label);const r=t.terminalType.PATTERN;return t.terminalType.PATTERN&&(n.pattern=xn(r)?r.source:r),n}else{if(t instanceof Nr)return{type:"Rule",name:t.name,orgText:t.orgText,definition:e(t.definition)};throw Error("non exhaustive match")}}}class Gr{visit(e){const n=e;switch(n.constructor){case St:return this.visitNonTerminal(n);case dt:return this.visitAlternative(n);case pt:return this.visitOption(n);case sn:return this.visitRepetitionMandatory(n);case an:return this.visitRepetitionMandatoryWithSeparator(n);case Wt:return this.visitRepetitionWithSeparator(n);case Je:return this.visitRepetition(n);case Yt:return this.visitAlternation(n);case Ne:return this.visitTerminal(n);case Nr:return this.visitRule(n);default:throw Error("non exhaustive match")}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}}function v7(t){return t instanceof dt||t instanceof pt||t instanceof Je||t instanceof sn||t instanceof an||t instanceof Wt||t instanceof Ne||t instanceof Nr}function Os(t,e=[]){return t instanceof pt||t instanceof Je||t instanceof Wt?!0:t instanceof Yt?cu(t.definition,r=>Os(r,e)):t instanceof St&<(e,t)?!1:t instanceof rn?(t instanceof St&&e.push(t),Gt(t.definition,r=>Os(r,e))):!1}function y7(t){return t instanceof Yt}function on(t){if(t instanceof St)return"SUBRULE";if(t instanceof pt)return"OPTION";if(t instanceof Yt)return"OR";if(t instanceof sn)return"AT_LEAST_ONE";if(t instanceof an)return"AT_LEAST_ONE_SEP";if(t instanceof Wt)return"MANY_SEP";if(t instanceof Je)return"MANY";if(t instanceof Ne)return"CONSUME";throw Error("non exhaustive match")}class Rs{walk(e,n=[]){ge(e.definition,(r,i)=>{const s=$e(e.definition,i+1);if(r instanceof St)this.walkProdRef(r,s,n);else if(r instanceof Ne)this.walkTerminal(r,s,n);else if(r instanceof dt)this.walkFlat(r,s,n);else if(r instanceof pt)this.walkOption(r,s,n);else if(r instanceof sn)this.walkAtLeastOne(r,s,n);else if(r instanceof an)this.walkAtLeastOneSep(r,s,n);else if(r instanceof Wt)this.walkManySep(r,s,n);else if(r instanceof Je)this.walkMany(r,s,n);else if(r instanceof Yt)this.walkOr(r,s,n);else throw Error("non exhaustive match")})}walkTerminal(e,n,r){}walkProdRef(e,n,r){}walkFlat(e,n,r){const i=n.concat(r);this.walk(e,i)}walkOption(e,n,r){const i=n.concat(r);this.walk(e,i)}walkAtLeastOne(e,n,r){const i=[new pt({definition:e.definition})].concat(n,r);this.walk(e,i)}walkAtLeastOneSep(e,n,r){const i=fu(e,n,r);this.walk(e,i)}walkMany(e,n,r){const i=[new pt({definition:e.definition})].concat(n,r);this.walk(e,i)}walkManySep(e,n,r){const i=fu(e,n,r);this.walk(e,i)}walkOr(e,n,r){const i=n.concat(r);ge(e.definition,s=>{const a=new dt({definition:[s]});this.walk(a,i)})}}function fu(t,e,n){return[new pt({definition:[new Ne({terminalType:t.separator})].concat(t.definition)})].concat(e,n)}function Si(t){if(t instanceof St)return Si(t.referencedRule);if(t instanceof Ne)return x7(t);if(v7(t))return C7(t);if(y7(t))return I7(t);throw Error("non exhaustive match")}function C7(t){let e=[];const n=t.definition;let r=0,i=n.length>r,s,a=!0;for(;i&&a;)s=n[r],a=Os(s),e=e.concat(Si(s)),r=r+1,i=n.length>r;return Ko(e)}function I7(t){const e=ue(t.definition,n=>Si(n));return Ko(Nt(e))}function x7(t){return[t.terminalType]}const du="_~IN~_";class S7 extends Rs{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,n,r){}walkProdRef(e,n,r){const i=w7(e.referencedRule,e.idx)+this.topProd.name,s=n.concat(r),a=new dt({definition:s}),o=Si(a);this.follows[i]=o}}function B7(t){const e={};return ge(t,n=>{const r=new S7(n).startWalking();It(e,r)}),e}function w7(t,e){return t.name+e+du}function ve(t){return t.charCodeAt(0)}function Zo(t,e){Array.isArray(t)?t.forEach(function(n){e.push(n)}):e.push(t)}function Bi(t,e){if(t[e]===!0)throw"duplicate flag "+e;t[e],t[e]=!0}function Vr(t){if(t===void 0)throw Error("Internal Error - Should never get here!");return!0}function b7(){throw Error("Internal Error - Should never get here!")}function pu(t){return t.type==="Character"}const Us=[];for(let t=ve("0");t<=ve("9");t++)Us.push(t);const Qs=[ve("_")].concat(Us);for(let t=ve("a");t<=ve("z");t++)Qs.push(t);for(let t=ve("A");t<=ve("Z");t++)Qs.push(t);const gu=[ve(" "),ve("\f"),ve(`
|
|
925
|
+
`),ve("\r"),ve(" "),ve("\v"),ve(" "),ve(" "),ve(" "),ve(" "),ve(" "),ve(" "),ve(" "),ve(" "),ve(" "),ve(" "),ve(" "),ve(" "),ve(" "),ve(" "),ve("\u2028"),ve("\u2029"),ve(" "),ve(" "),ve(" "),ve("\uFEFF")],_7=/[0-9a-fA-F]/,Ns=/[0-9]/,E7=/[1-9]/;class T7{constructor(){this.idx=0,this.input="",this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(e){this.idx=e.idx,this.input=e.input,this.groupIdx=e.groupIdx}pattern(e){this.idx=0,this.input=e,this.groupIdx=0,this.consumeChar("/");const n=this.disjunction();this.consumeChar("/");const r={type:"Flags",loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case"g":Bi(r,"global");break;case"i":Bi(r,"ignoreCase");break;case"m":Bi(r,"multiLine");break;case"u":Bi(r,"unicode");break;case"y":Bi(r,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:r,value:n,loc:this.loc(0)}}disjunction(){const e=[],n=this.idx;for(e.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),e.push(this.alternative());return{type:"Disjunction",value:e,loc:this.loc(n)}}alternative(){const e=[],n=this.idx;for(;this.isTerm();)e.push(this.term());return{type:"Alternative",value:e,loc:this.loc(n)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){const e=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(e)};case"$":return{type:"EndAnchor",loc:this.loc(e)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(e)};case"B":return{type:"NonWordBoundary",loc:this.loc(e)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");let n;switch(this.popChar()){case"=":n="Lookahead";break;case"!":n="NegativeLookahead";break}Vr(n);const r=this.disjunction();return this.consumeChar(")"),{type:n,value:r,loc:this.loc(e)}}return b7()}quantifier(e=!1){let n;const r=this.idx;switch(this.popChar()){case"*":n={atLeast:0,atMost:1/0};break;case"+":n={atLeast:1,atMost:1/0};break;case"?":n={atLeast:0,atMost:1};break;case"{":const i=this.integerIncludingZero();switch(this.popChar()){case"}":n={atLeast:i,atMost:i};break;case",":let s;this.isDigit()?(s=this.integerIncludingZero(),n={atLeast:i,atMost:s}):n={atLeast:i,atMost:1/0},this.consumeChar("}");break}if(e===!0&&n===void 0)return;Vr(n);break}if(!(e===!0&&n===void 0)&&Vr(n))return this.peekChar(0)==="?"?(this.consumeChar("?"),n.greedy=!1):n.greedy=!0,n.type="Quantifier",n.loc=this.loc(r),n}atom(){let e;const n=this.idx;switch(this.peekChar()){case".":e=this.dotAll();break;case"\\":e=this.atomEscape();break;case"[":e=this.characterClass();break;case"(":e=this.group();break}if(e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),Vr(e))return e.loc=this.loc(n),this.isQuantifier()&&(e.quantifier=this.quantifier()),e}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[ve(`
|
|
926
|
+
`),ve("\r"),ve("\u2028"),ve("\u2029")]}}atomEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return this.decimalEscapeAtom();case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}decimalEscapeAtom(){return{type:"GroupBackReference",value:this.positiveInteger()}}characterClassEscape(){let e,n=!1;switch(this.popChar()){case"d":e=Us;break;case"D":e=Us,n=!0;break;case"s":e=gu;break;case"S":e=gu,n=!0;break;case"w":e=Qs;break;case"W":e=Qs,n=!0;break}if(Vr(e))return{type:"Set",value:e,complement:n}}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=ve("\f");break;case"n":e=ve(`
|
|
927
|
+
`);break;case"r":e=ve("\r");break;case"t":e=ve(" ");break;case"v":e=ve("\v");break}if(Vr(e))return{type:"Character",value:e}}controlLetterEscapeAtom(){this.consumeChar("c");const e=this.popChar();if(/[a-zA-Z]/.test(e)===!1)throw Error("Invalid ");return{type:"Character",value:e.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar("0"),{type:"Character",value:ve("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){const e=this.popChar();return{type:"Character",value:ve(e)}}classPatternCharacterAtom(){switch(this.peekChar()){case`
|
|
928
|
+
`:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:const e=this.popChar();return{type:"Character",value:ve(e)}}}characterClass(){const e=[];let n=!1;for(this.consumeChar("["),this.peekChar(0)==="^"&&(this.consumeChar("^"),n=!0);this.isClassAtom();){const r=this.classAtom();if(r.type,pu(r)&&this.isRangeDash()){this.consumeChar("-");const i=this.classAtom();if(i.type,pu(i)){if(i.value<r.value)throw Error("Range out of order in character class");e.push({from:r.value,to:i.value})}else Zo(r.value,e),e.push(ve("-")),Zo(i.value,e)}else Zo(r.value,e)}return this.consumeChar("]"),{type:"Set",complement:n,value:e}}classAtom(){switch(this.peekChar()){case"]":case`
|
|
929
|
+
`:case"\r":case"\u2028":case"\u2029":throw Error("TBD");case"\\":return this.classEscape();default:return this.classPatternCharacterAtom()}}classEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"b":return this.consumeChar("b"),{type:"Character",value:ve("\b")};case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}group(){let e=!0;switch(this.consumeChar("("),this.peekChar(0)){case"?":this.consumeChar("?"),this.consumeChar(":"),e=!1;break;default:this.groupIdx++;break}const n=this.disjunction();this.consumeChar(")");const r={type:"Group",capturing:e,value:n};return e&&(r.idx=this.groupIdx),r}positiveInteger(){let e=this.popChar();if(E7.test(e)===!1)throw Error("Expecting a positive integer");for(;Ns.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(Ns.test(e)===!1)throw Error("Expecting an integer");for(;Ns.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}patternCharacter(){const e=this.popChar();switch(e){case`
|
|
930
|
+
`:case"\r":case"\u2028":case"\u2029":case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":throw Error("TBD");default:return{type:"Character",value:ve(e)}}}isRegExpFlag(){switch(this.peekChar(0)){case"g":case"i":case"m":case"u":case"y":return!0;default:return!1}}isRangeDash(){return this.peekChar()==="-"&&this.isClassAtom(1)}isDigit(){return Ns.test(this.peekChar(0))}isClassAtom(e=0){switch(this.peekChar(e)){case"]":case`
|
|
931
|
+
`:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}isTerm(){return this.isAtom()||this.isAssertion()}isAtom(){if(this.isPatternCharacter())return!0;switch(this.peekChar(0)){case".":case"\\":case"[":case"(":return!0;default:return!1}}isAssertion(){switch(this.peekChar(0)){case"^":case"$":return!0;case"\\":switch(this.peekChar(1)){case"b":case"B":return!0;default:return!1}case"(":return this.peekChar(1)==="?"&&(this.peekChar(2)==="="||this.peekChar(2)==="!");default:return!1}}isQuantifier(){const e=this.saveState();try{return this.quantifier(!0)!==void 0}catch{return!1}finally{this.restoreState(e)}}isPatternCharacter(){switch(this.peekChar()){case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":case"/":case`
|
|
932
|
+
`:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}parseHexDigits(e){let n="";for(let i=0;i<e;i++){const s=this.popChar();if(_7.test(s)===!1)throw Error("Expecting a HexDecimal digits");n+=s}return{type:"Character",value:parseInt(n,16)}}peekChar(e=0){return this.input[this.idx+e]}popChar(){const e=this.peekChar(0);return this.consumeChar(void 0),e}consumeChar(e){if(e!==void 0&&this.input[this.idx]!==e)throw Error("Expected: '"+e+"' but found: '"+this.input[this.idx]+"' at offset: "+this.idx);if(this.idx>=this.input.length)throw Error("Unexpected end of input");this.idx++}loc(e){return{begin:e,end:this.idx}}}class Jo{visitChildren(e){for(const n in e){const r=e[n];e.hasOwnProperty(n)&&(r.type!==void 0?this.visit(r):Array.isArray(r)&&r.forEach(i=>{this.visit(i)},this))}}visit(e){switch(e.type){case"Pattern":this.visitPattern(e);break;case"Flags":this.visitFlags(e);break;case"Disjunction":this.visitDisjunction(e);break;case"Alternative":this.visitAlternative(e);break;case"StartAnchor":this.visitStartAnchor(e);break;case"EndAnchor":this.visitEndAnchor(e);break;case"WordBoundary":this.visitWordBoundary(e);break;case"NonWordBoundary":this.visitNonWordBoundary(e);break;case"Lookahead":this.visitLookahead(e);break;case"NegativeLookahead":this.visitNegativeLookahead(e);break;case"Character":this.visitCharacter(e);break;case"Set":this.visitSet(e);break;case"Group":this.visitGroup(e);break;case"GroupBackReference":this.visitGroupBackReference(e);break;case"Quantifier":this.visitQuantifier(e);break}this.visitChildren(e)}visitPattern(e){}visitFlags(e){}visitDisjunction(e){}visitAlternative(e){}visitStartAnchor(e){}visitEndAnchor(e){}visitWordBoundary(e){}visitNonWordBoundary(e){}visitLookahead(e){}visitNegativeLookahead(e){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}}let Gs={};const M7=new T7;function Vs(t){const e=t.toString();if(Gs.hasOwnProperty(e))return Gs[e];{const n=M7.pattern(e);return Gs[e]=n,n}}function D7(){Gs={}}const mu="Complement Sets are not supported for first char optimization",zs=`Unable to use "first char" lexer optimizations:
|
|
933
|
+
`;function L7(t,e=!1){try{const n=Vs(t);return Ho(n.value,{},n.flags.ignoreCase)}catch(n){if(n.message===mu)e&&hu(`${zs} Unable to optimize: < ${t.toString()} >
|
|
934
|
+
Complement Sets cannot be automatically optimized.
|
|
935
|
+
This will disable the lexer's first char optimizations.
|
|
936
|
+
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{let r="";e&&(r=`
|
|
937
|
+
This will disable the lexer's first char optimizations.
|
|
938
|
+
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),Xo(`${zs}
|
|
939
|
+
Failed parsing: < ${t.toString()} >
|
|
940
|
+
Using the @chevrotain/regexp-to-ast library
|
|
941
|
+
Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+r)}}return[]}function Ho(t,e,n){switch(t.type){case"Disjunction":for(let i=0;i<t.value.length;i++)Ho(t.value[i],e,n);break;case"Alternative":const r=t.value;for(let i=0;i<r.length;i++){const s=r[i];switch(s.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}const a=s;switch(a.type){case"Character":Ws(a.value,e,n);break;case"Set":if(a.complement===!0)throw Error(mu);ge(a.value,l=>{if(typeof l=="number")Ws(l,e,n);else{const h=l;if(n===!0)for(let u=h.from;u<=h.to;u++)Ws(u,e,n);else{for(let u=h.from;u<=h.to&&u<bi;u++)Ws(u,e,n);if(h.to>=bi){const u=h.from>=bi?h.from:bi,A=h.to,f=jn(u),d=jn(A);for(let m=f;m<=d;m++)e[m]=m}}}});break;case"Group":Ho(a.value,e,n);break;default:throw Error("Non Exhaustive Match")}const o=a.quantifier!==void 0&&a.quantifier.atLeast===0;if(a.type==="Group"&&$o(a)===!1||a.type!=="Group"&&o===!1)break}break;default:throw Error("non exhaustive match!")}return Ze(e)}function Ws(t,e,n){const r=jn(t);e[r]=r,n===!0&&P7(t,e)}function P7(t,e){const n=String.fromCharCode(t),r=n.toUpperCase();if(r!==n){const i=jn(r.charCodeAt(0));e[i]=i}else{const i=n.toLowerCase();if(i!==n){const s=jn(i.charCodeAt(0));e[s]=s}}}function vu(t,e){return Qr(t.value,n=>{if(typeof n=="number")return lt(e,n);{const r=n;return Qr(e,i=>r.from<=i&&i<=r.to)!==void 0}})}function $o(t){const e=t.quantifier;return e&&e.atLeast===0?!0:t.value?Ee(t.value)?Gt(t.value,$o):$o(t.value):!1}class F7 extends Jo{constructor(e){super(),this.targetCharCodes=e,this.found=!1}visitChildren(e){if(this.found!==!0){switch(e.type){case"Lookahead":this.visitLookahead(e);return;case"NegativeLookahead":this.visitNegativeLookahead(e);return}super.visitChildren(e)}}visitCharacter(e){lt(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?vu(e,this.targetCharCodes)===void 0&&(this.found=!0):vu(e,this.targetCharCodes)!==void 0&&(this.found=!0)}}function el(t,e){if(e instanceof RegExp){const n=Vs(e),r=new F7(t);return r.visit(n),r.found}else return Qr(e,n=>lt(t,n.charCodeAt(0)))!==void 0}const Ar="PATTERN",wi="defaultMode",Ys="modes";let yu=typeof new RegExp("(?:)").sticky=="boolean";function k7(t,e){e=qo(e,{useSticky:yu,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
|
|
942
|
+
`],tracer:(I,g)=>g()});const n=e.tracer;n("initCharCodeToOptimizedIndexMap",()=>{i9()});let r;n("Reject Lexer.NA",()=>{r=Fs(t,I=>I[Ar]===Dt.NA)});let i=!1,s;n("Transform Patterns",()=>{i=!1,s=ue(r,I=>{const g=I[Ar];if(xn(g)){const v=g.source;return v.length===1&&v!=="^"&&v!=="$"&&v!=="."&&!g.ignoreCase?v:v.length===2&&v[0]==="\\"&&!lt(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],v[1])?v[1]:e.useSticky?Iu(g):Cu(g)}else{if(yn(g))return i=!0,{exec:g};if(typeof g=="object")return i=!0,g;if(typeof g=="string"){if(g.length===1)return g;{const v=g.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),w=new RegExp(v);return e.useSticky?Iu(w):Cu(w)}}else throw Error("non exhaustive match")}})});let a,o,l,h,u;n("misc mapping",()=>{a=ue(r,I=>I.tokenTypeIdx),o=ue(r,I=>{const g=I.GROUP;if(g!==Dt.SKIPPED){if(ft(g))return g;if(Sn(g))return!1;throw Error("non exhaustive match")}}),l=ue(r,I=>{const g=I.LONGER_ALT;if(g)return Ee(g)?ue(g,w=>ou(r,w)):[ou(r,g)]}),h=ue(r,I=>I.PUSH_MODE),u=ue(r,I=>pe(I,"POP_MODE"))});let A;n("Line Terminator Handling",()=>{const I=Bu(e.lineTerminatorCharacters);A=ue(r,g=>!1),e.positionTracking!=="onlyOffset"&&(A=ue(r,g=>pe(g,"LINE_BREAKS")?!!g.LINE_BREAKS:Su(g,I)===!1&&el(I,g.PATTERN)))});let f,d,m,y;n("Misc Mapping #2",()=>{f=ue(r,xu),d=ue(s,t9),m=xt(r,(I,g)=>{const v=g.GROUP;return ft(v)&&v!==Dt.SKIPPED&&(I[v]=[]),I},{}),y=ue(s,(I,g)=>({pattern:s[g],longerAlt:l[g],canLineTerminator:A[g],isCustom:f[g],short:d[g],group:o[g],push:h[g],pop:u[g],tokenTypeIdx:a[g],tokenType:r[g]}))});let C=!0,x=[];return e.safeMode||n("First Char Optimization",()=>{x=xt(r,(I,g,v)=>{if(typeof g.PATTERN=="string"){const w=g.PATTERN.charCodeAt(0),b=jn(w);tl(I,b,y[v])}else if(Ee(g.START_CHARS_HINT)){let w;ge(g.START_CHARS_HINT,b=>{const B=typeof b=="string"?b.charCodeAt(0):b,_=jn(B);w!==_&&(w=_,tl(I,_,y[v]))})}else if(xn(g.PATTERN))if(g.PATTERN.unicode)C=!1,e.ensureOptimizations&&Xo(`${zs} Unable to analyze < ${g.PATTERN.toString()} > pattern.
|
|
943
|
+
The regexp unicode flag is not currently supported by the regexp-to-ast library.
|
|
944
|
+
This will disable the lexer's first char optimizations.
|
|
945
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{const w=L7(g.PATTERN,e.ensureOptimizations);Fe(w)&&(C=!1),ge(w,b=>{tl(I,b,y[v])})}else e.ensureOptimizations&&Xo(`${zs} TokenType: <${g.name}> is using a custom token pattern without providing <start_chars_hint> parameter.
|
|
946
|
+
This will disable the lexer's first char optimizations.
|
|
947
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),C=!1;return I},[])}),{emptyGroups:m,patternIdxToConfig:y,charCodeToPatternIdxToConfig:x,hasCustom:i,canBeOptimized:C}}function O7(t,e){let n=[];const r=U7(t);n=n.concat(r.errors);const i=Q7(r.valid),s=i.valid;return n=n.concat(i.errors),n=n.concat(R7(s)),n=n.concat(q7(s)),n=n.concat(K7(s,e)),n=n.concat(X7(s)),n}function R7(t){let e=[];const n=Tt(t,r=>xn(r[Ar]));return e=e.concat(G7(n)),e=e.concat(W7(n)),e=e.concat(Y7(n)),e=e.concat(j7(n)),e=e.concat(V7(n)),e}function U7(t){const e=Tt(t,i=>!pe(i,Ar)),n=ue(e,i=>({message:"Token Type: ->"+i.name+"<- missing static 'PATTERN' property",type:We.MISSING_PATTERN,tokenTypes:[i]})),r=Ps(t,e);return{errors:n,valid:r}}function Q7(t){const e=Tt(t,i=>{const s=i[Ar];return!xn(s)&&!yn(s)&&!pe(s,"exec")&&!ft(s)}),n=ue(e,i=>({message:"Token Type: ->"+i.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:We.INVALID_PATTERN,tokenTypes:[i]})),r=Ps(t,e);return{errors:n,valid:r}}const N7=/[^\\][$]/;function G7(t){class e extends Jo{constructor(){super(...arguments),this.found=!1}visitEndAnchor(s){this.found=!0}}const n=Tt(t,i=>{const s=i.PATTERN;try{const a=Vs(s),o=new e;return o.visit(a),o.found}catch{return N7.test(s.source)}});return ue(n,i=>({message:`Unexpected RegExp Anchor Error:
|
|
948
|
+
Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain end of input anchor '$'
|
|
949
|
+
See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:We.EOI_ANCHOR_FOUND,tokenTypes:[i]}))}function V7(t){const e=Tt(t,r=>r.PATTERN.test(""));return ue(e,r=>({message:"Token Type: ->"+r.name+"<- static 'PATTERN' must not match an empty string",type:We.EMPTY_MATCH_PATTERN,tokenTypes:[r]}))}const z7=/[^\\[][\^]|^\^/;function W7(t){class e extends Jo{constructor(){super(...arguments),this.found=!1}visitStartAnchor(s){this.found=!0}}const n=Tt(t,i=>{const s=i.PATTERN;try{const a=Vs(s),o=new e;return o.visit(a),o.found}catch{return z7.test(s.source)}});return ue(n,i=>({message:`Unexpected RegExp Anchor Error:
|
|
950
|
+
Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain start of input anchor '^'
|
|
951
|
+
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:We.SOI_ANCHOR_FOUND,tokenTypes:[i]}))}function Y7(t){const e=Tt(t,r=>{const i=r[Ar];return i instanceof RegExp&&(i.multiline||i.global)});return ue(e,r=>({message:"Token Type: ->"+r.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:We.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[r]}))}function j7(t){const e=[];let n=ue(t,s=>xt(t,(a,o)=>(s.PATTERN.source===o.PATTERN.source&&!lt(e,o)&&o.PATTERN!==Dt.NA&&(e.push(o),a.push(o)),a),[]));n=Ii(n);const r=Tt(n,s=>s.length>1);return ue(r,s=>{const a=ue(s,l=>l.name);return{message:`The same RegExp pattern ->${Vt(s).PATTERN}<-has been used in all of the following Token Types: ${a.join(", ")} <-`,type:We.DUPLICATE_PATTERNS_FOUND,tokenTypes:s}})}function q7(t){const e=Tt(t,r=>{if(!pe(r,"GROUP"))return!1;const i=r.GROUP;return i!==Dt.SKIPPED&&i!==Dt.NA&&!ft(i)});return ue(e,r=>({message:"Token Type: ->"+r.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:We.INVALID_GROUP_TYPE_FOUND,tokenTypes:[r]}))}function K7(t,e){const n=Tt(t,i=>i.PUSH_MODE!==void 0&&!lt(e,i.PUSH_MODE));return ue(n,i=>({message:`Token Type: ->${i.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${i.PUSH_MODE}<-which does not exist`,type:We.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[i]}))}function X7(t){const e=[],n=xt(t,(r,i,s)=>{const a=i.PATTERN;return a===Dt.NA||(ft(a)?r.push({str:a,idx:s,tokenType:i}):xn(a)&&J7(a)&&r.push({str:a.source,idx:s,tokenType:i})),r},[]);return ge(t,(r,i)=>{ge(n,({str:s,idx:a,tokenType:o})=>{if(i<a&&Z7(s,r.PATTERN)){const l=`Token: ->${o.name}<- can never be matched.
|
|
952
|
+
Because it appears AFTER the Token Type ->${r.name}<-in the lexer's definition.
|
|
953
|
+
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;e.push({message:l,type:We.UNREACHABLE_PATTERN,tokenTypes:[r,o]})}})}),e}function Z7(t,e){if(xn(e)){const n=e.exec(t);return n!==null&&n.index===0}else{if(yn(e))return e(t,0,[],{});if(pe(e,"exec"))return e.exec(t,0,[],{});if(typeof e=="string")return e===t;throw Error("non exhaustive match")}}function J7(t){return Qr([".","\\","[","]","|","^","$","(",")","?","*","+","{"],n=>t.source.indexOf(n)!==-1)===void 0}function Cu(t){const e=t.ignoreCase?"i":"";return new RegExp(`^(?:${t.source})`,e)}function Iu(t){const e=t.ignoreCase?"iy":"y";return new RegExp(`${t.source}`,e)}function H7(t,e,n){const r=[];return pe(t,wi)||r.push({message:"A MultiMode Lexer cannot be initialized without a <"+wi+`> property in its definition
|
|
954
|
+
`,type:We.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),pe(t,Ys)||r.push({message:"A MultiMode Lexer cannot be initialized without a <"+Ys+`> property in its definition
|
|
955
|
+
`,type:We.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),pe(t,Ys)&&pe(t,wi)&&!pe(t.modes,t.defaultMode)&&r.push({message:`A MultiMode Lexer cannot be initialized with a ${wi}: <${t.defaultMode}>which does not exist
|
|
956
|
+
`,type:We.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),pe(t,Ys)&&ge(t.modes,(i,s)=>{ge(i,(a,o)=>{if(Sn(a))r.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${s}> at index: <${o}>
|
|
957
|
+
`,type:We.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED});else if(pe(a,"LONGER_ALT")){const l=Ee(a.LONGER_ALT)?a.LONGER_ALT:[a.LONGER_ALT];ge(l,h=>{!Sn(h)&&!lt(i,h)&&r.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${h.name}> on token <${a.name}> outside of mode <${s}>
|
|
958
|
+
`,type:We.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})}})}),r}function $7(t,e,n){const r=[];let i=!1;const s=Ii(Nt(Ze(t.modes))),a=Fs(s,l=>l[Ar]===Dt.NA),o=Bu(n);return e&&ge(a,l=>{const h=Su(l,o);if(h!==!1){const A={message:r9(l,h),type:h.issue,tokenType:l};r.push(A)}else pe(l,"LINE_BREAKS")?l.LINE_BREAKS===!0&&(i=!0):el(o,l.PATTERN)&&(i=!0)}),e&&!i&&r.push({message:`Warning: No LINE_BREAKS Found.
|
|
959
|
+
This Lexer has been defined to track line and column information,
|
|
960
|
+
But none of the Token Types can be identified as matching a line terminator.
|
|
961
|
+
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS
|
|
962
|
+
for details.`,type:We.NO_LINE_BREAKS_FLAGS}),r}function e9(t){const e={},n=Ct(t);return ge(n,r=>{const i=t[r];if(Ee(i))e[r]=[];else throw Error("non exhaustive match")}),e}function xu(t){const e=t.PATTERN;if(xn(e))return!1;if(yn(e))return!0;if(pe(e,"exec"))return!0;if(ft(e))return!1;throw Error("non exhaustive match")}function t9(t){return ft(t)&&t.length===1?t.charCodeAt(0):!1}const n9={test:function(t){const e=t.length;for(let n=this.lastIndex;n<e;n++){const r=t.charCodeAt(n);if(r===10)return this.lastIndex=n+1,!0;if(r===13)return t.charCodeAt(n+1)===10?this.lastIndex=n+2:this.lastIndex=n+1,!0}return!1},lastIndex:0};function Su(t,e){if(pe(t,"LINE_BREAKS"))return!1;if(xn(t.PATTERN)){try{el(e,t.PATTERN)}catch(n){return{issue:We.IDENTIFY_TERMINATOR,errMsg:n.message}}return!1}else{if(ft(t.PATTERN))return!1;if(xu(t))return{issue:We.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}}function r9(t,e){if(e.issue===We.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.
|
|
963
|
+
The problem is in the <${t.name}> Token Type
|
|
964
|
+
Root cause: ${e.errMsg}.
|
|
965
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(e.issue===We.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.
|
|
966
|
+
The problem is in the <${t.name}> Token Type
|
|
967
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}function Bu(t){return ue(t,n=>ft(n)?n.charCodeAt(0):n)}function tl(t,e,n){t[e]===void 0?t[e]=[n]:t[e].push(n)}const bi=256;let js=[];function jn(t){return t<bi?t:js[t]}function i9(){if(Fe(js)){js=new Array(65536);for(let t=0;t<65536;t++)js[t]=t>255?255+~~(t/255):t}}function _i(t,e){const n=t.tokenTypeIdx;return n===e.tokenTypeIdx?!0:e.isParent===!0&&e.categoryMatchesMap[n]===!0}function qs(t,e){return t.tokenTypeIdx===e.tokenTypeIdx}let wu=1;const bu={};function Ei(t){const e=s9(t);a9(e),l9(e),o9(e),ge(e,n=>{n.isParent=n.categoryMatches.length>0})}function s9(t){let e=rt(t),n=t,r=!0;for(;r;){n=Ii(Nt(ue(n,s=>s.CATEGORIES)));const i=Ps(n,e);e=e.concat(i),Fe(i)?r=!1:n=i}return e}function a9(t){ge(t,e=>{Eu(e)||(bu[wu]=e,e.tokenTypeIdx=wu++),Tu(e)&&!Ee(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),Tu(e)||(e.CATEGORIES=[]),c9(e)||(e.categoryMatches=[]),h9(e)||(e.categoryMatchesMap={})})}function o9(t){ge(t,e=>{e.categoryMatches=[],ge(e.categoryMatchesMap,(n,r)=>{e.categoryMatches.push(bu[r].tokenTypeIdx)})})}function l9(t){ge(t,e=>{_u([],e)})}function _u(t,e){ge(t,n=>{e.categoryMatchesMap[n.tokenTypeIdx]=!0}),ge(e.CATEGORIES,n=>{const r=t.concat(e);lt(r,n)||_u(r,n)})}function Eu(t){return pe(t,"tokenTypeIdx")}function Tu(t){return pe(t,"CATEGORIES")}function c9(t){return pe(t,"categoryMatches")}function h9(t){return pe(t,"categoryMatchesMap")}function u9(t){return pe(t,"tokenTypeIdx")}const A9={buildUnableToPopLexerModeMessage(t){return`Unable to pop Lexer Mode after encountering Token ->${t.image}<- The Mode Stack is empty`},buildUnexpectedCharactersMessage(t,e,n,r,i){return`unexpected character: ->${t.charAt(e)}<- at offset: ${e}, skipped ${n} characters.`}};var We;(function(t){t[t.MISSING_PATTERN=0]="MISSING_PATTERN",t[t.INVALID_PATTERN=1]="INVALID_PATTERN",t[t.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",t[t.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",t[t.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",t[t.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",t[t.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",t[t.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",t[t.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",t[t.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",t[t.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",t[t.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",t[t.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",t[t.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",t[t.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",t[t.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",t[t.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",t[t.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE"})(We||(We={}));const Ti={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
|
|
968
|
+
`,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:A9,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(Ti);class Dt{constructor(e,n=Ti){if(this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},this.TRACE_INIT=(i,s)=>{if(this.traceInitPerf===!0){this.traceInitIndent++;const a=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${a}--> <${i}>`);const{time:o,value:l}=uu(s),h=o>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&h(`${a}<-- <${i}> time: ${o}ms`),this.traceInitIndent--,l}else return s()},typeof n=="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
|
|
969
|
+
a boolean 2nd argument is no longer supported`);this.config=It({},Ti,n);const r=this.config.traceInitPerf;r===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof r=="number"&&(this.traceInitMaxIdent=r,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",()=>{let i,s=!0;this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===Ti.lineTerminatorsPattern)this.config.lineTerminatorsPattern=n9;else if(this.config.lineTerminatorCharacters===Ti.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
|
|
970
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(n.safeMode&&n.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');this.trackStartLines=/full|onlyStart/i.test(this.config.positionTracking),this.trackEndLines=/full/i.test(this.config.positionTracking),Ee(e)?i={modes:{defaultMode:rt(e)},defaultMode:wi}:(s=!1,i=rt(e))}),this.config.skipValidations===!1&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(H7(i,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat($7(i,this.trackStartLines,this.config.lineTerminatorCharacters))})),i.modes=i.modes?i.modes:{},ge(i.modes,(o,l)=>{i.modes[l]=Fs(o,h=>Sn(h))});const a=Ct(i.modes);if(ge(i.modes,(o,l)=>{this.TRACE_INIT(`Mode: <${l}> processing`,()=>{if(this.modes.push(l),this.config.skipValidations===!1&&this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(O7(o,a))}),Fe(this.lexerDefinitionErrors)){Ei(o);let h;this.TRACE_INIT("analyzeTokenTypes",()=>{h=k7(o,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:n.positionTracking,ensureOptimizations:n.ensureOptimizations,safeMode:n.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[l]=h.patternIdxToConfig,this.charCodeToPatternIdxToConfig[l]=h.charCodeToPatternIdxToConfig,this.emptyGroups=It({},this.emptyGroups,h.emptyGroups),this.hasCustom=h.hasCustom||this.hasCustom,this.canModeBeOptimized[l]=h.canBeOptimized}})}),this.defaultMode=i.defaultMode,!Fe(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){const l=ue(this.lexerDefinitionErrors,h=>h.message).join(`-----------------------
|
|
971
|
+
`);throw new Error(`Errors detected in definition of Lexer:
|
|
972
|
+
`+l)}ge(this.lexerDefinitionWarning,o=>{hu(o.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(yu?(this.chopInput=Fr,this.match=this.matchWithTest):(this.updateLastIndex=Xe,this.match=this.matchWithExec),s&&(this.handleModes=Xe),this.trackStartLines===!1&&(this.computeNewColumn=Fr),this.trackEndLines===!1&&(this.updateTokenEndLineColumnLocation=Xe),/full/i.test(this.config.positionTracking))this.createTokenInstance=this.createFullToken;else if(/onlyStart/i.test(this.config.positionTracking))this.createTokenInstance=this.createStartOnlyToken;else if(/onlyOffset/i.test(this.config.positionTracking))this.createTokenInstance=this.createOffsetOnlyToken;else throw Error(`Invalid <positionTracking> config option: "${this.config.positionTracking}"`);this.hasCustom?(this.addToken=this.addTokenUsingPush,this.handlePayload=this.handlePayloadWithCustom):(this.addToken=this.addTokenUsingMemberAccess,this.handlePayload=this.handlePayloadNoCustom)}),this.TRACE_INIT("Failed Optimization Warnings",()=>{const o=xt(this.canModeBeOptimized,(l,h,u)=>(h===!1&&l.push(u),l),[]);if(n.ensureOptimizations&&!Fe(o))throw Error(`Lexer Modes: < ${o.join(", ")} > cannot be optimized.
|
|
973
|
+
Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.
|
|
974
|
+
Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT("clearRegExpParserCache",()=>{D7()}),this.TRACE_INIT("toFastProperties",()=>{Au(this)})})}tokenize(e,n=this.defaultMode){if(!Fe(this.lexerDefinitionErrors)){const i=ue(this.lexerDefinitionErrors,s=>s.message).join(`-----------------------
|
|
975
|
+
`);throw new Error(`Unable to Tokenize because Errors detected in definition of Lexer:
|
|
976
|
+
`+i)}return this.tokenizeInternal(e,n)}tokenizeInternal(e,n){let r,i,s,a,o,l,h,u,A,f,d,m,y,C,x;const I=e,g=I.length;let v=0,w=0;const b=this.hasCustom?0:Math.floor(e.length/10),B=new Array(b),_=[];let E=this.trackStartLines?1:void 0,T=this.trackStartLines?1:void 0;const L=e9(this.emptyGroups),R=this.trackStartLines,V=this.config.lineTerminatorsPattern;let Y=0,q=[],ne=[];const X=[],G=[];Object.freeze(G);let H;function Z(){return q}function $(z){const P=jn(z),K=ne[P];return K===void 0?G:K}const O=z=>{if(X.length===1&&z.tokenType.PUSH_MODE===void 0){const P=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(z);_.push({offset:z.startOffset,line:z.startLine,column:z.startColumn,length:z.image.length,message:P})}else{X.pop();const P=Ur(X);q=this.patternIdxToConfig[P],ne=this.charCodeToPatternIdxToConfig[P],Y=q.length;const K=this.canModeBeOptimized[P]&&this.config.safeMode===!1;ne&&K?H=$:H=Z}};function F(z){X.push(z),ne=this.charCodeToPatternIdxToConfig[z],q=this.patternIdxToConfig[z],Y=q.length,Y=q.length;const P=this.canModeBeOptimized[z]&&this.config.safeMode===!1;ne&&P?H=$:H=Z}F.call(this,n);let S;const Q=this.config.recoveryEnabled;for(;v<g;){l=null;const z=I.charCodeAt(v),P=H(z),K=P.length;for(r=0;r<K;r++){S=P[r];const se=S.pattern;h=null;const J=S.short;if(J!==!1?z===J&&(l=se):S.isCustom===!0?(x=se.exec(I,v,B,L),x!==null?(l=x[0],x.payload!==void 0&&(h=x.payload)):l=null):(this.updateLastIndex(se,v),l=this.match(se,e,v)),l!==null){if(o=S.longerAlt,o!==void 0){const ie=o.length;for(s=0;s<ie;s++){const ee=q[o[s]],fe=ee.pattern;if(u=null,ee.isCustom===!0?(x=fe.exec(I,v,B,L),x!==null?(a=x[0],x.payload!==void 0&&(u=x.payload)):a=null):(this.updateLastIndex(fe,v),a=this.match(fe,e,v)),a&&a.length>l.length){l=a,h=u,S=ee;break}}}break}}if(l!==null){if(A=l.length,f=S.group,f!==void 0&&(d=S.tokenTypeIdx,m=this.createTokenInstance(l,v,d,S.tokenType,E,T,A),this.handlePayload(m,h),f===!1?w=this.addToken(B,w,m):L[f].push(m)),e=this.chopInput(e,A),v=v+A,T=this.computeNewColumn(T,A),R===!0&&S.canLineTerminator===!0){let se=0,J,ie;V.lastIndex=0;do J=V.test(l),J===!0&&(ie=V.lastIndex-1,se++);while(J===!0);se!==0&&(E=E+se,T=A-ie,this.updateTokenEndLineColumnLocation(m,f,ie,se,E,T,A))}this.handleModes(S,O,F,m)}else{const se=v,J=E,ie=T;let ee=Q===!1;for(;ee===!1&&v<g;)for(e=this.chopInput(e,1),v++,i=0;i<Y;i++){const fe=q[i],te=fe.pattern,oe=fe.short;if(oe!==!1?I.charCodeAt(v)===oe&&(ee=!0):fe.isCustom===!0?ee=te.exec(I,v,B,L)!==null:(this.updateLastIndex(te,v),ee=te.exec(e)!==null),ee===!0)break}if(y=v-se,T=this.computeNewColumn(T,y),C=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(I,se,y,J,ie),_.push({offset:se,line:J,column:ie,length:y,message:C}),Q===!1)break}}return this.hasCustom||(B.length=w),{tokens:B,groups:L,errors:_}}handleModes(e,n,r,i){if(e.pop===!0){const s=e.push;n(i),s!==void 0&&r.call(this,s)}else e.push!==void 0&&r.call(this,e.push)}chopInput(e,n){return e.substring(n)}updateLastIndex(e,n){e.lastIndex=n}updateTokenEndLineColumnLocation(e,n,r,i,s,a,o){let l,h;n!==void 0&&(l=r===o-1,h=l?-1:0,i===1&&l===!0||(e.endLine=s+h,e.endColumn=a-1+-h))}computeNewColumn(e,n){return e+n}createOffsetOnlyToken(e,n,r,i){return{image:e,startOffset:n,tokenTypeIdx:r,tokenType:i}}createStartOnlyToken(e,n,r,i,s,a){return{image:e,startOffset:n,startLine:s,startColumn:a,tokenTypeIdx:r,tokenType:i}}createFullToken(e,n,r,i,s,a,o){return{image:e,startOffset:n,endOffset:n+o-1,startLine:s,endLine:s,startColumn:a,endColumn:a+o-1,tokenTypeIdx:r,tokenType:i}}addTokenUsingPush(e,n,r){return e.push(r),n}addTokenUsingMemberAccess(e,n,r){return e[n]=r,n++,n}handlePayloadNoCustom(e,n){}handlePayloadWithCustom(e,n){n!==null&&(e.payload=n)}matchWithTest(e,n,r){return e.test(n)===!0?n.substring(r,e.lastIndex):null}matchWithExec(e,n){const r=e.exec(n);return r!==null?r[0]:null}}Dt.SKIPPED="This marks a skipped Token pattern, this means each token identified by it willbe consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.",Dt.NA=/NOT_APPLICABLE/;function Mi(t){return Mu(t)?t.LABEL:t.name}function Mu(t){return ft(t.LABEL)&&t.LABEL!==""}const f9="parent",Du="categories",Lu="label",Pu="group",Fu="push_mode",ku="pop_mode",Ou="longer_alt",Ru="line_breaks",Uu="start_chars_hint";function Qu(t){return d9(t)}function d9(t){const e=t.pattern,n={};if(n.name=t.name,Sn(e)||(n.PATTERN=e),pe(t,f9))throw`The parent property is no longer supported.
|
|
977
|
+
See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return pe(t,Du)&&(n.CATEGORIES=t[Du]),Ei([n]),pe(t,Lu)&&(n.LABEL=t[Lu]),pe(t,Pu)&&(n.GROUP=t[Pu]),pe(t,ku)&&(n.POP_MODE=t[ku]),pe(t,Fu)&&(n.PUSH_MODE=t[Fu]),pe(t,Ou)&&(n.LONGER_ALT=t[Ou]),pe(t,Ru)&&(n.LINE_BREAKS=t[Ru]),pe(t,Uu)&&(n.START_CHARS_HINT=t[Uu]),n}const fr=Qu({name:"EOF",pattern:Dt.NA});Ei([fr]);function nl(t,e,n,r,i,s,a,o){return{image:e,startOffset:n,endOffset:r,startLine:i,endLine:s,startColumn:a,endColumn:o,tokenTypeIdx:t.tokenTypeIdx,tokenType:t}}function p9(t,e){return _i(t,e)}const Nu={buildMismatchTokenMessage({expected:t,actual:e,previous:n,ruleName:r}){return`Expecting ${Mu(t)?`--> ${Mi(t)} <--`:`token of type --> ${t.name} <--`} but found --> '${e.image}' <--`},buildNotAllInputParsedMessage({firstRedundant:t,ruleName:e}){return"Redundant input, expecting EOF but found: "+t.image},buildNoViableAltMessage({expectedPathsPerAlt:t,actual:e,previous:n,customUserDescription:r,ruleName:i}){const s="Expecting: ",o=`
|
|
978
|
+
but found: '`+Vt(e).image+"'";if(r)return s+r+o;{const l=xt(t,(f,d)=>f.concat(d),[]),h=ue(l,f=>`[${ue(f,d=>Mi(d)).join(", ")}]`),A=`one of these possible Token sequences:
|
|
979
|
+
${ue(h,(f,d)=>` ${d+1}. ${f}`).join(`
|
|
980
|
+
`)}`;return s+A+o}},buildEarlyExitMessage({expectedIterationPaths:t,actual:e,customUserDescription:n,ruleName:r}){const i="Expecting: ",a=`
|
|
981
|
+
but found: '`+Vt(e).image+"'";if(n)return i+n+a;{const l=`expecting at least one iteration which starts with one of these possible Token sequences::
|
|
982
|
+
<${ue(t,h=>`[${ue(h,u=>Mi(u)).join(",")}]`).join(" ,")}>`;return i+l+a}}};Object.freeze(Nu);const g9={buildRuleNotFoundError(t,e){return"Invalid grammar, reference to a rule which is not defined: ->"+e.nonTerminalName+`<-
|
|
983
|
+
inside top level rule: ->`+t.name+"<-"}},dr={buildDuplicateFoundError(t,e){function n(u){return u instanceof Ne?u.terminalType.name:u instanceof St?u.nonTerminalName:""}const r=t.name,i=Vt(e),s=i.idx,a=on(i),o=n(i),l=s>0;let h=`->${a}${l?s:""}<- ${o?`with argument: ->${o}<-`:""}
|
|
984
|
+
appears more than once (${e.length} times) in the top level rule: ->${r}<-.
|
|
985
|
+
For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES
|
|
986
|
+
`;return h=h.replace(/[ \t]+/g," "),h=h.replace(/\s\s+/g,`
|
|
987
|
+
`),h},buildNamespaceConflictError(t){return`Namespace conflict found in grammar.
|
|
988
|
+
The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${t.name}>.
|
|
989
|
+
To resolve this make sure each Terminal and Non-Terminal names are unique
|
|
990
|
+
This is easy to accomplish by using the convention that Terminal names start with an uppercase letter
|
|
991
|
+
and Non-Terminal names start with a lower case letter.`},buildAlternationPrefixAmbiguityError(t){const e=ue(t.prefixPath,i=>Mi(i)).join(", "),n=t.alternation.idx===0?"":t.alternation.idx;return`Ambiguous alternatives: <${t.ambiguityIndices.join(" ,")}> due to common lookahead prefix
|
|
992
|
+
in <OR${n}> inside <${t.topLevelRule.name}> Rule,
|
|
993
|
+
<${e}> may appears as a prefix path in all these alternatives.
|
|
994
|
+
See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX
|
|
995
|
+
For Further details.`},buildAlternationAmbiguityError(t){const e=ue(t.prefixPath,i=>Mi(i)).join(", "),n=t.alternation.idx===0?"":t.alternation.idx;let r=`Ambiguous Alternatives Detected: <${t.ambiguityIndices.join(" ,")}> in <OR${n}> inside <${t.topLevelRule.name}> Rule,
|
|
996
|
+
<${e}> may appears as a prefix path in all these alternatives.
|
|
997
|
+
`;return r=r+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
|
|
998
|
+
For Further details.`,r},buildEmptyRepetitionError(t){let e=on(t.repetition);return t.repetition.idx!==0&&(e+=t.repetition.idx),`The repetition <${e}> within Rule <${t.topLevelRule.name}> can never consume any tokens.
|
|
999
|
+
This could lead to an infinite loop.`},buildTokenNameError(t){return"deprecated"},buildEmptyAlternationError(t){return`Ambiguous empty alternative: <${t.emptyChoiceIdx+1}> in <OR${t.alternation.idx}> inside <${t.topLevelRule.name}> Rule.
|
|
1000
|
+
Only the last alternative may be an empty alternative.`},buildTooManyAlternativesError(t){return`An Alternation cannot have more than 256 alternatives:
|
|
1001
|
+
<OR${t.alternation.idx}> inside <${t.topLevelRule.name}> Rule.
|
|
1002
|
+
has ${t.alternation.definition.length+1} alternatives.`},buildLeftRecursionError(t){const e=t.topLevelRule.name,n=ue(t.leftRecursionPath,s=>s.name),r=`${e} --> ${n.concat([e]).join(" --> ")}`;return`Left Recursion found in grammar.
|
|
1003
|
+
rule: <${e}> can be invoked from itself (directly or indirectly)
|
|
1004
|
+
without consuming any Tokens. The grammar path that causes this is:
|
|
1005
|
+
${r}
|
|
1006
|
+
To fix this refactor your grammar to remove the left recursion.
|
|
1007
|
+
see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(t){return"deprecated"},buildDuplicateRuleNameError(t){let e;return t.topLevelRule instanceof Nr?e=t.topLevelRule.name:e=t.topLevelRule,`Duplicate definition, rule: ->${e}<- is already defined in the grammar: ->${t.grammarName}<-`}};function m9(t,e){const n=new v9(t,e);return n.resolveRefs(),n.errors}class v9 extends Gr{constructor(e,n){super(),this.nameToTopRule=e,this.errMsgProvider=n,this.errors=[]}resolveRefs(){ge(Ze(this.nameToTopRule),e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){const n=this.nameToTopRule[e.nonTerminalName];if(n)e.referencedRule=n;else{const r=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:r,type:ct.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}}class y9 extends Rs{constructor(e,n){super(),this.topProd=e,this.path=n,this.possibleTokTypes=[],this.nextProductionName="",this.nextProductionOccurrence=0,this.found=!1,this.isAtEndOfPath=!1}startWalking(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=rt(this.path.ruleStack).reverse(),this.occurrenceStack=rt(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,n=[]){this.found||super.walk(e,n)}walkProdRef(e,n,r){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){const i=n.concat(r);this.updateExpectedNext(),this.walk(e.referencedRule,i)}}updateExpectedNext(){Fe(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}}class C9 extends y9{constructor(e,n){super(e,n),this.path=n,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,n,r){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){const i=n.concat(r),s=new dt({definition:i});this.possibleTokTypes=Si(s),this.found=!0}}}class Ks extends Rs{constructor(e,n){super(),this.topRule=e,this.occurrence=n,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}}class I9 extends Ks{walkMany(e,n,r){if(e.idx===this.occurrence){const i=Vt(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof Ne&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkMany(e,n,r)}}class Gu extends Ks{walkManySep(e,n,r){if(e.idx===this.occurrence){const i=Vt(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof Ne&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkManySep(e,n,r)}}class x9 extends Ks{walkAtLeastOne(e,n,r){if(e.idx===this.occurrence){const i=Vt(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof Ne&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOne(e,n,r)}}class Vu extends Ks{walkAtLeastOneSep(e,n,r){if(e.idx===this.occurrence){const i=Vt(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof Ne&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOneSep(e,n,r)}}function rl(t,e,n=[]){n=rt(n);let r=[],i=0;function s(o){return o.concat($e(t,i+1))}function a(o){const l=rl(s(o),e,n);return r.concat(l)}for(;n.length<e&&i<t.length;){const o=t[i];if(o instanceof dt)return a(o.definition);if(o instanceof St)return a(o.definition);if(o instanceof pt)r=a(o.definition);else if(o instanceof sn){const l=o.definition.concat([new Je({definition:o.definition})]);return a(l)}else if(o instanceof an){const l=[new dt({definition:o.definition}),new Je({definition:[new Ne({terminalType:o.separator})].concat(o.definition)})];return a(l)}else if(o instanceof Wt){const l=o.definition.concat([new Je({definition:[new Ne({terminalType:o.separator})].concat(o.definition)})]);r=a(l)}else if(o instanceof Je){const l=o.definition.concat([new Je({definition:o.definition})]);r=a(l)}else{if(o instanceof Yt)return ge(o.definition,l=>{Fe(l.definition)===!1&&(r=a(l.definition))}),r;if(o instanceof Ne)n.push(o.terminalType);else throw Error("non exhaustive match")}i++}return r.push({partialPath:n,suffixDef:$e(t,i)}),r}function zu(t,e,n,r){const i="EXIT_NONE_TERMINAL",s=[i],a="EXIT_ALTERNATIVE";let o=!1;const l=e.length,h=l-r-1,u=[],A=[];for(A.push({idx:-1,def:t,ruleStack:[],occurrenceStack:[]});!Fe(A);){const f=A.pop();if(f===a){o&&Ur(A).idx<=h&&A.pop();continue}const d=f.def,m=f.idx,y=f.ruleStack,C=f.occurrenceStack;if(Fe(d))continue;const x=d[0];if(x===i){const I={idx:m,def:$e(d),ruleStack:xi(y),occurrenceStack:xi(C)};A.push(I)}else if(x instanceof Ne)if(m<l-1){const I=m+1,g=e[I];if(n(g,x.terminalType)){const v={idx:I,def:$e(d),ruleStack:y,occurrenceStack:C};A.push(v)}}else if(m===l-1)u.push({nextTokenType:x.terminalType,nextTokenOccurrence:x.idx,ruleStack:y,occurrenceStack:C}),o=!0;else throw Error("non exhaustive match");else if(x instanceof St){const I=rt(y);I.push(x.nonTerminalName);const g=rt(C);g.push(x.idx);const v={idx:m,def:x.definition.concat(s,$e(d)),ruleStack:I,occurrenceStack:g};A.push(v)}else if(x instanceof pt){const I={idx:m,def:$e(d),ruleStack:y,occurrenceStack:C};A.push(I),A.push(a);const g={idx:m,def:x.definition.concat($e(d)),ruleStack:y,occurrenceStack:C};A.push(g)}else if(x instanceof sn){const I=new Je({definition:x.definition,idx:x.idx}),g=x.definition.concat([I],$e(d)),v={idx:m,def:g,ruleStack:y,occurrenceStack:C};A.push(v)}else if(x instanceof an){const I=new Ne({terminalType:x.separator}),g=new Je({definition:[I].concat(x.definition),idx:x.idx}),v=x.definition.concat([g],$e(d)),w={idx:m,def:v,ruleStack:y,occurrenceStack:C};A.push(w)}else if(x instanceof Wt){const I={idx:m,def:$e(d),ruleStack:y,occurrenceStack:C};A.push(I),A.push(a);const g=new Ne({terminalType:x.separator}),v=new Je({definition:[g].concat(x.definition),idx:x.idx}),w=x.definition.concat([v],$e(d)),b={idx:m,def:w,ruleStack:y,occurrenceStack:C};A.push(b)}else if(x instanceof Je){const I={idx:m,def:$e(d),ruleStack:y,occurrenceStack:C};A.push(I),A.push(a);const g=new Je({definition:x.definition,idx:x.idx}),v=x.definition.concat([g],$e(d)),w={idx:m,def:v,ruleStack:y,occurrenceStack:C};A.push(w)}else if(x instanceof Yt)for(let I=x.definition.length-1;I>=0;I--){const g=x.definition[I],v={idx:m,def:g.definition.concat($e(d)),ruleStack:y,occurrenceStack:C};A.push(v),A.push(a)}else if(x instanceof dt)A.push({idx:m,def:x.definition.concat($e(d)),ruleStack:y,occurrenceStack:C});else if(x instanceof Nr)A.push(S9(x,m,y,C));else throw Error("non exhaustive match")}return u}function S9(t,e,n,r){const i=rt(n);i.push(t.name);const s=rt(r);return s.push(1),{idx:e,def:t.definition,ruleStack:i,occurrenceStack:s}}var Ye;(function(t){t[t.OPTION=0]="OPTION",t[t.REPETITION=1]="REPETITION",t[t.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",t[t.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",t[t.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",t[t.ALTERNATION=5]="ALTERNATION"})(Ye||(Ye={}));function Wu(t){if(t instanceof pt||t==="Option")return Ye.OPTION;if(t instanceof Je||t==="Repetition")return Ye.REPETITION;if(t instanceof sn||t==="RepetitionMandatory")return Ye.REPETITION_MANDATORY;if(t instanceof an||t==="RepetitionMandatoryWithSeparator")return Ye.REPETITION_MANDATORY_WITH_SEPARATOR;if(t instanceof Wt||t==="RepetitionWithSeparator")return Ye.REPETITION_WITH_SEPARATOR;if(t instanceof Yt||t==="Alternation")return Ye.ALTERNATION;throw Error("non exhaustive match")}function B9(t,e,n,r,i,s){const a=sl(t,e,n),o=Ku(a)?qs:_i;return s(a,r,o,i)}function w9(t,e,n,r,i,s){const a=al(t,e,i,n),o=Ku(a)?qs:_i;return s(a[0],o,r)}function b9(t,e,n,r){const i=t.length,s=Gt(t,a=>Gt(a,o=>o.length===1));if(e)return function(a){const o=ue(a,l=>l.GATE);for(let l=0;l<i;l++){const h=t[l],u=h.length,A=o[l];if(!(A!==void 0&&A.call(this)===!1))e:for(let f=0;f<u;f++){const d=h[f],m=d.length;for(let y=0;y<m;y++){const C=this.LA(y+1);if(n(C,d[y])===!1)continue e}return l}}};if(s&&!r){const a=ue(t,l=>Nt(l)),o=xt(a,(l,h,u)=>(ge(h,A=>{pe(l,A.tokenTypeIdx)||(l[A.tokenTypeIdx]=u),ge(A.categoryMatches,f=>{pe(l,f)||(l[f]=u)})}),l),{});return function(){const l=this.LA(1);return o[l.tokenTypeIdx]}}else return function(){for(let a=0;a<i;a++){const o=t[a],l=o.length;e:for(let h=0;h<l;h++){const u=o[h],A=u.length;for(let f=0;f<A;f++){const d=this.LA(f+1);if(n(d,u[f])===!1)continue e}return a}}}}function _9(t,e,n){const r=Gt(t,s=>s.length===1),i=t.length;if(r&&!n){const s=Nt(t);if(s.length===1&&Fe(s[0].categoryMatches)){const o=s[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===o}}else{const a=xt(s,(o,l,h)=>(o[l.tokenTypeIdx]=!0,ge(l.categoryMatches,u=>{o[u]=!0}),o),[]);return function(){const o=this.LA(1);return a[o.tokenTypeIdx]===!0}}}else return function(){e:for(let s=0;s<i;s++){const a=t[s],o=a.length;for(let l=0;l<o;l++){const h=this.LA(l+1);if(e(h,a[l])===!1)continue e}return!0}return!1}}class E9 extends Rs{constructor(e,n,r){super(),this.topProd=e,this.targetOccurrence=n,this.targetProdType=r}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(e,n,r,i){return e.idx===this.targetOccurrence&&this.targetProdType===n?(this.restDef=r.concat(i),!0):!1}walkOption(e,n,r){this.checkIsTarget(e,Ye.OPTION,n,r)||super.walkOption(e,n,r)}walkAtLeastOne(e,n,r){this.checkIsTarget(e,Ye.REPETITION_MANDATORY,n,r)||super.walkOption(e,n,r)}walkAtLeastOneSep(e,n,r){this.checkIsTarget(e,Ye.REPETITION_MANDATORY_WITH_SEPARATOR,n,r)||super.walkOption(e,n,r)}walkMany(e,n,r){this.checkIsTarget(e,Ye.REPETITION,n,r)||super.walkOption(e,n,r)}walkManySep(e,n,r){this.checkIsTarget(e,Ye.REPETITION_WITH_SEPARATOR,n,r)||super.walkOption(e,n,r)}}class Yu extends Gr{constructor(e,n,r){super(),this.targetOccurrence=e,this.targetProdType=n,this.targetRef=r,this.result=[]}checkIsTarget(e,n){e.idx===this.targetOccurrence&&this.targetProdType===n&&(this.targetRef===void 0||e===this.targetRef)&&(this.result=e.definition)}visitOption(e){this.checkIsTarget(e,Ye.OPTION)}visitRepetition(e){this.checkIsTarget(e,Ye.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,Ye.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,Ye.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,Ye.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,Ye.ALTERNATION)}}function ju(t){const e=new Array(t);for(let n=0;n<t;n++)e[n]=[];return e}function il(t){let e=[""];for(let n=0;n<t.length;n++){const r=t[n],i=[];for(let s=0;s<e.length;s++){const a=e[s];i.push(a+"_"+r.tokenTypeIdx);for(let o=0;o<r.categoryMatches.length;o++){const l="_"+r.categoryMatches[o];i.push(a+l)}}e=i}return e}function T9(t,e,n){for(let r=0;r<t.length;r++){if(r===n)continue;const i=t[r];for(let s=0;s<e.length;s++){const a=e[s];if(i[a]===!0)return!1}}return!0}function qu(t,e){const n=ue(t,a=>rl([a],1)),r=ju(n.length),i=ue(n,a=>{const o={};return ge(a,l=>{const h=il(l.partialPath);ge(h,u=>{o[u]=!0})}),o});let s=n;for(let a=1;a<=e;a++){const o=s;s=ju(o.length);for(let l=0;l<o.length;l++){const h=o[l];for(let u=0;u<h.length;u++){const A=h[u].partialPath,f=h[u].suffixDef,d=il(A);if(T9(i,d,l)||Fe(f)||A.length===e){const y=r[l];if(ol(y,A)===!1){y.push(A);for(let C=0;C<d.length;C++){const x=d[C];i[l][x]=!0}}}else{const y=rl(f,a+1,A);s[l]=s[l].concat(y),ge(y,C=>{const x=il(C.partialPath);ge(x,I=>{i[l][I]=!0})})}}}}return r}function sl(t,e,n,r){const i=new Yu(t,Ye.ALTERNATION,r);return e.accept(i),qu(i.result,n)}function al(t,e,n,r){const i=new Yu(t,n);e.accept(i);const s=i.result,o=new E9(e,t,n).startWalking(),l=new dt({definition:s}),h=new dt({definition:o});return qu([l,h],r)}function ol(t,e){e:for(let n=0;n<t.length;n++){const r=t[n];if(r.length===e.length){for(let i=0;i<r.length;i++){const s=e[i],a=r[i];if((s===a||a.categoryMatchesMap[s.tokenTypeIdx]!==void 0)===!1)continue e}return!0}}return!1}function M9(t,e){return t.length<e.length&&Gt(t,(n,r)=>{const i=e[r];return n===i||i.categoryMatchesMap[n.tokenTypeIdx]})}function Ku(t){return Gt(t,e=>Gt(e,n=>Gt(n,r=>Fe(r.categoryMatches))))}function D9(t){const e=t.lookaheadStrategy.validate({rules:t.rules,tokenTypes:t.tokenTypes,grammarName:t.grammarName});return ue(e,n=>Object.assign({type:ct.CUSTOM_LOOKAHEAD_VALIDATION},n))}function L9(t,e,n,r){const i=Mt(t,l=>P9(l,n)),s=Y9(t,e,n),a=Mt(t,l=>G9(l,n)),o=Mt(t,l=>O9(l,t,r,n));return i.concat(s,a,o)}function P9(t,e){const n=new k9;t.accept(n);const r=n.allProductions,i=z4(r,F9),s=zt(i,o=>o.length>1);return ue(Ze(s),o=>{const l=Vt(o),h=e.buildDuplicateFoundError(t,o),u=on(l),A={message:h,type:ct.DUPLICATE_PRODUCTIONS,ruleName:t.name,dslName:u,occurrence:l.idx},f=Xu(l);return f&&(A.parameter=f),A})}function F9(t){return`${on(t)}_#_${t.idx}_#_${Xu(t)}`}function Xu(t){return t instanceof Ne?t.terminalType.name:t instanceof St?t.nonTerminalName:""}class k9 extends Gr{constructor(){super(...arguments),this.allProductions=[]}visitNonTerminal(e){this.allProductions.push(e)}visitOption(e){this.allProductions.push(e)}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}visitAlternation(e){this.allProductions.push(e)}visitTerminal(e){this.allProductions.push(e)}}function O9(t,e,n,r){const i=[];if(xt(e,(a,o)=>o.name===t.name?a+1:a,0)>1){const a=r.buildDuplicateRuleNameError({topLevelRule:t,grammarName:n});i.push({message:a,type:ct.DUPLICATE_RULE_NAME,ruleName:t.name})}return i}function R9(t,e,n){const r=[];let i;return lt(e,t)||(i=`Invalid rule override, rule: ->${t}<- cannot be overridden in the grammar: ->${n}<-as it is not defined in any of the super grammars `,r.push({message:i,type:ct.INVALID_RULE_OVERRIDE,ruleName:t})),r}function Zu(t,e,n,r=[]){const i=[],s=Xs(e.definition);if(Fe(s))return[];{const a=t.name;lt(s,t)&&i.push({message:n.buildLeftRecursionError({topLevelRule:t,leftRecursionPath:r}),type:ct.LEFT_RECURSION,ruleName:a});const l=Ps(s,r.concat([t])),h=Mt(l,u=>{const A=rt(r);return A.push(u),Zu(t,u,n,A)});return i.concat(h)}}function Xs(t){let e=[];if(Fe(t))return e;const n=Vt(t);if(n instanceof St)e.push(n.referencedRule);else if(n instanceof dt||n instanceof pt||n instanceof sn||n instanceof an||n instanceof Wt||n instanceof Je)e=e.concat(Xs(n.definition));else if(n instanceof Yt)e=Nt(ue(n.definition,s=>Xs(s.definition)));else if(!(n instanceof Ne))throw Error("non exhaustive match");const r=Os(n),i=t.length>1;if(r&&i){const s=$e(t);return e.concat(Xs(s))}else return e}class ll extends Gr{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}}function U9(t,e){const n=new ll;t.accept(n);const r=n.alternations;return Mt(r,s=>{const a=xi(s.definition);return Mt(a,(o,l)=>{const h=zu([o],[],_i,1);return Fe(h)?[{message:e.buildEmptyAlternationError({topLevelRule:t,alternation:s,emptyChoiceIdx:l}),type:ct.NONE_LAST_EMPTY_ALT,ruleName:t.name,occurrence:s.idx,alternative:l+1}]:[]})})}function Q9(t,e,n){const r=new ll;t.accept(r);let i=r.alternations;return i=Fs(i,a=>a.ignoreAmbiguities===!0),Mt(i,a=>{const o=a.idx,l=a.maxLookahead||e,h=sl(o,t,l,a),u=z9(h,a,t,n),A=W9(h,a,t,n);return u.concat(A)})}class N9 extends Gr{constructor(){super(...arguments),this.allProductions=[]}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}}function G9(t,e){const n=new ll;t.accept(n);const r=n.alternations;return Mt(r,s=>s.definition.length>255?[{message:e.buildTooManyAlternativesError({topLevelRule:t,alternation:s}),type:ct.TOO_MANY_ALTS,ruleName:t.name,occurrence:s.idx}]:[])}function V9(t,e,n){const r=[];return ge(t,i=>{const s=new N9;i.accept(s);const a=s.allProductions;ge(a,o=>{const l=Wu(o),h=o.maxLookahead||e,u=o.idx,f=al(u,i,l,h)[0];if(Fe(Nt(f))){const d=n.buildEmptyRepetitionError({topLevelRule:i,repetition:o});r.push({message:d,type:ct.NO_NON_EMPTY_LOOKAHEAD,ruleName:i.name})}})}),r}function z9(t,e,n,r){const i=[],s=xt(t,(o,l,h)=>(e.definition[h].ignoreAmbiguities===!0||ge(l,u=>{const A=[h];ge(t,(f,d)=>{h!==d&&ol(f,u)&&e.definition[d].ignoreAmbiguities!==!0&&A.push(d)}),A.length>1&&!ol(i,u)&&(i.push(u),o.push({alts:A,path:u}))}),o),[]);return ue(s,o=>{const l=ue(o.alts,u=>u+1);return{message:r.buildAlternationAmbiguityError({topLevelRule:n,alternation:e,ambiguityIndices:l,prefixPath:o.path}),type:ct.AMBIGUOUS_ALTS,ruleName:n.name,occurrence:e.idx,alternatives:o.alts}})}function W9(t,e,n,r){const i=xt(t,(a,o,l)=>{const h=ue(o,u=>({idx:l,path:u}));return a.concat(h)},[]);return Ii(Mt(i,a=>{if(e.definition[a.idx].ignoreAmbiguities===!0)return[];const l=a.idx,h=a.path,u=Tt(i,f=>e.definition[f.idx].ignoreAmbiguities!==!0&&f.idx<l&&M9(f.path,h));return ue(u,f=>{const d=[f.idx+1,l+1],m=e.idx===0?"":e.idx;return{message:r.buildAlternationPrefixAmbiguityError({topLevelRule:n,alternation:e,ambiguityIndices:d,prefixPath:f.path}),type:ct.AMBIGUOUS_PREFIX_ALTS,ruleName:n.name,occurrence:m,alternatives:d}})}))}function Y9(t,e,n){const r=[],i=ue(e,s=>s.name);return ge(t,s=>{const a=s.name;if(lt(i,a)){const o=n.buildNamespaceConflictError(s);r.push({message:o,type:ct.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:a})}}),r}function j9(t){const e=qo(t,{errMsgProvider:g9}),n={};return ge(t.rules,r=>{n[r.name]=r}),m9(n,e.errMsgProvider)}function q9(t){return t=qo(t,{errMsgProvider:dr}),L9(t.rules,t.tokenTypes,t.errMsgProvider,t.grammarName)}const Ju="MismatchedTokenException",Hu="NoViableAltException",$u="EarlyExitException",e0="NotAllInputParsedException",t0=[Ju,Hu,$u,e0];Object.freeze(t0);function Zs(t){return lt(t0,t.name)}class Js extends Error{constructor(e,n){super(e),this.token=n,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}class n0 extends Js{constructor(e,n,r){super(e,n),this.previousToken=r,this.name=Ju}}class K9 extends Js{constructor(e,n,r){super(e,n),this.previousToken=r,this.name=Hu}}class X9 extends Js{constructor(e,n){super(e,n),this.name=e0}}class Z9 extends Js{constructor(e,n,r){super(e,n),this.previousToken=r,this.name=$u}}const cl={},r0="InRuleRecoveryException";class J9 extends Error{constructor(e){super(e),this.name=r0}}class H9{initRecoverable(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=pe(e,"recoveryEnabled")?e.recoveryEnabled:Kn.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=$9)}getTokenToInsert(e){const n=nl(e,"",NaN,NaN,NaN,NaN,NaN,NaN);return n.isInsertedInRecovery=!0,n}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,n,r,i){const s=this.findReSyncTokenType(),a=this.exportLexerState(),o=[];let l=!1;const h=this.LA(1);let u=this.LA(1);const A=()=>{const f=this.LA(0),d=this.errorMessageProvider.buildMismatchTokenMessage({expected:i,actual:h,previous:f,ruleName:this.getCurrRuleFullName()}),m=new n0(d,h,this.LA(0));m.resyncedTokens=xi(o),this.SAVE_ERROR(m)};for(;!l;)if(this.tokenMatcher(u,i)){A();return}else if(r.call(this)){A(),e.apply(this,n);return}else this.tokenMatcher(u,s)?l=!0:(u=this.SKIP_TOKEN(),this.addToResyncTokens(u,o));this.importLexerState(a)}shouldInRepetitionRecoveryBeTried(e,n,r){return!(r===!1||this.tokenMatcher(this.LA(1),e)||this.isBackTracking()||this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,n)))}getFollowsForInRuleRecovery(e,n){const r=this.getCurrentGrammarPath(e,n);return this.getNextPossibleTokenTypes(r)}tryInRuleRecovery(e,n){if(this.canRecoverWithSingleTokenInsertion(e,n))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){const r=this.SKIP_TOKEN();return this.consumeToken(),r}throw new J9("sad sad panda")}canPerformInRuleRecovery(e,n){return this.canRecoverWithSingleTokenInsertion(e,n)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,n){if(!this.canTokenTypeBeInsertedInRecovery(e)||Fe(n))return!1;const r=this.LA(1);return Qr(n,s=>this.tokenMatcher(r,s))!==void 0}canRecoverWithSingleTokenDeletion(e){return this.canTokenTypeBeDeletedInRecovery(e)?this.tokenMatcher(this.LA(2),e):!1}isInCurrentRuleReSyncSet(e){const n=this.getCurrFollowKey(),r=this.getFollowSetFromFollowKey(n);return lt(r,e)}findReSyncTokenType(){const e=this.flattenFollowSet();let n=this.LA(1),r=2;for(;;){const i=Qr(e,s=>p9(n,s));if(i!==void 0)return i;n=this.LA(r),r++}}getCurrFollowKey(){if(this.RULE_STACK.length===1)return cl;const e=this.getLastExplicitRuleShortName(),n=this.getLastExplicitRuleOccurrenceIndex(),r=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:n,inRule:this.shortRuleNameToFullName(r)}}buildFullFollowKeyStack(){const e=this.RULE_STACK,n=this.RULE_OCCURRENCE_STACK;return ue(e,(r,i)=>i===0?cl:{ruleName:this.shortRuleNameToFullName(r),idxInCallingRule:n[i],inRule:this.shortRuleNameToFullName(e[i-1])})}flattenFollowSet(){const e=ue(this.buildFullFollowKeyStack(),n=>this.getFollowSetFromFollowKey(n));return Nt(e)}getFollowSetFromFollowKey(e){if(e===cl)return[fr];const n=e.ruleName+e.idxInCallingRule+du+e.inRule;return this.resyncFollows[n]}addToResyncTokens(e,n){return this.tokenMatcher(e,fr)||n.push(e),n}reSyncTo(e){const n=[];let r=this.LA(1);for(;this.tokenMatcher(r,e)===!1;)r=this.SKIP_TOKEN(),this.addToResyncTokens(r,n);return xi(n)}attemptInRepetitionRecovery(e,n,r,i,s,a,o){}getCurrentGrammarPath(e,n){const r=this.getHumanReadableRuleStack(),i=rt(this.RULE_OCCURRENCE_STACK);return{ruleStack:r,occurrenceStack:i,lastTok:e,lastTokOccurrence:n}}getHumanReadableRuleStack(){return ue(this.RULE_STACK,e=>this.shortRuleNameToFullName(e))}}function $9(t,e,n,r,i,s,a){const o=this.getKeyForAutomaticLookahead(r,i);let l=this.firstAfterRepMap[o];if(l===void 0){const f=this.getCurrRuleFullName(),d=this.getGAstProductions()[f];l=new s(d,i).startWalking(),this.firstAfterRepMap[o]=l}let h=l.token,u=l.occurrence;const A=l.isEndOfRule;this.RULE_STACK.length===1&&A&&h===void 0&&(h=fr,u=1),!(h===void 0||u===void 0)&&this.shouldInRepetitionRecoveryBeTried(h,u,a)&&this.tryInRepetitionRecovery(t,e,n,h)}const ev=4,qn=8,i0=1<<qn,s0=2<<qn,hl=3<<qn,ul=4<<qn,Al=5<<qn,Hs=6<<qn;function fl(t,e,n){return n|e|t}class tv{constructor(e){var n;this.maxLookahead=(n=e==null?void 0:e.maxLookahead)!==null&&n!==void 0?n:Kn.maxLookahead}validate(e){const n=this.validateNoLeftRecursion(e.rules);if(Fe(n)){const r=this.validateEmptyOrAlternatives(e.rules),i=this.validateAmbiguousAlternationAlternatives(e.rules,this.maxLookahead),s=this.validateSomeNonEmptyLookaheadPath(e.rules,this.maxLookahead);return[...n,...r,...i,...s]}return n}validateNoLeftRecursion(e){return Mt(e,n=>Zu(n,n,dr))}validateEmptyOrAlternatives(e){return Mt(e,n=>U9(n,dr))}validateAmbiguousAlternationAlternatives(e,n){return Mt(e,r=>Q9(r,n,dr))}validateSomeNonEmptyLookaheadPath(e,n){return V9(e,n,dr)}buildLookaheadForAlternation(e){return B9(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,b9)}buildLookaheadForOptional(e){return w9(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,Wu(e.prodType),_9)}}class nv{initLooksAhead(e){this.dynamicTokensEnabled=pe(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:Kn.dynamicTokensEnabled,this.maxLookahead=pe(e,"maxLookahead")?e.maxLookahead:Kn.maxLookahead,this.lookaheadStrategy=pe(e,"lookaheadStrategy")?e.lookaheadStrategy:new tv({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(e){ge(e,n=>{this.TRACE_INIT(`${n.name} Rule Lookahead`,()=>{const{alternation:r,repetition:i,option:s,repetitionMandatory:a,repetitionMandatoryWithSeparator:o,repetitionWithSeparator:l}=iv(n);ge(r,h=>{const u=h.idx===0?"":h.idx;this.TRACE_INIT(`${on(h)}${u}`,()=>{const A=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:h.idx,rule:n,maxLookahead:h.maxLookahead||this.maxLookahead,hasPredicates:h.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),f=fl(this.fullRuleNameToShort[n.name],i0,h.idx);this.setLaFuncCache(f,A)})}),ge(i,h=>{this.computeLookaheadFunc(n,h.idx,hl,"Repetition",h.maxLookahead,on(h))}),ge(s,h=>{this.computeLookaheadFunc(n,h.idx,s0,"Option",h.maxLookahead,on(h))}),ge(a,h=>{this.computeLookaheadFunc(n,h.idx,ul,"RepetitionMandatory",h.maxLookahead,on(h))}),ge(o,h=>{this.computeLookaheadFunc(n,h.idx,Hs,"RepetitionMandatoryWithSeparator",h.maxLookahead,on(h))}),ge(l,h=>{this.computeLookaheadFunc(n,h.idx,Al,"RepetitionWithSeparator",h.maxLookahead,on(h))})})})}computeLookaheadFunc(e,n,r,i,s,a){this.TRACE_INIT(`${a}${n===0?"":n}`,()=>{const o=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:n,rule:e,maxLookahead:s||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:i}),l=fl(this.fullRuleNameToShort[e.name],r,n);this.setLaFuncCache(l,o)})}getKeyForAutomaticLookahead(e,n){const r=this.getLastExplicitRuleShortName();return fl(r,e,n)}getLaFuncFromCache(e){return this.lookAheadFuncsCache.get(e)}setLaFuncCache(e,n){this.lookAheadFuncsCache.set(e,n)}}class rv extends Gr{constructor(){super(...arguments),this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}reset(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}visitOption(e){this.dslMethods.option.push(e)}visitRepetitionWithSeparator(e){this.dslMethods.repetitionWithSeparator.push(e)}visitRepetitionMandatory(e){this.dslMethods.repetitionMandatory.push(e)}visitRepetitionMandatoryWithSeparator(e){this.dslMethods.repetitionMandatoryWithSeparator.push(e)}visitRepetition(e){this.dslMethods.repetition.push(e)}visitAlternation(e){this.dslMethods.alternation.push(e)}}const $s=new rv;function iv(t){$s.reset(),t.accept($s);const e=$s.dslMethods;return $s.reset(),e}function a0(t,e){isNaN(t.startOffset)===!0?(t.startOffset=e.startOffset,t.endOffset=e.endOffset):t.endOffset<e.endOffset&&(t.endOffset=e.endOffset)}function o0(t,e){isNaN(t.startOffset)===!0?(t.startOffset=e.startOffset,t.startColumn=e.startColumn,t.startLine=e.startLine,t.endOffset=e.endOffset,t.endColumn=e.endColumn,t.endLine=e.endLine):t.endOffset<e.endOffset&&(t.endOffset=e.endOffset,t.endColumn=e.endColumn,t.endLine=e.endLine)}function sv(t,e,n){t.children[n]===void 0?t.children[n]=[e]:t.children[n].push(e)}function av(t,e,n){t.children[e]===void 0?t.children[e]=[n]:t.children[e].push(n)}const ov="name";function l0(t,e){Object.defineProperty(t,ov,{enumerable:!1,configurable:!0,writable:!1,value:e})}function lv(t,e){const n=Ct(t),r=n.length;for(let i=0;i<r;i++){const s=n[i],a=t[s],o=a.length;for(let l=0;l<o;l++){const h=a[l];h.tokenTypeIdx===void 0&&this[h.name](h.children,e)}}}function cv(t,e){const n=function(){};l0(n,t+"BaseSemantics");const r={visit:function(i,s){if(Ee(i)&&(i=i[0]),!Sn(i))return this[i.name](i.children,s)},validateVisitor:function(){const i=uv(this,e);if(!Fe(i)){const s=ue(i,a=>a.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:
|
|
1008
|
+
${s.join(`
|
|
1009
|
+
|
|
1010
|
+
`).replace(/\n/g,`
|
|
1011
|
+
`)}`)}}};return n.prototype=r,n.prototype.constructor=n,n._RULE_NAMES=e,n}function hv(t,e,n){const r=function(){};l0(r,t+"BaseSemanticsWithDefaults");const i=Object.create(n.prototype);return ge(e,s=>{i[s]=lv}),r.prototype=i,r.prototype.constructor=r,r}var dl;(function(t){t[t.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",t[t.MISSING_METHOD=1]="MISSING_METHOD"})(dl||(dl={}));function uv(t,e){return Av(t,e)}function Av(t,e){const n=Tt(e,i=>yn(t[i])===!1),r=ue(n,i=>({msg:`Missing visitor method: <${i}> on ${t.constructor.name} CST Visitor.`,type:dl.MISSING_METHOD,methodName:i}));return Ii(r)}class fv{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=pe(e,"nodeLocationTracking")?e.nodeLocationTracking:Kn.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=Xe,this.cstFinallyStateUpdate=Xe,this.cstPostTerminal=Xe,this.cstPostNonTerminal=Xe,this.cstPostRule=Xe;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=o0,this.setNodeLocationFromNode=o0,this.cstPostRule=Xe,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=Xe,this.setNodeLocationFromNode=Xe,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=a0,this.setNodeLocationFromNode=a0,this.cstPostRule=Xe,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=Xe,this.setNodeLocationFromNode=Xe,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=Xe,this.setNodeLocationFromNode=Xe,this.cstPostRule=Xe,this.setInitialNodeLocation=Xe;else throw Error(`Invalid <nodeLocationTracking> config option: "${e.nodeLocationTracking}"`)}setInitialNodeLocationOnlyOffsetRecovery(e){e.location={startOffset:NaN,endOffset:NaN}}setInitialNodeLocationOnlyOffsetRegular(e){e.location={startOffset:this.LA(1).startOffset,endOffset:NaN}}setInitialNodeLocationFullRecovery(e){e.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}}setInitialNodeLocationFullRegular(e){const n=this.LA(1);e.location={startOffset:n.startOffset,startLine:n.startLine,startColumn:n.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}}cstInvocationStateUpdate(e){const n={name:e,children:Object.create(null)};this.setInitialNodeLocation(n),this.CST_STACK.push(n)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(e){const n=this.LA(0),r=e.location;r.startOffset<=n.startOffset?(r.endOffset=n.endOffset,r.endLine=n.endLine,r.endColumn=n.endColumn):(r.startOffset=NaN,r.startLine=NaN,r.startColumn=NaN)}cstPostRuleOnlyOffset(e){const n=this.LA(0),r=e.location;r.startOffset<=n.startOffset?r.endOffset=n.endOffset:r.startOffset=NaN}cstPostTerminal(e,n){const r=this.CST_STACK[this.CST_STACK.length-1];sv(r,n,e),this.setNodeLocationFromToken(r.location,n)}cstPostNonTerminal(e,n){const r=this.CST_STACK[this.CST_STACK.length-1];av(r,n,e),this.setNodeLocationFromNode(r.location,e.location)}getBaseCstVisitorConstructor(){if(Sn(this.baseCstVisitorConstructor)){const e=cv(this.className,Ct(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(Sn(this.baseCstVisitorWithDefaultsConstructor)){const e=hv(this.className,Ct(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor}getLastExplicitRuleShortName(){const e=this.RULE_STACK;return e[e.length-1]}getPreviousExplicitRuleShortName(){const e=this.RULE_STACK;return e[e.length-2]}getLastExplicitRuleOccurrenceIndex(){const e=this.RULE_OCCURRENCE_STACK;return e[e.length-1]}}class dv{initLexerAdapter(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1}set input(e){if(this.selfAnalysisDone!==!0)throw Error("Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=e,this.tokVectorLength=e.length}get input(){return this.tokVector}SKIP_TOKEN(){return this.currIdx<=this.tokVector.length-2?(this.consumeToken(),this.LA(1)):na}LA(e){const n=this.currIdx+e;return n<0||this.tokVectorLength<=n?na:this.tokVector[n]}consumeToken(){this.currIdx++}exportLexerState(){return this.currIdx}importLexerState(e){this.currIdx=e}resetLexerState(){this.currIdx=-1}moveToTerminatedState(){this.currIdx=this.tokVector.length-1}getLexerPosition(){return this.exportLexerState()}}class pv{ACTION(e){return e.call(this)}consume(e,n,r){return this.consumeInternal(n,e,r)}subrule(e,n,r){return this.subruleInternal(n,e,r)}option(e,n){return this.optionInternal(n,e)}or(e,n){return this.orInternal(n,e)}many(e,n){return this.manyInternal(e,n)}atLeastOne(e,n){return this.atLeastOneInternal(e,n)}CONSUME(e,n){return this.consumeInternal(e,0,n)}CONSUME1(e,n){return this.consumeInternal(e,1,n)}CONSUME2(e,n){return this.consumeInternal(e,2,n)}CONSUME3(e,n){return this.consumeInternal(e,3,n)}CONSUME4(e,n){return this.consumeInternal(e,4,n)}CONSUME5(e,n){return this.consumeInternal(e,5,n)}CONSUME6(e,n){return this.consumeInternal(e,6,n)}CONSUME7(e,n){return this.consumeInternal(e,7,n)}CONSUME8(e,n){return this.consumeInternal(e,8,n)}CONSUME9(e,n){return this.consumeInternal(e,9,n)}SUBRULE(e,n){return this.subruleInternal(e,0,n)}SUBRULE1(e,n){return this.subruleInternal(e,1,n)}SUBRULE2(e,n){return this.subruleInternal(e,2,n)}SUBRULE3(e,n){return this.subruleInternal(e,3,n)}SUBRULE4(e,n){return this.subruleInternal(e,4,n)}SUBRULE5(e,n){return this.subruleInternal(e,5,n)}SUBRULE6(e,n){return this.subruleInternal(e,6,n)}SUBRULE7(e,n){return this.subruleInternal(e,7,n)}SUBRULE8(e,n){return this.subruleInternal(e,8,n)}SUBRULE9(e,n){return this.subruleInternal(e,9,n)}OPTION(e){return this.optionInternal(e,0)}OPTION1(e){return this.optionInternal(e,1)}OPTION2(e){return this.optionInternal(e,2)}OPTION3(e){return this.optionInternal(e,3)}OPTION4(e){return this.optionInternal(e,4)}OPTION5(e){return this.optionInternal(e,5)}OPTION6(e){return this.optionInternal(e,6)}OPTION7(e){return this.optionInternal(e,7)}OPTION8(e){return this.optionInternal(e,8)}OPTION9(e){return this.optionInternal(e,9)}OR(e){return this.orInternal(e,0)}OR1(e){return this.orInternal(e,1)}OR2(e){return this.orInternal(e,2)}OR3(e){return this.orInternal(e,3)}OR4(e){return this.orInternal(e,4)}OR5(e){return this.orInternal(e,5)}OR6(e){return this.orInternal(e,6)}OR7(e){return this.orInternal(e,7)}OR8(e){return this.orInternal(e,8)}OR9(e){return this.orInternal(e,9)}MANY(e){this.manyInternal(0,e)}MANY1(e){this.manyInternal(1,e)}MANY2(e){this.manyInternal(2,e)}MANY3(e){this.manyInternal(3,e)}MANY4(e){this.manyInternal(4,e)}MANY5(e){this.manyInternal(5,e)}MANY6(e){this.manyInternal(6,e)}MANY7(e){this.manyInternal(7,e)}MANY8(e){this.manyInternal(8,e)}MANY9(e){this.manyInternal(9,e)}MANY_SEP(e){this.manySepFirstInternal(0,e)}MANY_SEP1(e){this.manySepFirstInternal(1,e)}MANY_SEP2(e){this.manySepFirstInternal(2,e)}MANY_SEP3(e){this.manySepFirstInternal(3,e)}MANY_SEP4(e){this.manySepFirstInternal(4,e)}MANY_SEP5(e){this.manySepFirstInternal(5,e)}MANY_SEP6(e){this.manySepFirstInternal(6,e)}MANY_SEP7(e){this.manySepFirstInternal(7,e)}MANY_SEP8(e){this.manySepFirstInternal(8,e)}MANY_SEP9(e){this.manySepFirstInternal(9,e)}AT_LEAST_ONE(e){this.atLeastOneInternal(0,e)}AT_LEAST_ONE1(e){return this.atLeastOneInternal(1,e)}AT_LEAST_ONE2(e){this.atLeastOneInternal(2,e)}AT_LEAST_ONE3(e){this.atLeastOneInternal(3,e)}AT_LEAST_ONE4(e){this.atLeastOneInternal(4,e)}AT_LEAST_ONE5(e){this.atLeastOneInternal(5,e)}AT_LEAST_ONE6(e){this.atLeastOneInternal(6,e)}AT_LEAST_ONE7(e){this.atLeastOneInternal(7,e)}AT_LEAST_ONE8(e){this.atLeastOneInternal(8,e)}AT_LEAST_ONE9(e){this.atLeastOneInternal(9,e)}AT_LEAST_ONE_SEP(e){this.atLeastOneSepFirstInternal(0,e)}AT_LEAST_ONE_SEP1(e){this.atLeastOneSepFirstInternal(1,e)}AT_LEAST_ONE_SEP2(e){this.atLeastOneSepFirstInternal(2,e)}AT_LEAST_ONE_SEP3(e){this.atLeastOneSepFirstInternal(3,e)}AT_LEAST_ONE_SEP4(e){this.atLeastOneSepFirstInternal(4,e)}AT_LEAST_ONE_SEP5(e){this.atLeastOneSepFirstInternal(5,e)}AT_LEAST_ONE_SEP6(e){this.atLeastOneSepFirstInternal(6,e)}AT_LEAST_ONE_SEP7(e){this.atLeastOneSepFirstInternal(7,e)}AT_LEAST_ONE_SEP8(e){this.atLeastOneSepFirstInternal(8,e)}AT_LEAST_ONE_SEP9(e){this.atLeastOneSepFirstInternal(9,e)}RULE(e,n,r=ra){if(lt(this.definedRulesNames,e)){const a={message:dr.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:ct.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(a)}this.definedRulesNames.push(e);const i=this.defineRule(e,n,r);return this[e]=i,i}OVERRIDE_RULE(e,n,r=ra){const i=R9(e,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(i);const s=this.defineRule(e,n,r);return this[e]=s,s}BACKTRACK(e,n){return function(){this.isBackTrackingStack.push(1);const r=this.saveRecogState();try{return e.apply(this,n),!0}catch(i){if(Zs(i))return!1;throw i}finally{this.reloadRecogState(r),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return m7(Ze(this.gastProductionsCache))}}class gv{initRecognizerEngine(e,n){if(this.className=this.constructor.name,this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=qs,this.subruleIdx=0,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},pe(n,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a <serializedGrammar> property.
|
|
1012
|
+
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
|
|
1013
|
+
For Further details.`);if(Ee(e)){if(Fe(e))throw Error(`A Token Vocabulary cannot be empty.
|
|
1014
|
+
Note that the first argument for the parser constructor
|
|
1015
|
+
is no longer a Token vector (since v4.0).`);if(typeof e[0].startOffset=="number")throw Error(`The Parser constructor no longer accepts a token vector as the first argument.
|
|
1016
|
+
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
|
|
1017
|
+
For Further details.`)}if(Ee(e))this.tokensMap=xt(e,(s,a)=>(s[a.name]=a,s),{});else if(pe(e,"modes")&&Gt(Nt(Ze(e.modes)),u9)){const s=Nt(Ze(e.modes)),a=Ko(s);this.tokensMap=xt(a,(o,l)=>(o[l.name]=l,o),{})}else if(Et(e))this.tokensMap=rt(e);else throw new Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap.EOF=fr;const r=pe(e,"modes")?Nt(Ze(e.modes)):Ze(e),i=Gt(r,s=>Fe(s.categoryMatches));this.tokenMatcher=i?qs:_i,Ei(Ze(this.tokensMap))}defineRule(e,n,r){if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called'
|
|
1018
|
+
Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);const i=pe(r,"resyncEnabled")?r.resyncEnabled:ra.resyncEnabled,s=pe(r,"recoveryValueFunc")?r.recoveryValueFunc:ra.recoveryValueFunc,a=this.ruleShortNameIdx<<ev+qn;this.ruleShortNameIdx++,this.shortRuleNameToFull[a]=e,this.fullRuleNameToShort[e]=a;let o;return this.outputCst===!0?o=function(...u){try{this.ruleInvocationStateUpdate(a,e,this.subruleIdx),n.apply(this,u);const A=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(A),A}catch(A){return this.invokeRuleCatch(A,i,s)}finally{this.ruleFinallyStateUpdate()}}:o=function(...u){try{return this.ruleInvocationStateUpdate(a,e,this.subruleIdx),n.apply(this,u)}catch(A){return this.invokeRuleCatch(A,i,s)}finally{this.ruleFinallyStateUpdate()}},Object.assign(o,{ruleName:e,originalGrammarAction:n})}invokeRuleCatch(e,n,r){const i=this.RULE_STACK.length===1,s=n&&!this.isBackTracking()&&this.recoveryEnabled;if(Zs(e)){const a=e;if(s){const o=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(o))if(a.resyncedTokens=this.reSyncTo(o),this.outputCst){const l=this.CST_STACK[this.CST_STACK.length-1];return l.recoveredNode=!0,l}else return r(e);else{if(this.outputCst){const l=this.CST_STACK[this.CST_STACK.length-1];l.recoveredNode=!0,a.partialCstResult=l}throw a}}else{if(i)return this.moveToTerminatedState(),r(e);throw a}}else throw e}optionInternal(e,n){const r=this.getKeyForAutomaticLookahead(s0,n);return this.optionInternalLogic(e,n,r)}optionInternalLogic(e,n,r){let i=this.getLaFuncFromCache(r),s;if(typeof e!="function"){s=e.DEF;const a=e.GATE;if(a!==void 0){const o=i;i=()=>a.call(this)&&o.call(this)}}else s=e;if(i.call(this)===!0)return s.call(this)}atLeastOneInternal(e,n){const r=this.getKeyForAutomaticLookahead(ul,e);return this.atLeastOneInternalLogic(e,n,r)}atLeastOneInternalLogic(e,n,r){let i=this.getLaFuncFromCache(r),s;if(typeof n!="function"){s=n.DEF;const a=n.GATE;if(a!==void 0){const o=i;i=()=>a.call(this)&&o.call(this)}}else s=n;if(i.call(this)===!0){let a=this.doSingleRepetition(s);for(;i.call(this)===!0&&a===!0;)a=this.doSingleRepetition(s)}else throw this.raiseEarlyExitException(e,Ye.REPETITION_MANDATORY,n.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,n],i,ul,e,x9)}atLeastOneSepFirstInternal(e,n){const r=this.getKeyForAutomaticLookahead(Hs,e);this.atLeastOneSepFirstInternalLogic(e,n,r)}atLeastOneSepFirstInternalLogic(e,n,r){const i=n.DEF,s=n.SEP;if(this.getLaFuncFromCache(r).call(this)===!0){i.call(this);const o=()=>this.tokenMatcher(this.LA(1),s);for(;this.tokenMatcher(this.LA(1),s)===!0;)this.CONSUME(s),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,s,o,i,Vu],o,Hs,e,Vu)}else throw this.raiseEarlyExitException(e,Ye.REPETITION_MANDATORY_WITH_SEPARATOR,n.ERR_MSG)}manyInternal(e,n){const r=this.getKeyForAutomaticLookahead(hl,e);return this.manyInternalLogic(e,n,r)}manyInternalLogic(e,n,r){let i=this.getLaFuncFromCache(r),s;if(typeof n!="function"){s=n.DEF;const o=n.GATE;if(o!==void 0){const l=i;i=()=>o.call(this)&&l.call(this)}}else s=n;let a=!0;for(;i.call(this)===!0&&a===!0;)a=this.doSingleRepetition(s);this.attemptInRepetitionRecovery(this.manyInternal,[e,n],i,hl,e,I9,a)}manySepFirstInternal(e,n){const r=this.getKeyForAutomaticLookahead(Al,e);this.manySepFirstInternalLogic(e,n,r)}manySepFirstInternalLogic(e,n,r){const i=n.DEF,s=n.SEP;if(this.getLaFuncFromCache(r).call(this)===!0){i.call(this);const o=()=>this.tokenMatcher(this.LA(1),s);for(;this.tokenMatcher(this.LA(1),s)===!0;)this.CONSUME(s),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,s,o,i,Gu],o,Al,e,Gu)}}repetitionSepSecondInternal(e,n,r,i,s){for(;r();)this.CONSUME(n),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,n,r,i,s],r,Hs,e,s)}doSingleRepetition(e){const n=this.getLexerPosition();return e.call(this),this.getLexerPosition()>n}orInternal(e,n){const r=this.getKeyForAutomaticLookahead(i0,n),i=Ee(e)?e:e.DEF,a=this.getLaFuncFromCache(r).call(this,i);if(a!==void 0)return i[a].ALT.call(this);this.raiseNoAltException(n,e.ERR_MSG)}ruleFinallyStateUpdate(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),this.RULE_STACK.length===0&&this.isAtEndOfInput()===!1){const e=this.LA(1),n=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new X9(n,e))}}subruleInternal(e,n,r){let i;try{const s=r!==void 0?r.ARGS:void 0;return this.subruleIdx=n,i=e.apply(this,s),this.cstPostNonTerminal(i,r!==void 0&&r.LABEL!==void 0?r.LABEL:e.ruleName),i}catch(s){throw this.subruleInternalError(s,r,e.ruleName)}}subruleInternalError(e,n,r){throw Zs(e)&&e.partialCstResult!==void 0&&(this.cstPostNonTerminal(e.partialCstResult,n!==void 0&&n.LABEL!==void 0?n.LABEL:r),delete e.partialCstResult),e}consumeInternal(e,n,r){let i;try{const s=this.LA(1);this.tokenMatcher(s,e)===!0?(this.consumeToken(),i=s):this.consumeInternalError(e,s,r)}catch(s){i=this.consumeInternalRecovery(e,n,s)}return this.cstPostTerminal(r!==void 0&&r.LABEL!==void 0?r.LABEL:e.name,i),i}consumeInternalError(e,n,r){let i;const s=this.LA(0);throw r!==void 0&&r.ERR_MSG?i=r.ERR_MSG:i=this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:n,previous:s,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new n0(i,n,s))}consumeInternalRecovery(e,n,r){if(this.recoveryEnabled&&r.name==="MismatchedTokenException"&&!this.isBackTracking()){const i=this.getFollowsForInRuleRecovery(e,n);try{return this.tryInRuleRecovery(e,i)}catch(s){throw s.name===r0?r:s}}else throw r}saveRecogState(){const e=this.errors,n=rt(this.RULE_STACK);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:n,CST_STACK:this.CST_STACK}}reloadRecogState(e){this.errors=e.errors,this.importLexerState(e.lexerState),this.RULE_STACK=e.RULE_STACK}ruleInvocationStateUpdate(e,n,r){this.RULE_OCCURRENCE_STACK.push(r),this.RULE_STACK.push(e),this.cstInvocationStateUpdate(n)}isBackTracking(){return this.isBackTrackingStack.length!==0}getCurrRuleFullName(){const e=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[e]}shortRuleNameToFullName(e){return this.shortRuleNameToFull[e]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),fr)}reset(){this.resetLexerState(),this.subruleIdx=0,this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]}}class mv{initErrorHandler(e){this._errors=[],this.errorMessageProvider=pe(e,"errorMessageProvider")?e.errorMessageProvider:Kn.errorMessageProvider}SAVE_ERROR(e){if(Zs(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:rt(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return rt(this._errors)}set errors(e){this._errors=e}raiseEarlyExitException(e,n,r){const i=this.getCurrRuleFullName(),s=this.getGAstProductions()[i],o=al(e,s,n,this.maxLookahead)[0],l=[];for(let u=1;u<=this.maxLookahead;u++)l.push(this.LA(u));const h=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:o,actual:l,previous:this.LA(0),customUserDescription:r,ruleName:i});throw this.SAVE_ERROR(new Z9(h,this.LA(1),this.LA(0)))}raiseNoAltException(e,n){const r=this.getCurrRuleFullName(),i=this.getGAstProductions()[r],s=sl(e,i,this.maxLookahead),a=[];for(let h=1;h<=this.maxLookahead;h++)a.push(this.LA(h));const o=this.LA(0),l=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:s,actual:a,previous:o,customUserDescription:n,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new K9(l,this.LA(1),o))}}class vv{initContentAssist(){}computeContentAssist(e,n){const r=this.gastProductionsCache[e];if(Sn(r))throw Error(`Rule ->${e}<- does not exist in this grammar.`);return zu([r],n,this.tokenMatcher,this.maxLookahead)}getNextPossibleTokenTypes(e){const n=Vt(e.ruleStack),i=this.getGAstProductions()[n];return new C9(i,e).startWalking()}}const ea={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(ea);const c0=!0,h0=Math.pow(2,qn)-1,u0=Qu({name:"RECORDING_PHASE_TOKEN",pattern:Dt.NA});Ei([u0]);const A0=nl(u0,`This IToken indicates the Parser is in Recording Phase
|
|
1019
|
+
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(A0);const yv={name:`This CSTNode indicates the Parser is in Recording Phase
|
|
1020
|
+
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}};class Cv{initGastRecorder(e){this.recordingProdStack=[],this.RECORDING_PHASE=!1}enableRecording(){this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",()=>{for(let e=0;e<10;e++){const n=e>0?e:"";this[`CONSUME${n}`]=function(r,i){return this.consumeInternalRecord(r,e,i)},this[`SUBRULE${n}`]=function(r,i){return this.subruleInternalRecord(r,e,i)},this[`OPTION${n}`]=function(r){return this.optionInternalRecord(r,e)},this[`OR${n}`]=function(r){return this.orInternalRecord(r,e)},this[`MANY${n}`]=function(r){this.manyInternalRecord(e,r)},this[`MANY_SEP${n}`]=function(r){this.manySepFirstInternalRecord(e,r)},this[`AT_LEAST_ONE${n}`]=function(r){this.atLeastOneInternalRecord(e,r)},this[`AT_LEAST_ONE_SEP${n}`]=function(r){this.atLeastOneSepFirstInternalRecord(e,r)}}this.consume=function(e,n,r){return this.consumeInternalRecord(n,e,r)},this.subrule=function(e,n,r){return this.subruleInternalRecord(n,e,r)},this.option=function(e,n){return this.optionInternalRecord(n,e)},this.or=function(e,n){return this.orInternalRecord(n,e)},this.many=function(e,n){this.manyInternalRecord(e,n)},this.atLeastOne=function(e,n){this.atLeastOneInternalRecord(e,n)},this.ACTION=this.ACTION_RECORD,this.BACKTRACK=this.BACKTRACK_RECORD,this.LA=this.LA_RECORD})}disableRecording(){this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",()=>{const e=this;for(let n=0;n<10;n++){const r=n>0?n:"";delete e[`CONSUME${r}`],delete e[`SUBRULE${r}`],delete e[`OPTION${r}`],delete e[`OR${r}`],delete e[`MANY${r}`],delete e[`MANY_SEP${r}`],delete e[`AT_LEAST_ONE${r}`],delete e[`AT_LEAST_ONE_SEP${r}`]}delete e.consume,delete e.subrule,delete e.option,delete e.or,delete e.many,delete e.atLeastOne,delete e.ACTION,delete e.BACKTRACK,delete e.LA})}ACTION_RECORD(e){}BACKTRACK_RECORD(e,n){return()=>!0}LA_RECORD(e){return na}topLevelRuleRecord(e,n){try{const r=new Nr({definition:[],name:e});return r.name=e,this.recordingProdStack.push(r),n.call(this),this.recordingProdStack.pop(),r}catch(r){if(r.KNOWN_RECORDER_ERROR!==!0)try{r.message=r.message+`
|
|
1021
|
+
This error was thrown during the "grammar recording phase" For more info see:
|
|
1022
|
+
https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw r}throw r}}optionInternalRecord(e,n){return Di.call(this,pt,e,n)}atLeastOneInternalRecord(e,n){Di.call(this,sn,n,e)}atLeastOneSepFirstInternalRecord(e,n){Di.call(this,an,n,e,c0)}manyInternalRecord(e,n){Di.call(this,Je,n,e)}manySepFirstInternalRecord(e,n){Di.call(this,Wt,n,e,c0)}orInternalRecord(e,n){return Iv.call(this,e,n)}subruleInternalRecord(e,n,r){if(ta(n),!e||pe(e,"ruleName")===!1){const o=new Error(`<SUBRULE${f0(n)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>
|
|
1023
|
+
inside top level rule: <${this.recordingProdStack[0].name}>`);throw o.KNOWN_RECORDER_ERROR=!0,o}const i=Ur(this.recordingProdStack),s=e.ruleName,a=new St({idx:n,nonTerminalName:s,label:r==null?void 0:r.LABEL,referencedRule:void 0});return i.definition.push(a),this.outputCst?yv:ea}consumeInternalRecord(e,n,r){if(ta(n),!Eu(e)){const a=new Error(`<CONSUME${f0(n)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>
|
|
1024
|
+
inside top level rule: <${this.recordingProdStack[0].name}>`);throw a.KNOWN_RECORDER_ERROR=!0,a}const i=Ur(this.recordingProdStack),s=new Ne({idx:n,terminalType:e,label:r==null?void 0:r.LABEL});return i.definition.push(s),A0}}function Di(t,e,n,r=!1){ta(n);const i=Ur(this.recordingProdStack),s=yn(e)?e:e.DEF,a=new t({definition:[],idx:n});return r&&(a.separator=e.SEP),pe(e,"MAX_LOOKAHEAD")&&(a.maxLookahead=e.MAX_LOOKAHEAD),this.recordingProdStack.push(a),s.call(this),i.definition.push(a),this.recordingProdStack.pop(),ea}function Iv(t,e){ta(e);const n=Ur(this.recordingProdStack),r=Ee(t)===!1,i=r===!1?t:t.DEF,s=new Yt({definition:[],idx:e,ignoreAmbiguities:r&&t.IGNORE_AMBIGUITIES===!0});pe(t,"MAX_LOOKAHEAD")&&(s.maxLookahead=t.MAX_LOOKAHEAD);const a=cu(i,o=>yn(o.GATE));return s.hasPredicates=a,n.definition.push(s),ge(i,o=>{const l=new dt({definition:[]});s.definition.push(l),pe(o,"IGNORE_AMBIGUITIES")?l.ignoreAmbiguities=o.IGNORE_AMBIGUITIES:pe(o,"GATE")&&(l.ignoreAmbiguities=!0),this.recordingProdStack.push(l),o.ALT.call(this),this.recordingProdStack.pop()}),ea}function f0(t){return t===0?"":`${t}`}function ta(t){if(t<0||t>h0){const e=new Error(`Invalid DSL Method idx value: <${t}>
|
|
1025
|
+
Idx value must be a none negative value smaller than ${h0+1}`);throw e.KNOWN_RECORDER_ERROR=!0,e}}class xv{initPerformanceTracer(e){if(pe(e,"traceInitPerf")){const n=e.traceInitPerf,r=typeof n=="number";this.traceInitMaxIdent=r?n:1/0,this.traceInitPerf=r?n>0:n}else this.traceInitMaxIdent=0,this.traceInitPerf=Kn.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,n){if(this.traceInitPerf===!0){this.traceInitIndent++;const r=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${r}--> <${e}>`);const{time:i,value:s}=uu(n),a=i>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&a(`${r}<-- <${e}> time: ${i}ms`),this.traceInitIndent--,s}else return n()}}function Sv(t,e){e.forEach(n=>{const r=n.prototype;Object.getOwnPropertyNames(r).forEach(i=>{if(i==="constructor")return;const s=Object.getOwnPropertyDescriptor(r,i);s&&(s.get||s.set)?Object.defineProperty(t.prototype,i,s):t.prototype[i]=n.prototype[i]})})}const na=nl(fr,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(na);const Kn=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:Nu,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),ra=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0});var ct;(function(t){t[t.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",t[t.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",t[t.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",t[t.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",t[t.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",t[t.LEFT_RECURSION=5]="LEFT_RECURSION",t[t.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",t[t.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",t[t.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",t[t.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",t[t.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",t[t.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",t[t.TOO_MANY_ALTS=12]="TOO_MANY_ALTS",t[t.CUSTOM_LOOKAHEAD_VALIDATION=13]="CUSTOM_LOOKAHEAD_VALIDATION"})(ct||(ct={}));class ia{static performSelfAnalysis(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")}performSelfAnalysis(){this.TRACE_INIT("performSelfAnalysis",()=>{let e;this.selfAnalysisDone=!0;const n=this.className;this.TRACE_INIT("toFastProps",()=>{Au(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),ge(this.definedRulesNames,i=>{const a=this[i].originalGrammarAction;let o;this.TRACE_INIT(`${i} Rule`,()=>{o=this.topLevelRuleRecord(i,a)}),this.gastProductionsCache[i]=o})}finally{this.disableRecording()}});let r=[];if(this.TRACE_INIT("Grammar Resolving",()=>{r=j9({rules:Ze(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(r)}),this.TRACE_INIT("Grammar Validations",()=>{if(Fe(r)&&this.skipValidations===!1){const i=q9({rules:Ze(this.gastProductionsCache),tokenTypes:Ze(this.tokensMap),errMsgProvider:dr,grammarName:n}),s=D9({lookaheadStrategy:this.lookaheadStrategy,rules:Ze(this.gastProductionsCache),tokenTypes:Ze(this.tokensMap),grammarName:n});this.definitionErrors=this.definitionErrors.concat(i,s)}}),Fe(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{const i=B7(Ze(this.gastProductionsCache));this.resyncFollows=i}),this.TRACE_INIT("ComputeLookaheadFunctions",()=>{var i,s;(s=(i=this.lookaheadStrategy).initialize)===null||s===void 0||s.call(i,{rules:Ze(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(Ze(this.gastProductionsCache))})),!ia.DEFER_DEFINITION_ERRORS_HANDLING&&!Fe(this.definitionErrors))throw e=ue(this.definitionErrors,i=>i.message),new Error(`Parser Definition Errors detected:
|
|
1026
|
+
${e.join(`
|
|
1027
|
+
-------------------------------
|
|
1028
|
+
`)}`)})}constructor(e,n){this.definitionErrors=[],this.selfAnalysisDone=!1;const r=this;if(r.initErrorHandler(n),r.initLexerAdapter(),r.initLooksAhead(n),r.initRecognizerEngine(e,n),r.initRecoverable(n),r.initTreeBuilder(n),r.initContentAssist(),r.initGastRecorder(n),r.initPerformanceTracer(n),pe(n,"ignoredIssues"))throw new Error(`The <ignoredIssues> IParserConfig property has been deprecated.
|
|
1029
|
+
Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.
|
|
1030
|
+
See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES
|
|
1031
|
+
For further details.`);this.skipValidations=pe(n,"skipValidations")?n.skipValidations:Kn.skipValidations}}ia.DEFER_DEFINITION_ERRORS_HANDLING=!1,Sv(ia,[H9,nv,fv,dv,gv,pv,mv,vv,Cv,xv]);class Bv{constructor(e=4){this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}_initWorker(e){if(!this.workers[e]){const n=this.workerCreator();n.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=n}}_getIdleWorker(){for(let e=0;e<this.pool;e++)if(!(this.workerStatus&1<<e))return e;return-1}_onMessage(e,n){const r=this.workersResolve[e];if(r&&r(n),this.queue.length){const{resolve:i,msg:s,transfer:a}=this.queue.shift();this.workersResolve[e]=i,this.workers[e].postMessage(s,a)}else this.workerStatus^=1<<e}setWorkerCreator(e){this.workerCreator=e}setWorkerLimit(e){this.pool=e}postMessage(e,n){return new Promise(r=>{const i=this._getIdleWorker();i!==-1?(this._initWorker(i),this.workerStatus|=1<<i,this.workersResolve[i]=r,this.workers[i].postMessage(e,n)):this.queue.push({resolve:r,msg:e,transfer:n})})}dispose(){this.workers.forEach(e=>e.terminate()),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}class wv extends c.CompressedTexture{constructor(e,n,r,i,s,a){super(e,n,r,s,a),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=c.ClampToEdgeWrapping}}const pl=new WeakMap;let gl=0,ml;const Li=class extends c.Loader{constructor(t){super(t),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new Bv,this.workerSourceURL="",this.workerConfig=null,typeof MSC_TRANSCODER<"u"&&console.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.')}setTranscoderPath(t){return this.transcoderPath=t,this}setWorkerLimit(t){return this.workerPool.setWorkerLimit(t),this}detectSupport(t){return this.workerConfig={astcSupported:t.extensions.has("WEBGL_compressed_texture_astc"),etc1Supported:t.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:t.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:t.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:t.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:t.extensions.has("WEBGL_compressed_texture_pvrtc")||t.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},t.capabilities.isWebGL2&&(this.workerConfig.etc1Supported=!1),this}init(){if(!this.transcoderPending){const t=new c.FileLoader(this.manager);t.setPath(this.transcoderPath),t.setWithCredentials(this.withCredentials);const e=t.loadAsync("basis_transcoder.js"),n=new c.FileLoader(this.manager);n.setPath(this.transcoderPath),n.setResponseType("arraybuffer"),n.setWithCredentials(this.withCredentials);const r=n.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([e,r]).then(([i,s])=>{const a=Li.BasisWorker.toString(),o=["/* constants */","let _EngineFormat = "+JSON.stringify(Li.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(Li.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(Li.BasisFormat),"/* basis_transcoder.js */",i,"/* worker */",a.substring(a.indexOf("{")+1,a.lastIndexOf("}"))].join(`
|
|
1032
|
+
`);this.workerSourceURL=URL.createObjectURL(new Blob([o])),this.transcoderBinary=s,this.workerPool.setWorkerCreator(()=>{const l=new Worker(this.workerSourceURL),h=this.transcoderBinary.slice(0);return l.postMessage({type:"init",config:this.workerConfig,transcoderBinary:h},[h]),l})}),gl>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),gl++}return this.transcoderPending}load(t,e,n,r){if(this.workerConfig===null)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");const i=new c.FileLoader(this.manager);i.setResponseType("arraybuffer"),i.setWithCredentials(this.withCredentials),i.load(t,s=>{if(pl.has(s))return pl.get(s).promise.then(e).catch(r);this._createTexture(s).then(a=>e?e(a):null).catch(r)},n,r)}_createTextureFrom(t,e){const{mipmaps:n,width:r,height:i,format:s,type:a,error:o,dfdTransferFn:l,dfdFlags:h}=t;if(a==="error")return Promise.reject(o);const u=e.layerCount>1?new wv(n,r,i,e.layerCount,s,c.UnsignedByteType):new c.CompressedTexture(n,r,i,s,c.UnsignedByteType);return u.minFilter=n.length===1?c.LinearFilter:c.LinearMipmapLinearFilter,u.magFilter=c.LinearFilter,u.generateMipmaps=!1,u.needsUpdate=!0,"colorSpace"in u?u.colorSpace=l===Fa?"srgb":"srgb-linear":u.encoding=l===Fa?3001:3e3,u.premultiplyAlpha=!!(h&P2),u}async _createTexture(t,e={}){const n=R2(new Uint8Array(t));if(n.vkFormat!==ec)return _v(n);const r=e,i=this.init().then(()=>this.workerPool.postMessage({type:"transcode",buffer:t,taskConfig:r},[t])).then(s=>this._createTextureFrom(s.data,n));return pl.set(t,{promise:i}),i}dispose(){return this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),gl--,this}};let sa=Li;M(sa,"BasisFormat",{ETC1S:0,UASTC_4x4:1}),M(sa,"TranscoderFormat",{ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16}),M(sa,"EngineFormat",{RGBAFormat:c.RGBAFormat,RGBA_ASTC_4x4_Format:c.RGBA_ASTC_4x4_Format,RGBA_BPTC_Format:c.RGBA_BPTC_Format,RGBA_ETC2_EAC_Format:c.RGBA_ETC2_EAC_Format,RGBA_PVRTC_4BPPV1_Format:c.RGBA_PVRTC_4BPPV1_Format,RGBA_S3TC_DXT5_Format:c.RGBA_S3TC_DXT5_Format,RGB_ETC1_Format:c.RGB_ETC1_Format,RGB_ETC2_Format:c.RGB_ETC2_Format,RGB_PVRTC_4BPPV1_Format:c.RGB_PVRTC_4BPPV1_Format,RGB_S3TC_DXT1_Format:c.RGB_S3TC_DXT1_Format}),M(sa,"BasisWorker",function(){let t,e,n;const r=_EngineFormat,i=_TranscoderFormat,s=_BasisFormat;self.addEventListener("message",function(m){const y=m.data;switch(y.type){case"init":t=y.config,a(y.transcoderBinary);break;case"transcode":e.then(()=>{try{const{width:C,height:x,hasAlpha:I,mipmaps:g,format:v,dfdTransferFn:w,dfdFlags:b}=o(y.buffer),B=[];for(let _=0;_<g.length;++_)B.push(g[_].data.buffer);self.postMessage({type:"transcode",id:y.id,width:C,height:x,hasAlpha:I,mipmaps:g,format:v,dfdTransferFn:w,dfdFlags:b},B)}catch(C){console.error(C),self.postMessage({type:"error",id:y.id,error:C.message})}});break}});function a(m){e=new Promise(y=>{n={wasmBinary:m,onRuntimeInitialized:y},BASIS(n)}).then(()=>{n.initializeBasis(),n.KTX2File===void 0&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")})}function o(m){const y=new n.KTX2File(new Uint8Array(m));function C(){y.close(),y.delete()}if(!y.isValid())throw C(),new Error("THREE.KTX2Loader: Invalid or unsupported .ktx2 file");const x=y.isUASTC()?s.UASTC_4x4:s.ETC1S,I=y.getWidth(),g=y.getHeight(),v=y.getLayers()||1,w=y.getLevels(),b=y.getHasAlpha(),B=y.getDFDTransferFunc(),_=y.getDFDFlags(),{transcoderFormat:E,engineFormat:T}=A(x,I,g,b);if(!I||!g||!w)throw C(),new Error("THREE.KTX2Loader: Invalid texture");if(!y.startTranscoding())throw C(),new Error("THREE.KTX2Loader: .startTranscoding failed");const L=[];for(let R=0;R<w;R++){const V=[];let Y,q;for(let ne=0;ne<v;ne++){const X=y.getImageLevelInfo(R,ne,0);Y=X.origWidth<4?X.origWidth:X.width,q=X.origHeight<4?X.origHeight:X.height;const G=new Uint8Array(y.getImageTranscodedSizeInBytes(R,ne,0,E));if(!y.transcodeImage(G,R,ne,0,E,0,-1,-1))throw C(),new Error("THREE.KTX2Loader: .transcodeImage failed.");V.push(G)}L.push({data:d(V),width:Y,height:q})}return C(),{width:I,height:g,hasAlpha:b,mipmaps:L,format:T,dfdTransferFn:B,dfdFlags:_}}const l=[{if:"astcSupported",basisFormat:[s.UASTC_4x4],transcoderFormat:[i.ASTC_4x4,i.ASTC_4x4],engineFormat:[r.RGBA_ASTC_4x4_Format,r.RGBA_ASTC_4x4_Format],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[i.BC7_M5,i.BC7_M5],engineFormat:[r.RGBA_BPTC_Format,r.RGBA_BPTC_Format],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[i.BC1,i.BC3],engineFormat:[r.RGB_S3TC_DXT1_Format,r.RGBA_S3TC_DXT5_Format],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[i.ETC1,i.ETC2],engineFormat:[r.RGB_ETC2_Format,r.RGBA_ETC2_EAC_Format],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[i.ETC1],engineFormat:[r.RGB_ETC1_Format],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[i.PVRTC1_4_RGB,i.PVRTC1_4_RGBA],engineFormat:[r.RGB_PVRTC_4BPPV1_Format,r.RGBA_PVRTC_4BPPV1_Format],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0}],h=l.sort(function(m,y){return m.priorityETC1S-y.priorityETC1S}),u=l.sort(function(m,y){return m.priorityUASTC-y.priorityUASTC});function A(m,y,C,x){let I,g;const v=m===s.ETC1S?h:u;for(let w=0;w<v.length;w++){const b=v[w];if(t[b.if]&&b.basisFormat.includes(m)&&!(x&&b.transcoderFormat.length<2)&&!(b.needsPowerOfTwo&&!(f(y)&&f(C))))return I=b.transcoderFormat[x?1:0],g=b.engineFormat[x?1:0],{transcoderFormat:I,engineFormat:g}}return console.warn("THREE.KTX2Loader: No suitable compressed texture format found. Decoding to RGBA32."),I=i.RGBA32,g=r.RGBAFormat,{transcoderFormat:I,engineFormat:g}}function f(m){return m<=2?!0:(m&m-1)===0&&m!==0}function d(m){let y=0;for(let I=0;I<m.length;I++){const g=m[I];y+=g.byteLength}const C=new Uint8Array(y);let x=0;for(let I=0;I<m.length;I++){const g=m[I];C.set(g,x),x+=g.byteLength}return C}});const d0={[cc]:c.RGBAFormat,[ac]:c.RGBAFormat,[rc]:c.RGBAFormat,[Ra]:c.RGBAFormat,[lc]:c.RGFormat,[sc]:c.RGFormat,[nc]:c.RGFormat,[Oa]:c.RGFormat,[oc]:c.RedFormat,[ic]:c.RedFormat,[ka]:c.RedFormat,[tc]:c.RedFormat},vl={[cc]:c.FloatType,[ac]:c.HalfFloatType,[rc]:c.UnsignedByteType,[Ra]:c.UnsignedByteType,[lc]:c.FloatType,[sc]:c.HalfFloatType,[nc]:c.UnsignedByteType,[Oa]:c.UnsignedByteType,[oc]:c.FloatType,[ic]:c.HalfFloatType,[ka]:c.UnsignedByteType,[tc]:c.UnsignedByteType},bv={[Ra]:3001,[Oa]:3001,[ka]:3001};async function _v(t){const{vkFormat:e,pixelWidth:n,pixelHeight:r,pixelDepth:i}=t;if(d0[e]===void 0)throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");const s=t.levels[0];let a,o;if(t.supercompressionScheme===$l)a=s.levelData;else if(t.supercompressionScheme===_2)ml||(ml=new Promise(async h=>{const u=new U2;await u.init(),h(u)})),a=(await ml).decode(s.levelData,s.uncompressedByteLength);else throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");vl[e]===c.FloatType?o=new Float32Array(a.buffer,a.byteOffset,a.byteLength/Float32Array.BYTES_PER_ELEMENT):vl[e]===c.HalfFloatType?o=new Uint16Array(a.buffer,a.byteOffset,a.byteLength/Uint16Array.BYTES_PER_ELEMENT):o=a;const l=i===0?new c.DataTexture(o,n,r):new Hp(o,n,r,i);return l.type=vl[e],l.format=d0[e],l.encoding=bv[e]||3e3,l.needsUpdate=!0,Promise.resolve(l)}class p0 extends c.DataTextureLoader{constructor(e){super(e),this.type=c.HalfFloatType}parse(e){const o=function(g,v){switch(g){case 1:console.error("THREE.RGBELoader Read Error: "+(v||""));break;case 2:console.error("THREE.RGBELoader Write Error: "+(v||""));break;case 3:console.error("THREE.RGBELoader Bad File Format: "+(v||""));break;default:case 4:console.error("THREE.RGBELoader: Error: "+(v||""))}return-1},A=`
|
|
1033
|
+
`,f=function(g,v,w){v=v||1024;let B=g.pos,_=-1,E=0,T="",L=String.fromCharCode.apply(null,new Uint16Array(g.subarray(B,B+128)));for(;0>(_=L.indexOf(A))&&E<v&&B<g.byteLength;)T+=L,E+=L.length,B+=128,L+=String.fromCharCode.apply(null,new Uint16Array(g.subarray(B,B+128)));return-1<_?(w!==!1&&(g.pos+=E+_+1),T+L.slice(0,_)):!1},d=function(g){const v=/^#\?(\S+)/,w=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,b=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,B=/^\s*FORMAT=(\S+)\s*$/,_=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,E={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let T,L;if(g.pos>=g.byteLength||!(T=f(g)))return o(1,"no header found");if(!(L=T.match(v)))return o(3,"bad initial token");for(E.valid|=1,E.programtype=L[1],E.string+=T+`
|
|
1034
|
+
`;T=f(g),T!==!1;){if(E.string+=T+`
|
|
1035
|
+
`,T.charAt(0)==="#"){E.comments+=T+`
|
|
1036
|
+
`;continue}if((L=T.match(w))&&(E.gamma=parseFloat(L[1])),(L=T.match(b))&&(E.exposure=parseFloat(L[1])),(L=T.match(B))&&(E.valid|=2,E.format=L[1]),(L=T.match(_))&&(E.valid|=4,E.height=parseInt(L[1],10),E.width=parseInt(L[2],10)),E.valid&2&&E.valid&4)break}return E.valid&2?E.valid&4?E:o(3,"missing image size specifier"):o(3,"missing format specifier")},m=function(g,v,w){const b=v;if(b<8||b>32767||g[0]!==2||g[1]!==2||g[2]&128)return new Uint8Array(g);if(b!==(g[2]<<8|g[3]))return o(3,"wrong scanline width");const B=new Uint8Array(4*v*w);if(!B.length)return o(4,"unable to allocate buffer space");let _=0,E=0;const T=4*b,L=new Uint8Array(4),R=new Uint8Array(T);let V=w;for(;V>0&&E<g.byteLength;){if(E+4>g.byteLength)return o(1);if(L[0]=g[E++],L[1]=g[E++],L[2]=g[E++],L[3]=g[E++],L[0]!=2||L[1]!=2||(L[2]<<8|L[3])!=b)return o(3,"bad rgbe scanline format");let Y=0,q;for(;Y<T&&E<g.byteLength;){q=g[E++];const X=q>128;if(X&&(q-=128),q===0||Y+q>T)return o(3,"bad scanline data");if(X){const G=g[E++];for(let H=0;H<q;H++)R[Y++]=G}else R.set(g.subarray(E,E+q),Y),Y+=q,E+=q}const ne=b;for(let X=0;X<ne;X++){let G=0;B[_]=R[X+G],G+=b,B[_+1]=R[X+G],G+=b,B[_+2]=R[X+G],G+=b,B[_+3]=R[X+G],_+=4}V--}return B},y=function(g,v,w,b){const B=g[v+3],_=Math.pow(2,B-128)/255;w[b+0]=g[v+0]*_,w[b+1]=g[v+1]*_,w[b+2]=g[v+2]*_,w[b+3]=1},C=function(g,v,w,b){const B=g[v+3],_=Math.pow(2,B-128)/255;w[b+0]=c.DataUtils.toHalfFloat(Math.min(g[v+0]*_,65504)),w[b+1]=c.DataUtils.toHalfFloat(Math.min(g[v+1]*_,65504)),w[b+2]=c.DataUtils.toHalfFloat(Math.min(g[v+2]*_,65504)),w[b+3]=c.DataUtils.toHalfFloat(1)},x=new Uint8Array(e);x.pos=0;const I=d(x);if(I!==-1){const g=I.width,v=I.height,w=m(x.subarray(x.pos),g,v);if(w!==-1){let b,B,_;switch(this.type){case c.FloatType:_=w.length/4;const E=new Float32Array(_*4);for(let L=0;L<_;L++)y(w,L*4,E,L*4);b=E,B=c.FloatType;break;case c.HalfFloatType:_=w.length/4;const T=new Uint16Array(_*4);for(let L=0;L<_;L++)C(w,L*4,T,L*4);b=T,B=c.HalfFloatType;break;default:console.error("THREE.RGBELoader: unsupported type: ",this.type);break}return{width:g,height:v,data:b,header:I.string,gamma:I.gamma,exposure:I.exposure,type:B}}}return null}setDataType(e){return this.type=e,this}load(e,n,r,i){function s(a,o){switch(a.type){case c.FloatType:case c.HalfFloatType:"colorSpace"in a?a.colorSpace="srgb-linear":a.encoding=3e3,a.minFilter=c.LinearFilter,a.magFilter=c.LinearFilter,a.generateMipmaps=!1,a.flipY=!0;break}n&&n(a,o)}return super.load(e,s,r,i)}}const yl=new WeakMap,Pi=class extends c.Loader{constructor(t){super(t),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.workerConfig=null}setTranscoderPath(t){return this.transcoderPath=t,this}setWorkerLimit(t){return this.workerLimit=t,this}detectSupport(t){return this.workerConfig={astcSupported:t.extensions.has("WEBGL_compressed_texture_astc"),etc1Supported:t.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:t.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:t.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:t.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:t.extensions.has("WEBGL_compressed_texture_pvrtc")||t.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},this}load(t,e,n,r){const i=new c.FileLoader(this.manager);i.setResponseType("arraybuffer"),i.setWithCredentials(this.withCredentials);const s=new c.CompressedTexture;return i.load(t,a=>{if(yl.has(a))return yl.get(a).promise.then(e).catch(r);this._createTexture([a]).then(function(o){s.copy(o),s.needsUpdate=!0,e&&e(s)}).catch(r)},n,r),s}parseInternalAsync(t){const{levels:e}=t,n=new Set;for(let r=0;r<e.length;r++)n.add(e[r].data.buffer);return this._createTexture(Array.from(n),{...t,lowLevel:!0})}_createTexture(t,e={}){let n,r;const i=e;let s=0;for(let o=0;o<t.length;o++)s+=t[o].byteLength;const a=this._allocateWorker(s).then(o=>(n=o,r=this.workerNextTaskID++,new Promise((l,h)=>{n._callbacks[r]={resolve:l,reject:h},n.postMessage({type:"transcode",id:r,buffers:t,taskConfig:i},t)}))).then(o=>{const{mipmaps:l,width:h,height:u,format:A}=o,f=new c.CompressedTexture(l,h,u,A,c.UnsignedByteType);return f.minFilter=l.length===1?c.LinearFilter:c.LinearMipmapLinearFilter,f.magFilter=c.LinearFilter,f.generateMipmaps=!1,f.needsUpdate=!0,f});return a.catch(()=>!0).then(()=>{n&&r&&(n._taskLoad-=s,delete n._callbacks[r])}),yl.set(t[0],{promise:a}),a}_initTranscoder(){if(!this.transcoderPending){const t=new c.FileLoader(this.manager);t.setPath(this.transcoderPath),t.setWithCredentials(this.withCredentials);const e=new Promise((i,s)=>{t.load("basis_transcoder.js",i,void 0,s)}),n=new c.FileLoader(this.manager);n.setPath(this.transcoderPath),n.setResponseType("arraybuffer"),n.setWithCredentials(this.withCredentials);const r=new Promise((i,s)=>{n.load("basis_transcoder.wasm",i,void 0,s)});this.transcoderPending=Promise.all([e,r]).then(([i,s])=>{const a=Pi.BasisWorker.toString(),o=["/* constants */","let _EngineFormat = "+JSON.stringify(Pi.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(Pi.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(Pi.BasisFormat),"/* basis_transcoder.js */",i,"/* worker */",a.substring(a.indexOf("{")+1,a.lastIndexOf("}"))].join(`
|
|
1037
|
+
`);this.workerSourceURL=URL.createObjectURL(new Blob([o])),this.transcoderBinary=s})}return this.transcoderPending}_allocateWorker(t){return this._initTranscoder().then(()=>{if(this.workerPool.length<this.workerLimit){const n=new Worker(this.workerSourceURL);n._callbacks={},n._taskLoad=0,n.postMessage({type:"init",config:this.workerConfig,transcoderBinary:this.transcoderBinary}),n.onmessage=function(r){const i=r.data;switch(i.type){case"transcode":n._callbacks[i.id].resolve(i);break;case"error":n._callbacks[i.id].reject(i);break;default:console.error('THREE.BasisTextureLoader: Unexpected message, "'+i.type+'"')}},this.workerPool.push(n)}else this.workerPool.sort(function(n,r){return n._taskLoad>r._taskLoad?-1:1});const e=this.workerPool[this.workerPool.length-1];return e._taskLoad+=t,e})}dispose(){for(let t=0;t<this.workerPool.length;t++)this.workerPool[t].terminate();return this.workerPool.length=0,this}};let aa=Pi;M(aa,"BasisFormat",{ETC1S:0,UASTC_4x4:1}),M(aa,"TranscoderFormat",{ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16}),M(aa,"EngineFormat",{RGBAFormat:c.RGBAFormat,RGBA_ASTC_4x4_Format:c.RGBA_ASTC_4x4_Format,RGBA_BPTC_Format:c.RGBA_BPTC_Format,RGBA_ETC2_EAC_Format:c.RGBA_ETC2_EAC_Format,RGBA_PVRTC_4BPPV1_Format:c.RGBA_PVRTC_4BPPV1_Format,RGBA_S3TC_DXT5_Format:c.RGBA_S3TC_DXT5_Format,RGB_ETC1_Format:c.RGB_ETC1_Format,RGB_ETC2_Format:c.RGB_ETC2_Format,RGB_PVRTC_4BPPV1_Format:c.RGB_PVRTC_4BPPV1_Format,RGB_S3TC_DXT1_Format:c.RGB_S3TC_DXT1_Format}),M(aa,"BasisWorker",function(){let t,e,n;const r=_EngineFormat,i=_TranscoderFormat,s=_BasisFormat;onmessage=function(I){const g=I.data;switch(g.type){case"init":t=g.config,a(g.transcoderBinary);break;case"transcode":e.then(()=>{try{const{width:v,height:w,hasAlpha:b,mipmaps:B,format:_}=g.taskConfig.lowLevel?o(g.taskConfig):l(g.buffers[0]),E=[];for(let T=0;T<B.length;++T)E.push(B[T].data.buffer);self.postMessage({type:"transcode",id:g.id,width:v,height:w,hasAlpha:b,mipmaps:B,format:_},E)}catch(v){console.error(v),self.postMessage({type:"error",id:g.id,error:v.message})}});break}};function a(I){e=new Promise(g=>{n={wasmBinary:I,onRuntimeInitialized:g},BASIS(n)}).then(()=>{n.initializeBasis()})}function o(I){const{basisFormat:g,width:v,height:w,hasAlpha:b}=I,{transcoderFormat:B,engineFormat:_}=f(g,v,w,b),E=n.getBytesPerBlockOrPixel(B);d(n.isFormatSupported(B),"THREE.BasisTextureLoader: Unsupported format.");const T=[];if(g===s.ETC1S){const L=new n.LowLevelETC1SImageTranscoder,{endpointCount:R,endpointsData:V,selectorCount:Y,selectorsData:q,tablesData:ne}=I.globalData;try{let X;X=L.decodePalettes(R,V,Y,q),d(X,"THREE.BasisTextureLoader: decodePalettes() failed."),X=L.decodeTables(ne),d(X,"THREE.BasisTextureLoader: decodeTables() failed.");for(let G=0;G<I.levels.length;G++){const H=I.levels[G],Z=I.globalData.imageDescs[G],$=C(B,H.width,H.height),O=new Uint8Array($);X=L.transcodeImage(B,O,$/E,H.data,m(B,H.width),y(B,H.height),H.width,H.height,H.index,Z.rgbSliceByteOffset,Z.rgbSliceByteLength,Z.alphaSliceByteOffset,Z.alphaSliceByteLength,Z.imageFlags,b,!1,0,0),d(X,"THREE.BasisTextureLoader: transcodeImage() failed for level "+H.index+"."),T.push({data:O,width:H.width,height:H.height})}}finally{L.delete()}}else for(let L=0;L<I.levels.length;L++){const R=I.levels[L],V=C(B,R.width,R.height),Y=new Uint8Array(V),q=n.transcodeUASTCImage(B,Y,V/E,R.data,m(B,R.width),y(B,R.height),R.width,R.height,R.index,0,R.data.byteLength,0,b,!1,0,0,-1,-1);d(q,"THREE.BasisTextureLoader: transcodeUASTCImage() failed for level "+R.index+"."),T.push({data:Y,width:R.width,height:R.height})}return{width:v,height:w,hasAlpha:b,mipmaps:T,format:_}}function l(I){const g=new n.BasisFile(new Uint8Array(I)),v=g.isUASTC()?s.UASTC_4x4:s.ETC1S,w=g.getImageWidth(0,0),b=g.getImageHeight(0,0),B=g.getNumLevels(0),_=g.getHasAlpha();function E(){g.close(),g.delete()}const{transcoderFormat:T,engineFormat:L}=f(v,w,b,_);if(!w||!b||!B)throw E(),new Error("THREE.BasisTextureLoader: Invalid texture");if(!g.startTranscoding())throw E(),new Error("THREE.BasisTextureLoader: .startTranscoding failed");const R=[];for(let V=0;V<B;V++){const Y=g.getImageWidth(0,V),q=g.getImageHeight(0,V),ne=new Uint8Array(g.getImageTranscodedSizeInBytes(0,V,T));if(!g.transcodeImage(ne,0,V,T,0,_))throw E(),new Error("THREE.BasisTextureLoader: .transcodeImage failed.");R.push({data:ne,width:Y,height:q})}return E(),{width:w,height:b,hasAlpha:_,mipmaps:R,format:L}}const h=[{if:"astcSupported",basisFormat:[s.UASTC_4x4],transcoderFormat:[i.ASTC_4x4,i.ASTC_4x4],engineFormat:[r.RGBA_ASTC_4x4_Format,r.RGBA_ASTC_4x4_Format],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[i.BC7_M5,i.BC7_M5],engineFormat:[r.RGBA_BPTC_Format,r.RGBA_BPTC_Format],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[i.BC1,i.BC3],engineFormat:[r.RGB_S3TC_DXT1_Format,r.RGBA_S3TC_DXT5_Format],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[i.ETC1,i.ETC2],engineFormat:[r.RGB_ETC2_Format,r.RGBA_ETC2_EAC_Format],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[i.ETC1,i.ETC1],engineFormat:[r.RGB_ETC1_Format,r.RGB_ETC1_Format],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[s.ETC1S,s.UASTC_4x4],transcoderFormat:[i.PVRTC1_4_RGB,i.PVRTC1_4_RGBA],engineFormat:[r.RGB_PVRTC_4BPPV1_Format,r.RGBA_PVRTC_4BPPV1_Format],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0}],u=h.sort(function(I,g){return I.priorityETC1S-g.priorityETC1S}),A=h.sort(function(I,g){return I.priorityUASTC-g.priorityUASTC});function f(I,g,v,w){let b,B;const _=I===s.ETC1S?u:A;for(let E=0;E<_.length;E++){const T=_[E];if(t[T.if]&&T.basisFormat.includes(I)&&!(T.needsPowerOfTwo&&!(x(g)&&x(v))))return b=T.transcoderFormat[w?1:0],B=T.engineFormat[w?1:0],{transcoderFormat:b,engineFormat:B}}return console.warn("THREE.BasisTextureLoader: No suitable compressed texture format found. Decoding to RGBA32."),b=i.RGBA32,B=r.RGBAFormat,{transcoderFormat:b,engineFormat:B}}function d(I,g){if(!I)throw new Error(g)}function m(I,g){return Math.ceil(g/n.getFormatBlockWidth(I))}function y(I,g){return Math.ceil(g/n.getFormatBlockHeight(I))}function C(I,g,v){const w=n.getBytesPerBlockOrPixel(I);if(n.formatIsUncompressed(I))return g*v*w;if(I===i.PVRTC1_4_RGB||I===i.PVRTC1_4_RGBA){const b=g+3&-4,B=v+3&-4;return(Math.max(8,b)*Math.max(8,B)*4+7)/8}return m(I,g)*y(I,v)*w}function x(I){return I<=2?!0:(I&I-1)===0&&I!==0}});class Fi extends c.Loader{constructor(e){super(e),this.defaultDPI=90,this.defaultUnit="px"}load(e,n,r,i){const s=this,a=new c.FileLoader(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(o){try{n(s.parse(o))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},r,i)}parse(e){const n=this;function r(O,F){if(O.nodeType!==1)return;const S=v(O);let Q=!0,z=null;switch(O.nodeName){case"svg":break;case"style":s(O);break;case"g":F=m(O,F);break;case"path":F=m(O,F),O.hasAttribute("d")&&(z=i(O));break;case"rect":F=m(O,F),z=l(O);break;case"polygon":F=m(O,F),z=h(O);break;case"polyline":F=m(O,F),z=u(O);break;case"circle":F=m(O,F),z=A(O);break;case"ellipse":F=m(O,F),z=f(O);break;case"line":F=m(O,F),z=d(O);break;case"defs":Q=!1;break;case"mask":Q=!1;break;case"use":F=m(O,F);const P=O.href.baseVal.substring(1),K=O.viewportElement.getElementById(P);K?r(K,F):console.warn("SVGLoader: 'use node' references non-existent node id: "+P);break}if(z&&(F.fill!==void 0&&F.fill!=="none"&&z.color.setStyle(F.fill),b(z,H),T.push(z),z.userData={node:O,style:F}),Q){const P=O.childNodes;for(let K=0;K<P.length;K++)r(P[K],F)}S&&(R.pop(),R.length>0?H.copy(R[R.length-1]):H.identity())}function i(O){const F=new c.ShapePath,S=new c.Vector2,Q=new c.Vector2,z=new c.Vector2;let P=!0,K=!1;const J=O.getAttribute("d").match(/[a-df-z][^a-df-z]*/gi);for(let ie=0,ee=J.length;ie<ee;ie++){const fe=J[ie],te=fe.charAt(0),oe=fe.substr(1).trim();P===!0&&(K=!0,P=!1);let U;switch(te){case"M":U=C(oe);for(let D=0,le=U.length;D<le;D+=2)S.x=U[D+0],S.y=U[D+1],Q.x=S.x,Q.y=S.y,D===0?F.moveTo(S.x,S.y):F.lineTo(S.x,S.y),D===0&&z.copy(S);break;case"H":U=C(oe);for(let D=0,le=U.length;D<le;D++)S.x=U[D],Q.x=S.x,Q.y=S.y,F.lineTo(S.x,S.y),D===0&&K===!0&&z.copy(S);break;case"V":U=C(oe);for(let D=0,le=U.length;D<le;D++)S.y=U[D],Q.x=S.x,Q.y=S.y,F.lineTo(S.x,S.y),D===0&&K===!0&&z.copy(S);break;case"L":U=C(oe);for(let D=0,le=U.length;D<le;D+=2)S.x=U[D+0],S.y=U[D+1],Q.x=S.x,Q.y=S.y,F.lineTo(S.x,S.y),D===0&&K===!0&&z.copy(S);break;case"C":U=C(oe);for(let D=0,le=U.length;D<le;D+=6)F.bezierCurveTo(U[D+0],U[D+1],U[D+2],U[D+3],U[D+4],U[D+5]),Q.x=U[D+2],Q.y=U[D+3],S.x=U[D+4],S.y=U[D+5],D===0&&K===!0&&z.copy(S);break;case"S":U=C(oe);for(let D=0,le=U.length;D<le;D+=4)F.bezierCurveTo(y(S.x,Q.x),y(S.y,Q.y),U[D+0],U[D+1],U[D+2],U[D+3]),Q.x=U[D+0],Q.y=U[D+1],S.x=U[D+2],S.y=U[D+3],D===0&&K===!0&&z.copy(S);break;case"Q":U=C(oe);for(let D=0,le=U.length;D<le;D+=4)F.quadraticCurveTo(U[D+0],U[D+1],U[D+2],U[D+3]),Q.x=U[D+0],Q.y=U[D+1],S.x=U[D+2],S.y=U[D+3],D===0&&K===!0&&z.copy(S);break;case"T":U=C(oe);for(let D=0,le=U.length;D<le;D+=2){const Se=y(S.x,Q.x),De=y(S.y,Q.y);F.quadraticCurveTo(Se,De,U[D+0],U[D+1]),Q.x=Se,Q.y=De,S.x=U[D+0],S.y=U[D+1],D===0&&K===!0&&z.copy(S)}break;case"A":U=C(oe,[3,4],7);for(let D=0,le=U.length;D<le;D+=7){if(U[D+5]==S.x&&U[D+6]==S.y)continue;const Se=S.clone();S.x=U[D+5],S.y=U[D+6],Q.x=S.x,Q.y=S.y,a(F,U[D],U[D+1],U[D+2],U[D+3],U[D+4],Se,S),D===0&&K===!0&&z.copy(S)}break;case"m":U=C(oe);for(let D=0,le=U.length;D<le;D+=2)S.x+=U[D+0],S.y+=U[D+1],Q.x=S.x,Q.y=S.y,D===0?F.moveTo(S.x,S.y):F.lineTo(S.x,S.y),D===0&&z.copy(S);break;case"h":U=C(oe);for(let D=0,le=U.length;D<le;D++)S.x+=U[D],Q.x=S.x,Q.y=S.y,F.lineTo(S.x,S.y),D===0&&K===!0&&z.copy(S);break;case"v":U=C(oe);for(let D=0,le=U.length;D<le;D++)S.y+=U[D],Q.x=S.x,Q.y=S.y,F.lineTo(S.x,S.y),D===0&&K===!0&&z.copy(S);break;case"l":U=C(oe);for(let D=0,le=U.length;D<le;D+=2)S.x+=U[D+0],S.y+=U[D+1],Q.x=S.x,Q.y=S.y,F.lineTo(S.x,S.y),D===0&&K===!0&&z.copy(S);break;case"c":U=C(oe);for(let D=0,le=U.length;D<le;D+=6)F.bezierCurveTo(S.x+U[D+0],S.y+U[D+1],S.x+U[D+2],S.y+U[D+3],S.x+U[D+4],S.y+U[D+5]),Q.x=S.x+U[D+2],Q.y=S.y+U[D+3],S.x+=U[D+4],S.y+=U[D+5],D===0&&K===!0&&z.copy(S);break;case"s":U=C(oe);for(let D=0,le=U.length;D<le;D+=4)F.bezierCurveTo(y(S.x,Q.x),y(S.y,Q.y),S.x+U[D+0],S.y+U[D+1],S.x+U[D+2],S.y+U[D+3]),Q.x=S.x+U[D+0],Q.y=S.y+U[D+1],S.x+=U[D+2],S.y+=U[D+3],D===0&&K===!0&&z.copy(S);break;case"q":U=C(oe);for(let D=0,le=U.length;D<le;D+=4)F.quadraticCurveTo(S.x+U[D+0],S.y+U[D+1],S.x+U[D+2],S.y+U[D+3]),Q.x=S.x+U[D+0],Q.y=S.y+U[D+1],S.x+=U[D+2],S.y+=U[D+3],D===0&&K===!0&&z.copy(S);break;case"t":U=C(oe);for(let D=0,le=U.length;D<le;D+=2){const Se=y(S.x,Q.x),De=y(S.y,Q.y);F.quadraticCurveTo(Se,De,S.x+U[D+0],S.y+U[D+1]),Q.x=Se,Q.y=De,S.x=S.x+U[D+0],S.y=S.y+U[D+1],D===0&&K===!0&&z.copy(S)}break;case"a":U=C(oe,[3,4],7);for(let D=0,le=U.length;D<le;D+=7){if(U[D+5]==0&&U[D+6]==0)continue;const Se=S.clone();S.x+=U[D+5],S.y+=U[D+6],Q.x=S.x,Q.y=S.y,a(F,U[D],U[D+1],U[D+2],U[D+3],U[D+4],Se,S),D===0&&K===!0&&z.copy(S)}break;case"Z":case"z":F.currentPath.autoClose=!0,F.currentPath.curves.length>0&&(S.copy(z),F.currentPath.currentPoint.copy(S),P=!0);break;default:console.warn(fe)}K=!1}return F}function s(O){if(!(!O.sheet||!O.sheet.cssRules||!O.sheet.cssRules.length))for(let F=0;F<O.sheet.cssRules.length;F++){const S=O.sheet.cssRules[F];if(S.type!==1)continue;const Q=S.selectorText.split(/,/gm).filter(Boolean).map(z=>z.trim());for(let z=0;z<Q.length;z++)L[Q[z]]=Object.assign(L[Q[z]]||{},S.style)}}function a(O,F,S,Q,z,P,K,se){if(F==0||S==0){O.lineTo(se.x,se.y);return}Q=Q*Math.PI/180,F=Math.abs(F),S=Math.abs(S);const J=(K.x-se.x)/2,ie=(K.y-se.y)/2,ee=Math.cos(Q)*J+Math.sin(Q)*ie,fe=-Math.sin(Q)*J+Math.cos(Q)*ie;let te=F*F,oe=S*S;const U=ee*ee,D=fe*fe,le=U/te+D/oe;if(le>1){const dn=Math.sqrt(le);F=dn*F,S=dn*S,te=F*F,oe=S*S}const Se=te*D+oe*U,De=(te*oe-Se)/Se;let Ue=Math.sqrt(Math.max(0,De));z===P&&(Ue=-Ue);const qe=Ue*F*fe/S,ht=-Ue*S*ee/F,fn=Math.cos(Q)*qe-Math.sin(Q)*ht+(K.x+se.x)/2,_n=Math.sin(Q)*qe+Math.cos(Q)*ht+(K.y+se.y)/2,st=o(1,0,(ee-qe)/F,(fe-ht)/S),Hn=o((ee-qe)/F,(fe-ht)/S,(-ee-qe)/F,(-fe-ht)/S)%(Math.PI*2);O.currentPath.absellipse(fn,_n,F,S,st,st+Hn,P===0,Q)}function o(O,F,S,Q){const z=O*S+F*Q,P=Math.sqrt(O*O+F*F)*Math.sqrt(S*S+Q*Q);let K=Math.acos(Math.max(-1,Math.min(1,z/P)));return O*Q-F*S<0&&(K=-K),K}function l(O){const F=g(O.getAttribute("x")||0),S=g(O.getAttribute("y")||0),Q=g(O.getAttribute("rx")||O.getAttribute("ry")||0),z=g(O.getAttribute("ry")||O.getAttribute("rx")||0),P=g(O.getAttribute("width")),K=g(O.getAttribute("height")),se=1-.551915024494,J=new c.ShapePath;return J.moveTo(F+Q,S),J.lineTo(F+P-Q,S),(Q!==0||z!==0)&&J.bezierCurveTo(F+P-Q*se,S,F+P,S+z*se,F+P,S+z),J.lineTo(F+P,S+K-z),(Q!==0||z!==0)&&J.bezierCurveTo(F+P,S+K-z*se,F+P-Q*se,S+K,F+P-Q,S+K),J.lineTo(F+Q,S+K),(Q!==0||z!==0)&&J.bezierCurveTo(F+Q*se,S+K,F,S+K-z*se,F,S+K-z),J.lineTo(F,S+z),(Q!==0||z!==0)&&J.bezierCurveTo(F,S+z*se,F+Q*se,S,F+Q,S),J}function h(O){function F(P,K,se){const J=g(K),ie=g(se);z===0?Q.moveTo(J,ie):Q.lineTo(J,ie),z++}const S=/(-?[\d\.?]+)[,|\s](-?[\d\.?]+)/g,Q=new c.ShapePath;let z=0;return O.getAttribute("points").replace(S,F),Q.currentPath.autoClose=!0,Q}function u(O){function F(P,K,se){const J=g(K),ie=g(se);z===0?Q.moveTo(J,ie):Q.lineTo(J,ie),z++}const S=/(-?[\d\.?]+)[,|\s](-?[\d\.?]+)/g,Q=new c.ShapePath;let z=0;return O.getAttribute("points").replace(S,F),Q.currentPath.autoClose=!1,Q}function A(O){const F=g(O.getAttribute("cx")||0),S=g(O.getAttribute("cy")||0),Q=g(O.getAttribute("r")||0),z=new c.Path;z.absarc(F,S,Q,0,Math.PI*2);const P=new c.ShapePath;return P.subPaths.push(z),P}function f(O){const F=g(O.getAttribute("cx")||0),S=g(O.getAttribute("cy")||0),Q=g(O.getAttribute("rx")||0),z=g(O.getAttribute("ry")||0),P=new c.Path;P.absellipse(F,S,Q,z,0,Math.PI*2);const K=new c.ShapePath;return K.subPaths.push(P),K}function d(O){const F=g(O.getAttribute("x1")||0),S=g(O.getAttribute("y1")||0),Q=g(O.getAttribute("x2")||0),z=g(O.getAttribute("y2")||0),P=new c.ShapePath;return P.moveTo(F,S),P.lineTo(Q,z),P.currentPath.autoClose=!1,P}function m(O,F){F=Object.assign({},F);let S={};if(O.hasAttribute("class")){const K=O.getAttribute("class").split(/\s/).filter(Boolean).map(se=>se.trim());for(let se=0;se<K.length;se++)S=Object.assign(S,L["."+K[se]])}O.hasAttribute("id")&&(S=Object.assign(S,L["#"+O.getAttribute("id")]));function Q(K,se,J){J===void 0&&(J=function(ee){return ee.startsWith("url")&&console.warn("SVGLoader: url access in attributes is not implemented."),ee}),O.hasAttribute(K)&&(F[se]=J(O.getAttribute(K))),S[K]&&(F[se]=J(S[K])),O.style&&O.style[K]!==""&&(F[se]=J(O.style[K]))}function z(K){return Math.max(0,Math.min(1,g(K)))}function P(K){return Math.max(0,g(K))}return Q("fill","fill"),Q("fill-opacity","fillOpacity",z),Q("fill-rule","fillRule"),Q("opacity","opacity",z),Q("stroke","stroke"),Q("stroke-opacity","strokeOpacity",z),Q("stroke-width","strokeWidth",P),Q("stroke-linejoin","strokeLineJoin"),Q("stroke-linecap","strokeLineCap"),Q("stroke-miterlimit","strokeMiterLimit",P),Q("visibility","visibility"),F}function y(O,F){return O-(F-O)}function C(O,F,S){if(typeof O!="string")throw new TypeError("Invalid input: "+typeof O);const Q={SEPARATOR:/[ \t\r\n\,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/[\d]/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/},z=0,P=1,K=2,se=3;let J=z,ie=!0,ee="",fe="";const te=[];function oe(Se,De,Ue){const qe=new SyntaxError('Unexpected character "'+Se+'" at index '+De+".");throw qe.partial=Ue,qe}function U(){ee!==""&&(fe===""?te.push(Number(ee)):te.push(Number(ee)*Math.pow(10,Number(fe)))),ee="",fe=""}let D;const le=O.length;for(let Se=0;Se<le;Se++){if(D=O[Se],Array.isArray(F)&&F.includes(te.length%S)&&Q.FLAGS.test(D)){J=P,ee=D,U();continue}if(J===z){if(Q.WHITESPACE.test(D))continue;if(Q.DIGIT.test(D)||Q.SIGN.test(D)){J=P,ee=D;continue}if(Q.POINT.test(D)){J=K,ee=D;continue}Q.COMMA.test(D)&&(ie&&oe(D,Se,te),ie=!0)}if(J===P){if(Q.DIGIT.test(D)){ee+=D;continue}if(Q.POINT.test(D)){ee+=D,J=K;continue}if(Q.EXP.test(D)){J=se;continue}Q.SIGN.test(D)&&ee.length===1&&Q.SIGN.test(ee[0])&&oe(D,Se,te)}if(J===K){if(Q.DIGIT.test(D)){ee+=D;continue}if(Q.EXP.test(D)){J=se;continue}Q.POINT.test(D)&&ee[ee.length-1]==="."&&oe(D,Se,te)}if(J===se){if(Q.DIGIT.test(D)){fe+=D;continue}if(Q.SIGN.test(D)){if(fe===""){fe+=D;continue}fe.length===1&&Q.SIGN.test(fe)&&oe(D,Se,te)}}Q.WHITESPACE.test(D)?(U(),J=z,ie=!1):Q.COMMA.test(D)?(U(),J=z,ie=!0):Q.SIGN.test(D)?(U(),J=P,ee=D):Q.POINT.test(D)?(U(),J=K,ee=D):oe(D,Se,te)}return U(),te}const x=["mm","cm","in","pt","pc","px"],I={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:72/6,pc:1,px:-1},px:{px:1}};function g(O){let F="px";if(typeof O=="string"||O instanceof String)for(let Q=0,z=x.length;Q<z;Q++){const P=x[Q];if(O.endsWith(P)){F=P,O=O.substring(0,O.length-P.length);break}}let S;return F==="px"&&n.defaultUnit!=="px"?S=I.in[n.defaultUnit]/n.defaultDPI:(S=I[F][n.defaultUnit],S<0&&(S=I[F].in*n.defaultDPI)),S*parseFloat(O)}function v(O){if(!(O.hasAttribute("transform")||O.nodeName==="use"&&(O.hasAttribute("x")||O.hasAttribute("y"))))return null;const F=w(O);return R.length>0&&F.premultiply(R[R.length-1]),H.copy(F),R.push(F),F}function w(O){const F=new c.Matrix3,S=V;if(O.nodeName==="use"&&(O.hasAttribute("x")||O.hasAttribute("y"))){const Q=g(O.getAttribute("x")),z=g(O.getAttribute("y"));F.translate(Q,z)}if(O.hasAttribute("transform")){const Q=O.getAttribute("transform").split(")");for(let z=Q.length-1;z>=0;z--){const P=Q[z].trim();if(P==="")continue;const K=P.indexOf("("),se=P.length;if(K>0&&K<se){const J=P.substr(0,K),ie=C(P.substr(K+1,se-K-1));switch(S.identity(),J){case"translate":if(ie.length>=1){const ee=ie[0];let fe=ee;ie.length>=2&&(fe=ie[1]),S.translate(ee,fe)}break;case"rotate":if(ie.length>=1){let ee=0,fe=0,te=0;ee=-ie[0]*Math.PI/180,ie.length>=3&&(fe=ie[1],te=ie[2]),Y.identity().translate(-fe,-te),q.identity().rotate(ee),ne.multiplyMatrices(q,Y),Y.identity().translate(fe,te),S.multiplyMatrices(Y,ne)}break;case"scale":if(ie.length>=1){const ee=ie[0];let fe=ee;ie.length>=2&&(fe=ie[1]),S.scale(ee,fe)}break;case"skewX":ie.length===1&&S.set(1,Math.tan(ie[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":ie.length===1&&S.set(1,0,0,Math.tan(ie[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":ie.length===6&&S.set(ie[0],ie[2],ie[4],ie[1],ie[3],ie[5],0,0,1);break}}F.premultiply(S)}}return F}function b(O,F){function S(P){G.set(P.x,P.y,1).applyMatrix3(F),P.set(G.x,G.y)}const Q=B(F),z=O.subPaths;for(let P=0,K=z.length;P<K;P++){const J=z[P].curves;for(let ie=0;ie<J.length;ie++){const ee=J[ie];ee.isLineCurve?(S(ee.v1),S(ee.v2)):ee.isCubicBezierCurve?(S(ee.v0),S(ee.v1),S(ee.v2),S(ee.v3)):ee.isQuadraticBezierCurve?(S(ee.v0),S(ee.v1),S(ee.v2)):ee.isEllipseCurve&&(Q&&console.warn("SVGLoader: Elliptic arc or ellipse rotation or skewing is not implemented."),X.set(ee.aX,ee.aY),S(X),ee.aX=X.x,ee.aY=X.y,ee.xRadius*=_(F),ee.yRadius*=E(F))}}}function B(O){return O.elements[1]!==0||O.elements[3]!==0}function _(O){const F=O.elements;return Math.sqrt(F[0]*F[0]+F[1]*F[1])}function E(O){const F=O.elements;return Math.sqrt(F[3]*F[3]+F[4]*F[4])}const T=[],L={},R=[],V=new c.Matrix3,Y=new c.Matrix3,q=new c.Matrix3,ne=new c.Matrix3,X=new c.Vector2,G=new c.Vector3,H=new c.Matrix3,Z=new DOMParser().parseFromString(e,"image/svg+xml");return r(Z.documentElement,{fill:"#000",fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeLineJoin:"miter",strokeLineCap:"butt",strokeMiterLimit:4}),{paths:T,xml:Z.documentElement}}static createShapes(e){const r={ORIGIN:0,DESTINATION:1,BETWEEN:2,LEFT:3,RIGHT:4,BEHIND:5,BEYOND:6},i={loc:r.ORIGIN,t:0};function s(C,x,I,g){const v=C.x,w=x.x,b=I.x,B=g.x,_=C.y,E=x.y,T=I.y,L=g.y,R=(B-b)*(_-T)-(L-T)*(v-b),V=(w-v)*(_-T)-(E-_)*(v-b),Y=(L-T)*(w-v)-(B-b)*(E-_),q=R/Y,ne=V/Y;if(Y===0&&R!==0||q<=0||q>=1||ne<0||ne>1)return null;if(R===0&&Y===0){for(let X=0;X<2;X++)if(a(X===0?I:g,C,x),i.loc==r.ORIGIN){const G=X===0?I:g;return{x:G.x,y:G.y,t:i.t}}else if(i.loc==r.BETWEEN){const G=+(v+i.t*(w-v)).toPrecision(10),H=+(_+i.t*(E-_)).toPrecision(10);return{x:G,y:H,t:i.t}}return null}else{for(let H=0;H<2;H++)if(a(H===0?I:g,C,x),i.loc==r.ORIGIN){const Z=H===0?I:g;return{x:Z.x,y:Z.y,t:i.t}}const X=+(v+q*(w-v)).toPrecision(10),G=+(_+q*(E-_)).toPrecision(10);return{x:X,y:G,t:q}}}function a(C,x,I){const g=I.x-x.x,v=I.y-x.y,w=C.x-x.x,b=C.y-x.y,B=g*b-w*v;if(C.x===x.x&&C.y===x.y){i.loc=r.ORIGIN,i.t=0;return}if(C.x===I.x&&C.y===I.y){i.loc=r.DESTINATION,i.t=1;return}if(B<-Number.EPSILON){i.loc=r.LEFT;return}if(B>Number.EPSILON){i.loc=r.RIGHT;return}if(g*w<0||v*b<0){i.loc=r.BEHIND;return}if(Math.sqrt(g*g+v*v)<Math.sqrt(w*w+b*b)){i.loc=r.BEYOND;return}let _;g!==0?_=w/g:_=b/v,i.loc=r.BETWEEN,i.t=_}function o(C,x){const I=[],g=[];for(let v=1;v<C.length;v++){const w=C[v-1],b=C[v];for(let B=1;B<x.length;B++){const _=x[B-1],E=x[B],T=s(w,b,_,E);T!==null&&I.find(L=>L.t<=T.t+Number.EPSILON&&L.t>=T.t-Number.EPSILON)===void 0&&(I.push(T),g.push(new c.Vector2(T.x,T.y)))}}return g}function l(C,x,I){const g=new c.Vector2;x.getCenter(g);const v=[];return I.forEach(w=>{w.boundingBox.containsPoint(g)&&o(C,w.points).forEach(B=>{v.push({identifier:w.identifier,isCW:w.isCW,point:B})})}),v.sort((w,b)=>w.point.x-b.point.x),v}function h(C,x,I,g,v){(v==null||v==="")&&(v="nonzero");const w=new c.Vector2;C.boundingBox.getCenter(w);const b=[new c.Vector2(I,w.y),new c.Vector2(g,w.y)],B=l(b,C.boundingBox,x);B.sort((V,Y)=>V.point.x-Y.point.x);const _=[],E=[];B.forEach(V=>{V.identifier===C.identifier?_.push(V):E.push(V)});const T=_[0].point.x,L=[];let R=0;for(;R<E.length&&E[R].point.x<T;)L.length>0&&L[L.length-1]===E[R].identifier?L.pop():L.push(E[R].identifier),R++;if(L.push(C.identifier),v==="evenodd"){const V=L.length%2===0,Y=L[L.length-2];return{identifier:C.identifier,isHole:V,for:Y}}else if(v==="nonzero"){let V=!0,Y=null,q=null;for(let ne=0;ne<L.length;ne++){const X=L[ne];V?(q=x[X].isCW,V=!1,Y=X):q!==x[X].isCW&&(q=x[X].isCW,V=!0)}return{identifier:C.identifier,isHole:V,for:Y}}else console.warn('fill-rule: "'+v+'" is currently not implemented.')}let u=0,A=999999999,f=-999999999,d=e.subPaths.map(C=>{const x=C.getPoints();let I=-999999999,g=999999999,v=-999999999,w=999999999;for(let b=0;b<x.length;b++){const B=x[b];B.y>I&&(I=B.y),B.y<g&&(g=B.y),B.x>v&&(v=B.x),B.x<w&&(w=B.x)}return f<=v&&(f=v+1),A>=w&&(A=w-1),{curves:C.curves,points:x,isCW:c.ShapeUtils.isClockWise(x),identifier:u++,boundingBox:new c.Box2(new c.Vector2(w,g),new c.Vector2(v,I))}});d=d.filter(C=>C.points.length>1);const m=d.map(C=>h(C,d,A,f,e.userData.style.fillRule)),y=[];return d.forEach(C=>{if(!m[C.identifier].isHole){const I=new c.Shape;I.curves=C.curves,m.filter(v=>v.isHole&&v.for===C.identifier).forEach(v=>{const w=d[v.identifier],b=new c.Path;b.curves=w.curves,I.holes.push(b)}),y.push(I)}}),y}static getStrokeStyle(e,n,r,i,s){return e=e!==void 0?e:1,n=n!==void 0?n:"#000",r=r!==void 0?r:"miter",i=i!==void 0?i:"butt",s=s!==void 0?s:4,{strokeColor:n,strokeWidth:e,strokeLineJoin:r,strokeLineCap:i,strokeMiterLimit:s}}static pointsToStroke(e,n,r,i){const s=[],a=[],o=[];if(Fi.pointsToStrokeWithBuffers(e,n,r,i,s,a,o)===0)return null;const l=new c.BufferGeometry;return l.setAttribute("position",new c.Float32BufferAttribute(s,3)),l.setAttribute("normal",new c.Float32BufferAttribute(a,3)),l.setAttribute("uv",new c.Float32BufferAttribute(o,2)),l}static pointsToStrokeWithBuffers(e,n,r,i,s,a,o,l){const h=new c.Vector2,u=new c.Vector2,A=new c.Vector2,f=new c.Vector2,d=new c.Vector2,m=new c.Vector2,y=new c.Vector2,C=new c.Vector2,x=new c.Vector2,I=new c.Vector2,g=new c.Vector2,v=new c.Vector2,w=new c.Vector2,b=new c.Vector2,B=new c.Vector2,_=new c.Vector2,E=new c.Vector2;r=r!==void 0?r:12,i=i!==void 0?i:.001,l=l!==void 0?l:0,e=fe(e);const T=e.length;if(T<2)return 0;const L=e[0].equals(e[T-1]);let R,V=e[0],Y;const q=n.strokeWidth/2,ne=1/(T-1);let X=0,G,H,Z,$,O=!1,F=0,S=l*3,Q=l*2;z(e[0],e[1],h).multiplyScalar(q),C.copy(e[0]).sub(h),x.copy(e[0]).add(h),I.copy(C),g.copy(x);for(let te=1;te<T;te++){R=e[te],te===T-1?L?Y=e[1]:Y=void 0:Y=e[te+1];const oe=h;if(z(V,R,oe),A.copy(oe).multiplyScalar(q),v.copy(R).sub(A),w.copy(R).add(A),G=X+ne,H=!1,Y!==void 0){z(R,Y,u),A.copy(u).multiplyScalar(q),b.copy(R).sub(A),B.copy(R).add(A),Z=!0,A.subVectors(Y,V),oe.dot(A)<0&&(Z=!1),te===1&&(O=Z),A.subVectors(Y,R),A.normalize();const U=Math.abs(oe.dot(A));if(U!==0){const D=q/U;A.multiplyScalar(-D),f.subVectors(R,V),d.copy(f).setLength(D).add(A),_.copy(d).negate();const le=d.length(),Se=f.length();f.divideScalar(Se),m.subVectors(Y,R);const De=m.length();switch(m.divideScalar(De),f.dot(_)<Se&&m.dot(_)<De&&(H=!0),E.copy(d).add(R),_.add(R),$=!1,H?Z?(B.copy(_),w.copy(_)):(b.copy(_),v.copy(_)):se(),n.strokeLineJoin){case"bevel":J(Z,H,G);break;case"round":ie(Z,H),Z?K(R,v,b,G,0):K(R,B,w,G,1);break;case"miter":case"miter-clip":default:const Ue=q*n.strokeMiterLimit/le;if(Ue<1)if(n.strokeLineJoin!=="miter-clip"){J(Z,H,G);break}else ie(Z,H),Z?(m.subVectors(E,v).multiplyScalar(Ue).add(v),y.subVectors(E,b).multiplyScalar(Ue).add(b),P(v,G,0),P(m,G,0),P(R,G,.5),P(R,G,.5),P(m,G,0),P(y,G,0),P(R,G,.5),P(y,G,0),P(b,G,0)):(m.subVectors(E,w).multiplyScalar(Ue).add(w),y.subVectors(E,B).multiplyScalar(Ue).add(B),P(w,G,1),P(m,G,1),P(R,G,.5),P(R,G,.5),P(m,G,1),P(y,G,1),P(R,G,.5),P(y,G,1),P(B,G,1));else H?(Z?(P(x,X,1),P(C,X,0),P(E,G,0),P(x,X,1),P(E,G,0),P(_,G,1)):(P(x,X,1),P(C,X,0),P(E,G,1),P(C,X,0),P(_,G,0),P(E,G,1)),Z?b.copy(E):B.copy(E)):Z?(P(v,G,0),P(E,G,0),P(R,G,.5),P(R,G,.5),P(E,G,0),P(b,G,0)):(P(w,G,1),P(E,G,1),P(R,G,.5),P(R,G,.5),P(E,G,1),P(B,G,1)),$=!0;break}}else se()}else se();!L&&te===T-1&&ee(e[0],I,g,Z,!0,X),X=G,V=R,C.copy(b),x.copy(B)}if(!L)ee(R,v,w,Z,!1,G);else if(H&&s){let te=E,oe=_;O!==Z&&(te=_,oe=E),Z?($||O)&&(oe.toArray(s,0*3),oe.toArray(s,3*3),$&&te.toArray(s,1*3)):($||!O)&&(oe.toArray(s,1*3),oe.toArray(s,3*3),$&&te.toArray(s,0*3))}return F;function z(te,oe,U){return U.subVectors(oe,te),U.set(-U.y,U.x).normalize()}function P(te,oe,U){s&&(s[S]=te.x,s[S+1]=te.y,s[S+2]=0,a&&(a[S]=0,a[S+1]=0,a[S+2]=1),S+=3,o&&(o[Q]=oe,o[Q+1]=U,Q+=2)),F+=3}function K(te,oe,U,D,le){h.copy(oe).sub(te).normalize(),u.copy(U).sub(te).normalize();let Se=Math.PI;const De=h.dot(u);Math.abs(De)<1&&(Se=Math.abs(Math.acos(De))),Se/=r,A.copy(oe);for(let Ue=0,qe=r-1;Ue<qe;Ue++)f.copy(A).rotateAround(te,Se),P(A,D,le),P(f,D,le),P(te,D,.5),A.copy(f);P(f,D,le),P(U,D,le),P(te,D,.5)}function se(){P(x,X,1),P(C,X,0),P(v,G,0),P(x,X,1),P(v,G,1),P(w,G,0)}function J(te,oe,U){oe?te?(P(x,X,1),P(C,X,0),P(v,G,0),P(x,X,1),P(v,G,0),P(_,G,1),P(v,U,0),P(b,U,0),P(_,U,.5)):(P(x,X,1),P(C,X,0),P(w,G,1),P(C,X,0),P(_,G,0),P(w,G,1),P(w,U,1),P(B,U,0),P(_,U,.5)):te?(P(v,U,0),P(b,U,0),P(R,U,.5)):(P(w,U,1),P(B,U,0),P(R,U,.5))}function ie(te,oe){oe&&(te?(P(x,X,1),P(C,X,0),P(v,G,0),P(x,X,1),P(v,G,0),P(_,G,1),P(v,X,0),P(R,G,.5),P(_,G,1),P(R,G,.5),P(b,X,0),P(_,G,1)):(P(x,X,1),P(C,X,0),P(w,G,1),P(C,X,0),P(_,G,0),P(w,G,1),P(w,X,1),P(_,G,0),P(R,G,.5),P(R,G,.5),P(_,G,0),P(B,X,1)))}function ee(te,oe,U,D,le,Se){switch(n.strokeLineCap){case"round":le?K(te,U,oe,Se,.5):K(te,oe,U,Se,.5);break;case"square":if(le)h.subVectors(oe,te),u.set(h.y,-h.x),A.addVectors(h,u).add(te),f.subVectors(u,h).add(te),D?(A.toArray(s,1*3),f.toArray(s,0*3),f.toArray(s,3*3)):(A.toArray(s,1*3),A.toArray(s,3*3),f.toArray(s,0*3));else{h.subVectors(U,te),u.set(h.y,-h.x),A.addVectors(h,u).add(te),f.subVectors(u,h).add(te);const De=s.length;D?(A.toArray(s,De-1*3),f.toArray(s,De-2*3),f.toArray(s,De-4*3)):(A.toArray(s,De-2*3),f.toArray(s,De-1*3),f.toArray(s,De-4*3))}break}}function fe(te){let oe=!1;for(let D=1,le=te.length-1;D<le;D++)if(te[D].distanceTo(te[D+1])<i){oe=!0;break}if(!oe)return te;const U=[];U.push(te[0]);for(let D=1,le=te.length-1;D<le;D++)te[D].distanceTo(te[D+1])>=i&&U.push(te[D]);return U.push(te[te.length-1]),U}}}const Cl=new WeakMap;class Ev extends c.Loader{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,n,r,i){const s=new c.FileLoader(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,a=>{const o={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(a,o).then(n).catch(i)},r,i)}decodeDracoFile(e,n,r,i){const s={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!r};this.decodeGeometry(e,s).then(n)}decodeGeometry(e,n){for(const l in n.attributeTypes){const h=n.attributeTypes[l];h.BYTES_PER_ELEMENT!==void 0&&(n.attributeTypes[l]=h.name)}const r=JSON.stringify(n);if(Cl.has(e)){const l=Cl.get(e);if(l.key===r)return l.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i;const s=this.workerNextTaskID++,a=e.byteLength,o=this._getWorker(s,a).then(l=>(i=l,new Promise((h,u)=>{i._callbacks[s]={resolve:h,reject:u},i.postMessage({type:"decode",id:s,taskConfig:n,buffer:e},[e])}))).then(l=>this._createGeometry(l.geometry));return o.catch(()=>!0).then(()=>{i&&s&&this._releaseTask(i,s)}),Cl.set(e,{key:r,promise:o}),o}_createGeometry(e){const n=new c.BufferGeometry;e.index&&n.setIndex(new c.BufferAttribute(e.index.array,1));for(let r=0;r<e.attributes.length;r++){const i=e.attributes[r],s=i.name,a=i.array,o=i.itemSize;n.setAttribute(s,new c.BufferAttribute(a,o))}return n}_loadLibrary(e,n){const r=new c.FileLoader(this.manager);return r.setPath(this.decoderPath),r.setResponseType(n),r.setWithCredentials(this.withCredentials),new Promise((i,s)=>{r.load(e,i,void 0,s)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",n=[];return e?n.push(this._loadLibrary("draco_decoder.js","text")):(n.push(this._loadLibrary("draco_wasm_wrapper.js","text")),n.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(n).then(r=>{const i=r[0];e||(this.decoderConfig.wasmBinary=r[1]);const s=Tv.toString(),a=["/* draco decoder */",i,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join(`
|
|
1038
|
+
`);this.workerSourceURL=URL.createObjectURL(new Blob([a]))}),this.decoderPending}_getWorker(e,n){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const i=new Worker(this.workerSourceURL);i._callbacks={},i._taskCosts={},i._taskLoad=0,i.postMessage({type:"init",decoderConfig:this.decoderConfig}),i.onmessage=function(s){const a=s.data;switch(a.type){case"decode":i._callbacks[a.id].resolve(a);break;case"error":i._callbacks[a.id].reject(a);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+a.type+'"')}},this.workerPool.push(i)}else this.workerPool.sort(function(i,s){return i._taskLoad>s._taskLoad?-1:1});const r=this.workerPool[this.workerPool.length-1];return r._taskCosts[e]=n,r._taskLoad+=n,r})}_releaseTask(e,n){e._taskLoad-=e._taskCosts[n],delete e._callbacks[n],delete e._taskCosts[n]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}}function Tv(){let t,e;onmessage=function(a){const o=a.data;switch(o.type){case"init":t=o.decoderConfig,e=new Promise(function(u){t.onModuleLoaded=function(A){u({draco:A})},DracoDecoderModule(t)});break;case"decode":const l=o.buffer,h=o.taskConfig;e.then(u=>{const A=u.draco,f=new A.Decoder,d=new A.DecoderBuffer;d.Init(new Int8Array(l),l.byteLength);try{const m=n(A,f,d,h),y=m.attributes.map(C=>C.array.buffer);m.index&&y.push(m.index.array.buffer),self.postMessage({type:"decode",id:o.id,geometry:m},y)}catch(m){console.error(m),self.postMessage({type:"error",id:o.id,error:m.message})}finally{A.destroy(d),A.destroy(f)}});break}};function n(a,o,l,h){const u=h.attributeIDs,A=h.attributeTypes;let f,d;const m=o.GetEncodedGeometryType(l);if(m===a.TRIANGULAR_MESH)f=new a.Mesh,d=o.DecodeBufferToMesh(l,f);else if(m===a.POINT_CLOUD)f=new a.PointCloud,d=o.DecodeBufferToPointCloud(l,f);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!d.ok()||f.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+d.error_msg());const y={index:null,attributes:[]};for(const C in u){const x=self[A[C]];let I,g;if(h.useUniqueIDs)g=u[C],I=o.GetAttributeByUniqueId(f,g);else{if(g=o.GetAttributeId(f,a[u[C]]),g===-1)continue;I=o.GetAttribute(f,g)}y.attributes.push(i(a,o,f,C,x,I))}return m===a.TRIANGULAR_MESH&&(y.index=r(a,o,f)),a.destroy(f),y}function r(a,o,l){const u=l.num_faces()*3,A=u*4,f=a._malloc(A);o.GetTrianglesUInt32Array(l,A,f);const d=new Uint32Array(a.HEAPF32.buffer,f,u).slice();return a._free(f),{array:d,itemSize:1}}function i(a,o,l,h,u,A){const f=A.num_components(),m=l.num_points()*f,y=m*u.BYTES_PER_ELEMENT,C=s(a,u),x=a._malloc(y);o.GetAttributeDataArrayForAllPoints(l,A,C,y,x);const I=new u(a.HEAPF32.buffer,x,m).slice();return a._free(x),{name:h,array:I,itemSize:f}}function s(a,o){switch(o){case Float32Array:return a.DT_FLOAT32;case Int8Array:return a.DT_INT8;case Int16Array:return a.DT_INT16;case Int32Array:return a.DT_INT32;case Uint8Array:return a.DT_UINT8;case Uint16Array:return a.DT_UINT16;case Uint32Array:return a.DT_UINT32}}}const Mv=["args","center"],Dv=p.defineComponent({__name:"Text3D",props:{font:{},text:{},size:{default:.5},height:{default:.2},curveSegments:{default:5},bevelEnabled:{type:Boolean,default:!0},bevelThickness:{default:.05},bevelSize:{default:.02},bevelOffset:{default:0},bevelSegments:{default:4},center:{type:Boolean,default:!1},needUpdates:{type:Boolean,default:!1}},async setup(t,{expose:e}){let n,r;const i=t,{center:s,font:a,text:o,needUpdates:l,size:h,height:u,curveSegments:A,bevelEnabled:f,bevelThickness:d,bevelSize:m,bevelOffset:y,bevelSegments:C}=p.toRefs(i),{extend:x}=Ae.useTresContext();x({TextGeometry:W3});const I=new Xp,g=p.useSlots(),v=p.computed(()=>{var _;return o!=null&&o.value?o.value:g.default?(_=g.default()[0].children)==null?void 0:_.trim():l.value?"":"TresJS"}),w=p.shallowRef();e({value:w});const b=([n,r]=p.withAsyncContext(()=>new Promise((_,E)=>{try{typeof a.value=="string"?I.load(a.value,T=>{_(T)}):_(a.value)}catch(T){E(console.error("cientos",T))}})),n=await n,r(),n),B=p.computed(()=>({font:b,size:p.toValue(h),height:p.toValue(u),curveSegments:p.toValue(A),bevelEnabled:p.toValue(f),bevelThickness:p.toValue(d),bevelSize:p.toValue(m),bevelOffset:p.toValue(y),bevelSegments:p.toValue(C)}));return p.watchEffect(()=>{w.value&&l.value&&(w.value.geometry.dispose(),w.value.geometry=new W3(v.value,B.value),s.value&&w.value.geometry.center())}),(_,E)=>p.unref(a)?(p.openBlock(),p.createElementBlock("TresMesh",{key:0,ref_key:"text3DRef",ref:w},[v.value?(p.openBlock(),p.createElementBlock("TresTextGeometry",{key:0,args:[v.value,B.value],center:p.unref(s)},null,8,Mv)):p.createCommentVNode("",!0),p.renderSlot(_.$slots,"default")],512)):p.createCommentVNode("",!0)}});function Lv(t,e){const n=p.ref(e),r=new c.AnimationMixer(n.value),i=p.shallowReactive({});t.forEach(a=>{const o=r.clipAction(a,n.value);i[a.name]=o});const{onLoop:s}=Ae.useRenderLoop();return s(({delta:a})=>{r.update(a)}),{actions:i,mixer:r}}const Pv=p.defineComponent({__name:"Levioso",props:{speed:{default:1},rotationFactor:{default:1},floatFactor:{default:1},range:{default:()=>[-.1,.1]}},setup(t,{expose:e}){const n=t,r=p.shallowRef();e({value:r});{const l=Math.random()*1e4,{onLoop:h}=Ae.useRenderLoop();let u=l;h(({delta:A})=>{if(!r.value)return;u+=A*n.speed;const f=u*.25,d=r.value;d.rotation.x=Math.cos(f)*.125*n.rotationFactor,d.rotation.y=Math.sin(f)*.125*n.rotationFactor,d.rotation.z=Math.sin(f)*.05*n.rotationFactor,d.position.y=c.MathUtils.mapLinear(Math.sin(f),-1,1,n.range[0],n.range[1])*n.floatFactor})}return(i,s)=>(p.openBlock(),p.createElementBlock("TresGroup",p.mergeProps(i.$attrs,{ref_key:"groupRef",ref:r}),[p.renderSlot(i.$slots,"default")],16))}});function g0(t){return p.getCurrentScope()?(p.onScopeDispose(t),!0):!1}function Lt(t){return typeof t=="function"?t():p.unref(t)}const Fv=typeof window<"u"&&typeof document<"u",kv=Object.prototype.toString,Ov=t=>kv.call(t)==="[object Object]",pr=()=>{};function m0(t,e){function n(...r){return new Promise((i,s)=>{Promise.resolve(t(()=>e.apply(this,r),{fn:e,thisArg:this,args:r})).then(i).catch(s)})}return n}function Rv(t,e={}){let n,r,i=pr;const s=o=>{clearTimeout(o),i(),i=pr};return o=>{const l=Lt(t),h=Lt(e.maxWait);return n&&s(n),l<=0||h!==void 0&&h<=0?(r&&(s(r),r=null),Promise.resolve(o())):new Promise((u,A)=>{i=e.rejectOnCancel?A:u,h&&!r&&(r=setTimeout(()=>{n&&s(n),r=null,u(o())},h)),n=setTimeout(()=>{r&&s(r),r=null,u(o())},l)})}}function Uv(t,e=!0,n=!0,r=!1){let i=0,s,a=!0,o=pr,l;const h=()=>{s&&(clearTimeout(s),s=void 0,o(),o=pr)};return A=>{const f=Lt(t),d=Date.now()-i,m=()=>l=A();return h(),f<=0?(i=Date.now(),m()):(d>f&&(n||!a)?(i=Date.now(),m()):e&&(l=new Promise((y,C)=>{o=r?C:y,s=setTimeout(()=>{i=Date.now(),a=!0,y(m()),h()},Math.max(0,f-d))})),!n&&!s&&(s=setTimeout(()=>a=!0,f)),a=!1,l)}}function Qv(t,e=200,n={}){return m0(Rv(e,n),t)}function Nv(t,e=200,n=!1,r=!0,i=!1){return m0(Uv(e,n,r,i),t)}function Gv(t,e=!0){p.getCurrentInstance()?p.onMounted(t):e?t():p.nextTick(t)}function Vv(t){var e;const n=Lt(t);return(e=n==null?void 0:n.$el)!=null?e:n}const gr=Fv?window:void 0;function Ge(...t){let e,n,r,i;if(typeof t[0]=="string"||Array.isArray(t[0])?([n,r,i]=t,e=gr):[e,n,r,i]=t,!e)return pr;Array.isArray(n)||(n=[n]),Array.isArray(r)||(r=[r]);const s=[],a=()=>{s.forEach(u=>u()),s.length=0},o=(u,A,f,d)=>(u.addEventListener(A,f,d),()=>u.removeEventListener(A,f,d)),l=p.watch(()=>[Vv(e),Lt(i)],([u,A])=>{if(a(),!u)return;const f=Ov(A)?{...A}:A;s.push(...n.flatMap(d=>r.map(m=>o(u,d,m,f))))},{immediate:!0,flush:"post"}),h=()=>{l(),a()};return g0(h),h}function zv(t){return typeof t=="function"?t:typeof t=="string"?e=>e.key===t:Array.isArray(t)?e=>t.includes(e.key):()=>!0}function mr(...t){let e,n,r={};t.length===3?(e=t[0],n=t[1],r=t[2]):t.length===2?typeof t[1]=="object"?(e=!0,n=t[0],r=t[1]):(e=t[0],n=t[1]):(e=!0,n=t[0]);const{target:i=gr,eventName:s="keydown",passive:a=!1,dedupe:o=!1}=r,l=zv(e);return Ge(i,s,u=>{u.repeat&&Lt(o)||l(u)&&n(u)},a)}function Wv(){const t=p.ref(!1);return p.getCurrentInstance()&&p.onMounted(()=>{t.value=!0}),t}function Yv(t){const e=Wv();return p.computed(()=>(e.value,!!t()))}function jv(t,e={}){const{window:n=gr}=e,r=Yv(()=>n&&"matchMedia"in n&&typeof n.matchMedia=="function");let i;const s=p.ref(!1),a=h=>{s.value=h.matches},o=()=>{i&&("removeEventListener"in i?i.removeEventListener("change",a):i.removeListener(a))},l=p.watchEffect(()=>{r.value&&(o(),i=n.matchMedia(Lt(t)),"addEventListener"in i?i.addEventListener("change",a):i.addListener(a),s.value=i.matches)});return g0(()=>{l(),o(),i=void 0}),s}const v0=1;function qv(t,e={}){const{throttle:n=0,idle:r=200,onStop:i=pr,onScroll:s=pr,offset:a={left:0,right:0,top:0,bottom:0},eventListenerOptions:o={capture:!1,passive:!0},behavior:l="auto",window:h=gr}=e,u=p.ref(0),A=p.ref(0),f=p.computed({get(){return u.value},set(b){m(b,void 0)}}),d=p.computed({get(){return A.value},set(b){m(void 0,b)}});function m(b,B){var _,E,T;if(!h)return;const L=Lt(t);L&&((T=L instanceof Document?h.document.body:L)==null||T.scrollTo({top:(_=Lt(B))!=null?_:d.value,left:(E=Lt(b))!=null?E:f.value,behavior:Lt(l)}))}const y=p.ref(!1),C=p.reactive({left:!0,right:!1,top:!0,bottom:!1}),x=p.reactive({left:!1,right:!1,top:!1,bottom:!1}),I=b=>{y.value&&(y.value=!1,x.left=!1,x.right=!1,x.top=!1,x.bottom=!1,i(b))},g=Qv(I,n+r),v=b=>{var B;if(!h)return;const _=b.document?b.document.documentElement:(B=b.documentElement)!=null?B:b,{display:E,flexDirection:T}=getComputedStyle(_),L=_.scrollLeft;x.left=L<u.value,x.right=L>u.value;const R=Math.abs(L)<=0+(a.left||0),V=Math.abs(L)+_.clientWidth>=_.scrollWidth-(a.right||0)-v0;E==="flex"&&T==="row-reverse"?(C.left=V,C.right=R):(C.left=R,C.right=V),u.value=L;let Y=_.scrollTop;b===h.document&&!Y&&(Y=h.document.body.scrollTop),x.top=Y<A.value,x.bottom=Y>A.value;const q=Math.abs(Y)<=0+(a.top||0),ne=Math.abs(Y)+_.clientHeight>=_.scrollHeight-(a.bottom||0)-v0;E==="flex"&&T==="column-reverse"?(C.top=ne,C.bottom=q):(C.top=q,C.bottom=ne),A.value=Y},w=b=>{var B;if(!h)return;const _=(B=b.target.documentElement)!=null?B:b.target;v(_),y.value=!0,g(b),s(b)};return Ge(t,"scroll",n?Nv(w,n,!0,!1):w,o),Ge(t,"scrollend",I,o),{x:f,y:d,isScrolling:y,arrivedState:C,directions:x,measure(){const b=Lt(t);h&&b&&v(b)}}}const Kv={page:t=>[t.pageX,t.pageY],client:t=>[t.clientX,t.clientY],screen:t=>[t.screenX,t.screenY],movement:t=>t instanceof Touch?null:[t.movementX,t.movementY]};function Xv(t={}){const{type:e="page",touch:n=!0,resetOnTouchEnds:r=!1,initialValue:i={x:0,y:0},window:s=gr,target:a=s,scroll:o=!0,eventFilter:l}=t;let h=null;const u=p.ref(i.x),A=p.ref(i.y),f=p.ref(null),d=typeof e=="function"?e:Kv[e],m=w=>{const b=d(w);h=w,b&&([u.value,A.value]=b,f.value="mouse")},y=w=>{if(w.touches.length>0){const b=d(w.touches[0]);b&&([u.value,A.value]=b,f.value="touch")}},C=()=>{if(!h||!s)return;const w=d(h);h instanceof MouseEvent&&w&&(u.value=w[0]+s.scrollX,A.value=w[1]+s.scrollY)},x=()=>{u.value=i.x,A.value=i.y},I=l?w=>l(()=>m(w),{}):w=>m(w),g=l?w=>l(()=>y(w),{}):w=>y(w),v=l?()=>l(()=>C(),{}):()=>C();if(a){const w={passive:!0};Ge(a,["mousemove","dragover"],I,w),n&&e!=="movement"&&(Ge(a,["touchstart","touchmove"],g,w),r&&Ge(a,"touchend",x,w)),o&&e==="page"&&Ge(s,"scroll",v,{passive:!0})}return{x:u,y:A,sourceType:f}}function Zv({window:t=gr}={}){if(!t)return{x:p.ref(0),y:p.ref(0)};const e=p.ref(t.scrollX),n=p.ref(t.scrollY);return Ge(t,"scroll",()=>{e.value=t.scrollX,n.value=t.scrollY},{capture:!1,passive:!0}),{x:e,y:n}}function y0(t={}){const{window:e=gr,initialWidth:n=Number.POSITIVE_INFINITY,initialHeight:r=Number.POSITIVE_INFINITY,listenOrientation:i=!0,includeScrollbar:s=!0}=t,a=p.ref(n),o=p.ref(r),l=()=>{e&&(s?(a.value=e.innerWidth,o.value=e.innerHeight):(a.value=e.document.documentElement.clientWidth,o.value=e.document.documentElement.clientHeight))};if(l(),Gv(l),Ge("resize",l,{passive:!0}),i){const h=jv("(orientation: portrait)");p.watch(h,()=>l())}return{width:a,height:o}}const Jv=p.defineComponent({__name:"MouseParallax",props:{disabled:{type:Boolean,default:!1},factor:{default:2.5},ease:{default:.1}},setup(t){const e=t,{camera:n}=Ae.useTresContext(),{disabled:r,factor:i,ease:s}=p.toRefs(e),{x:a,y:o}=Xv(),{width:l,height:h}=y0(),u=p.ref(),A=p.computed(()=>(a.value/l.value-.5)*i.value),f=p.computed(()=>-(o.value/h.value-.5)*i.value),{onLoop:d}=Ae.useRenderLoop();return d(({delta:m})=>{r.value||!u.value||(u.value.position.x+=(A.value-u.value.position.x)*s.value*m,u.value.position.y+=(f.value-u.value.position.y)*s.value*m)}),p.watch(()=>u.value,m=>m==null?void 0:m.add(n.value)),(m,y)=>(p.openBlock(),p.createElementBlock("TresGroup",{ref_key:"cameraGroupRef",ref:u},null,512))}}),Hv=p.defineComponent({name:"GlobalAudio",props:["src","loop","volume","playbackRate","playTrigger","stopTrigger"],async setup(t,{expose:e,emit:n}){var A;const{camera:r,renderer:i}=Ae.useTresContext(),s=new c.AudioListener;(A=r.value)==null||A.add(s);const a=new c.Audio(s),o=new c.AudioLoader;e({sound:a}),p.onUnmounted(()=>{a&&a.disconnect()}),p.watch(()=>[t.playbackRate],()=>a.setPlaybackRate(t.playbackRate??1),{immediate:!0}),p.watch(()=>[t.volume],()=>a.setVolume(t.volume??.5),{immediate:!0}),p.watch(()=>[t.loop],()=>a.setLoop(t.loop??!1),{immediate:!0}),p.watch(()=>[t.src],async()=>{const f=await o.loadAsync(t.src);a.setBuffer(f)},{immediate:!0});const l=document.getElementById(t.playTrigger??""),h=l||i.value.domElement;Ge(h,"click",()=>{a.isPlaying?a.pause():a.play(),n("isPlaying",a.isPlaying)});const u=document.getElementById(t.stopTrigger??"");return u&&Ge(u,"click",()=>{a.stop(),n("isPlaying",a.isPlaying)}),null}});class ki extends c.Mesh{constructor(){super(ki.Geometry,new c.MeshBasicMaterial({opacity:0,transparent:!0})),this.isLensflare=!0,this.type="Lensflare",this.frustumCulled=!1,this.renderOrder=1/0;const e=new c.Vector3,n=new c.Vector3,r=new c.FramebufferTexture(16,16),i=new c.FramebufferTexture(16,16),s=ki.Geometry,a=new c.RawShaderMaterial({uniforms:{scale:{value:null},screenPosition:{value:null}},vertexShader:`
|
|
1039
|
+
|
|
1040
|
+
precision highp float;
|
|
1041
|
+
|
|
1042
|
+
uniform vec3 screenPosition;
|
|
1043
|
+
uniform vec2 scale;
|
|
1044
|
+
|
|
1045
|
+
attribute vec3 position;
|
|
1046
|
+
|
|
1047
|
+
void main() {
|
|
1048
|
+
|
|
1049
|
+
gl_Position = vec4( position.xy * scale + screenPosition.xy, screenPosition.z, 1.0 );
|
|
1050
|
+
|
|
1051
|
+
}`,fragmentShader:`
|
|
1052
|
+
|
|
1053
|
+
precision highp float;
|
|
1054
|
+
|
|
1055
|
+
void main() {
|
|
1056
|
+
|
|
1057
|
+
gl_FragColor = vec4( 1.0, 0.0, 1.0, 1.0 );
|
|
1058
|
+
|
|
1059
|
+
}`,depthTest:!0,depthWrite:!1,transparent:!1}),o=new c.RawShaderMaterial({uniforms:{map:{value:r},scale:{value:null},screenPosition:{value:null}},vertexShader:`
|
|
1060
|
+
|
|
1061
|
+
precision highp float;
|
|
1062
|
+
|
|
1063
|
+
uniform vec3 screenPosition;
|
|
1064
|
+
uniform vec2 scale;
|
|
1065
|
+
|
|
1066
|
+
attribute vec3 position;
|
|
1067
|
+
attribute vec2 uv;
|
|
1068
|
+
|
|
1069
|
+
varying vec2 vUV;
|
|
1070
|
+
|
|
1071
|
+
void main() {
|
|
1072
|
+
|
|
1073
|
+
vUV = uv;
|
|
1074
|
+
|
|
1075
|
+
gl_Position = vec4( position.xy * scale + screenPosition.xy, screenPosition.z, 1.0 );
|
|
1076
|
+
|
|
1077
|
+
}`,fragmentShader:`
|
|
1078
|
+
|
|
1079
|
+
precision highp float;
|
|
1080
|
+
|
|
1081
|
+
uniform sampler2D map;
|
|
1082
|
+
|
|
1083
|
+
varying vec2 vUV;
|
|
1084
|
+
|
|
1085
|
+
void main() {
|
|
1086
|
+
|
|
1087
|
+
gl_FragColor = texture2D( map, vUV );
|
|
1088
|
+
|
|
1089
|
+
}`,depthTest:!1,depthWrite:!1,transparent:!1}),l=new c.Mesh(s,a),h=[],u=C0.Shader,A=new c.RawShaderMaterial({uniforms:{map:{value:null},occlusionMap:{value:i},color:{value:new c.Color(16777215)},scale:{value:new c.Vector2},screenPosition:{value:new c.Vector3}},vertexShader:u.vertexShader,fragmentShader:u.fragmentShader,blending:c.AdditiveBlending,transparent:!0,depthWrite:!1}),f=new c.Mesh(s,A);this.addElement=function(x){h.push(x)};const d=new c.Vector2,m=new c.Vector2,y=new c.Box2,C=new c.Vector4;this.onBeforeRender=function(x,I,g){x.getCurrentViewport(C);const v=C.w/C.z,w=C.z/2,b=C.w/2;let B=16/C.w;if(d.set(B*v,B),y.min.set(C.x,C.y),y.max.set(C.x+(C.z-16),C.y+(C.w-16)),n.setFromMatrixPosition(this.matrixWorld),n.applyMatrix4(g.matrixWorldInverse),!(n.z>0)&&(e.copy(n).applyMatrix4(g.projectionMatrix),m.x=C.x+e.x*w+w-8,m.y=C.y+e.y*b+b-8,y.containsPoint(m))){x.copyFramebufferToTexture(m,r);let _=a.uniforms;_.scale.value=d,_.screenPosition.value=e,x.renderBufferDirect(g,null,s,a,l,null),x.copyFramebufferToTexture(m,i),_=o.uniforms,_.scale.value=d,_.screenPosition.value=e,x.renderBufferDirect(g,null,s,o,l,null);const E=-e.x*2,T=-e.y*2;for(let L=0,R=h.length;L<R;L++){const V=h[L],Y=A.uniforms;Y.color.value.copy(V.color),Y.map.value=V.texture,Y.screenPosition.value.x=e.x+E*V.distance,Y.screenPosition.value.y=e.y+T*V.distance,B=V.size/C.w;const q=C.w/C.z;Y.scale.value.set(B*q,B),A.uniformsNeedUpdate=!0,x.renderBufferDirect(g,null,s,A,f,null)}}},this.dispose=function(){a.dispose(),o.dispose(),A.dispose(),r.dispose(),i.dispose();for(let x=0,I=h.length;x<I;x++)h[x].texture.dispose()}}}class C0{constructor(e,n=1,r=0,i=new c.Color(16777215)){this.texture=e,this.size=n,this.distance=r,this.color=i}}C0.Shader={uniforms:{map:{value:null},occlusionMap:{value:null},color:{value:null},scale:{value:null},screenPosition:{value:null}},vertexShader:`
|
|
1090
|
+
|
|
1091
|
+
precision highp float;
|
|
1092
|
+
|
|
1093
|
+
uniform vec3 screenPosition;
|
|
1094
|
+
uniform vec2 scale;
|
|
1095
|
+
|
|
1096
|
+
uniform sampler2D occlusionMap;
|
|
1097
|
+
|
|
1098
|
+
attribute vec3 position;
|
|
1099
|
+
attribute vec2 uv;
|
|
1100
|
+
|
|
1101
|
+
varying vec2 vUV;
|
|
1102
|
+
varying float vVisibility;
|
|
1103
|
+
|
|
1104
|
+
void main() {
|
|
1105
|
+
|
|
1106
|
+
vUV = uv;
|
|
1107
|
+
|
|
1108
|
+
vec2 pos = position.xy;
|
|
1109
|
+
|
|
1110
|
+
vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );
|
|
1111
|
+
visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );
|
|
1112
|
+
visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );
|
|
1113
|
+
visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );
|
|
1114
|
+
visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );
|
|
1115
|
+
visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );
|
|
1116
|
+
visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );
|
|
1117
|
+
visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );
|
|
1118
|
+
visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );
|
|
1119
|
+
|
|
1120
|
+
vVisibility = visibility.r / 9.0;
|
|
1121
|
+
vVisibility *= 1.0 - visibility.g / 9.0;
|
|
1122
|
+
vVisibility *= visibility.b / 9.0;
|
|
1123
|
+
|
|
1124
|
+
gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );
|
|
1125
|
+
|
|
1126
|
+
}`,fragmentShader:`
|
|
1127
|
+
|
|
1128
|
+
precision highp float;
|
|
1129
|
+
|
|
1130
|
+
uniform sampler2D map;
|
|
1131
|
+
uniform vec3 color;
|
|
1132
|
+
|
|
1133
|
+
varying vec2 vUV;
|
|
1134
|
+
varying float vVisibility;
|
|
1135
|
+
|
|
1136
|
+
void main() {
|
|
1137
|
+
|
|
1138
|
+
vec4 texture = texture2D( map, vUV );
|
|
1139
|
+
texture.a *= vVisibility;
|
|
1140
|
+
gl_FragColor = texture;
|
|
1141
|
+
gl_FragColor.rgb *= color;
|
|
1142
|
+
|
|
1143
|
+
}`},ki.Geometry=function(){const t=new c.BufferGeometry,e=new Float32Array([-1,-1,0,0,0,1,-1,0,1,0,1,1,0,1,1,-1,1,0,0,1]),n=new c.InterleavedBuffer(e,5);return t.setIndex([0,1,2,0,2,3]),t.setAttribute("position",new c.InterleavedBufferAttribute(n,3,0,!1)),t.setAttribute("uv",new c.InterleavedBufferAttribute(n,2,3,!1)),t}();function $v(t){return t}function ey(t){return t*t*t}function ty(t){return t<.5?4*t*t*t:1-(-2*t+2)**3/2}function ny(t){return t*t*t*t}function ry(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}const I0=c.MathUtils.clamp;class x0{constructor(e=0,n){Ve(this,"_getNext");Ve(this,"_getGenerator");this._getGenerator=n??this.getMulberry32,this._getNext=this._getGenerator(e)}seed(e){this._getNext=this._getGenerator(e)}rand(){return this._getNext()}float(e,n){return e+this._getNext()*(n-e)}floatSpread(e){return this.float(-.5*e,.5*e)}int(e,n){return e+Math.floor(this._getNext()*(n-e+1))}choice(e){return e.length?e[Math.floor(this._getNext()*e.length)]:null}defaultChoice(e,n){return e.length?e[Math.floor(this._getNext()*e.length)]:n}sample(e,n,r){const i=e.length;n=I0(n,0,i-1),r=I0(r??i-1,0,i-1);const s=this.int(n,r),a=this.shuffle(e.map((l,h)=>h)),o=Math.min(e.length,s);return a.slice(0,o).sort().map(l=>e[l])}shuffle(e){return e.map(n=>({value:n,sort:this._getNext()})).sort((n,r)=>n.sort-r.sort).map(({value:n})=>n)}getMulberry32(e=0){return 0<e&&e<1&&(e=Math.floor(e*2**16)),()=>{e+=1831565813;let n=e;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}}const Bn="https://raw.githubusercontent.com/Tresjs/assets/93976c7d63ac83d4a254a41a10b2362bc17e90c9/textures/lensflare/",Il=`${Bn}circle.png`,oa=`${Bn}circleBlur.png`,iy=`${Bn}circleRainbow.png`,sy=`${Bn}line.png`,S0=`${Bn}poly6.png`,B0=`${Bn}polyStroke6.png`,ay=`${Bn}rays.png`,la=`${Bn}ring.png`,oy=`${Bn}starThin6.png`,ly={texture:[sy,la],color:["white"],distance:[0,0],size:[750,1024],length:[0,2]},cy={texture:[oa],color:["white"],distance:[0,0],size:[180,512],length:[1,1]},hy={texture:[ay],color:["white"],distance:[0,0],size:[180,512],length:[1,1]},uy={texture:[Il,iy,la,oy],color:["white"],distance:[0,0],size:[180,512],length:[2,3]},[w0,b0]=[3679071,132442],xl=[ly,cy,hy,uy,{texture:[oa,Il,la,S0,B0],color:["dimgray","gray","darkgray",w0,b0],distance:[.5,2.5],size:[20,180],length:[5,21]},{texture:[oa,Il,la,S0,B0],color:["dimgray","gray","darkgray",w0,b0],distance:[-.6,-.1],size:[180,360],length:[0,5]}],ca={color:"white",distance:0,size:512,texture:oa},_0=(t,e,n=void 0,r=void 0,i=ca)=>{if(t!==void 0&&t.length>0&&(typeof n=="number"||typeof r<"u")){const o=T0(n??0,r??xl),l=o.length,h=t.length;return l>=h?o.map((u,A)=>Object.assign(u,e,A<h?t[A]:{})):t.map((u,A)=>Object.assign({},i,A<l?o[A]:{},e,u))}if(t!==void 0&&t.length>0){const o=Object.assign({},i,e);return t.map(l=>Object.assign({},o,l))}const s=r===void 0||r.length===0?xl:r;return T0(n??0,s).map(o=>Object.assign({},o,e))},Ay=[$v,ey,ty,ny,ry],E0=c.MathUtils.lerp,T0=(t=0,e=xl)=>{const r=new x0(t).choice(Ay);return e.map((i,s)=>{const a=new x0(t*(s*7907+1)+(typeof i.seed=="number"?i.seed:0)),o=a.int(i.length[0],i.length[1]);return new Array(o).fill(0).map(()=>{const l=r(a.rand());return{texture:a.defaultChoice(i.texture,ca.texture),size:E0(i.size[0],i.size[1],r(1-l)),distance:E0(i.distance[0],i.distance[1],l),color:a.defaultChoice(i.color,ca.color)}})}).flat()};function fy(t){return dy(t,(e,n)=>n in ca&&e!==void 0)}function dy(t,e){const n={};return Object.keys(t).forEach(r=>{e(t[r],r)&&(n[r]=t[r])}),n}const py=p.defineComponent({__name:"component",props:{texture:{},size:{},distance:{},color:{},elements:{default:void 0},scale:{default:1},seed:{default:void 0},seedProps:{default:void 0}},setup(t,{expose:e}){const n=t,r=p.shallowRef(),i=p.shallowRef([]),s=p.shallowRef(fy(n));e({value:r});const a=new c.TextureLoader,o=new ki,l=[],h=()=>{var d,m,y;for(;l.length;)l.pop();(d=r.value)==null||d.children.forEach(C=>{"dispose"in C&&C.dispose()}),(m=r.value)==null||m.remove(...r.value.children),(y=r.value)==null||y.dispose()},u=d=>{if(typeof d.texture=="string"){const m=d.texture;d.texture=a.load(m),d.texture.name=m}return d.color=Ae.normalizeColor(d.color),d},A=()=>{for(;i.value.length>l.length;){const m={...u(i.value[l.length])};l.push(m),o.addElement(m)}i.value.forEach((d,m)=>{const y=l[m],{texture:C,size:x,distance:I,color:g}=d;if(typeof C=="string"){if(y.texture.name!==C){y.texture.dispose();const v=C;y.texture=a.load(v),y.texture.name=v}}else y.texture!==C&&(y.texture.dispose(),y.texture=C);y.size=x,y.distance=I,y.color=Ae.normalizeColor(g)}),f()},f=()=>{for(let d=i.value.length-1;d<l.length;d++)l[d].size=0;i.value.forEach((d,m)=>{l[m].size=d.size*n.scale})};return p.onUnmounted(()=>{h()}),p.onMounted(()=>{var d;(d=r.value)==null||d.add(o),i.value=_0(n.elements,s.value,n.seed,n.seedProps)}),p.watch(()=>[n.color,n.distance,n.size,n.texture],()=>{s.value={color:n.color,distance:n.distance,size:n.size,texture:n.texture}}),p.watch(()=>[s.value,n.elements,n.seed,n.seedProps],()=>{i.value=_0(n.elements,s.value,n.seed,n.seedProps)}),p.watch(()=>n.scale,()=>{f()}),p.watch(()=>i.value,()=>{A()}),(d,m)=>(p.openBlock(),p.createElementBlock("TresGroup",{ref_key:"lensflareRef",ref:r},null,512))}});function M0(t){const e=p.ref(null),{height:n,width:r,settings:i,depth:s}=p.isReactive(t)?p.toRefs(t):p.toRefs(p.reactive(t)),{onLoop:a}=Ae.useRenderLoop(),{camera:o,renderer:l,scene:h,sizes:u}=Ae.useTresContext();return p.watchEffect(()=>{var A;(A=e.value)==null||A.dispose(),e.value=new c.WebGLRenderTarget((r==null?void 0:r.value)||u.width.value,(n==null?void 0:n.value)||u.height.value,{minFilter:c.LinearFilter,magFilter:c.LinearFilter,type:c.HalfFloatType,...i==null?void 0:i.value}),s!=null&&s.value&&(e.value.depthTexture=new c.DepthTexture((r==null?void 0:r.value)||u.width.value,(n==null?void 0:n.value)||u.height.value,c.FloatType))}),a(()=>{l.value.setRenderTarget(e.value),l.value.clear(),l.value.render(h.value,o.value),l.value.setRenderTarget(null)}),p.onBeforeUnmount(()=>{var A;(A=e.value)==null||A.dispose()}),e}const gy=p.defineComponent({__name:"component",props:{width:{},height:{},depth:{type:Boolean,default:!1},settings:{default:void 0}},setup(t,{expose:e}){const r=M0(t);return e({value:r}),()=>{}}}),ha={sunset:"venice/venice_sunset_1k.hdr",studio:"studio/poly_haven_studio_1k.hdr",city:"city/canary_wharf_1k.hdr",umbrellas:"outdoor/outdoor_umbrellas_1k.hdr",night:"outdoor/satara_night_1k.hdr",forest:"outood/mossy_forest_1k.hdr",snow:"outdoor/snowy_forest_path_01_1k.hdr",dawn:"kiara/kiara_1_dawn_1k.hdr",hangar:"indoor/small_hangar_01_1k.hdr",urban:"indoor/abandoned_games_room_02_1k.hdr",modern:"city/modern_buildings_2_1k.hdr",shangai:"city/shanghai_bund_1k.hdr"},my="https://raw.githubusercontent.com/Tresjs/assets/main/textures/hdr/";async function D0(t){const{scene:e}=Ae.useTresContext(),{preset:n,blur:r,files:i=[],path:s="",background:a}=p.toRefs(t),o=p.ref(),l=p.computed(()=>Array.isArray(i.value)),h=p.computed(()=>l.value?c.CubeTextureLoader:p0),u=p.ref(null);return p.watch(()=>[i,s],async([A,f])=>{if(A.value.length>0&&!n.value){try{u.value=await Ae.useLoader(p.unref(h),l.value?[p.unref(A)]:p.unref(A),d=>{f.value&&d.setPath(p.unref(f))})}catch(d){throw new Error(`Failed to load environment map: ${d}`)}u.value&&(o.value=l.value?u.value[0]:u.value,o.value.mapping=l.value?c.CubeReflectionMapping:c.EquirectangularReflectionMapping)}},{immediate:!0}),p.watch(()=>o.value,A=>{e.value&&(e.value.environment=A)},{immediate:!0}),p.watch(()=>[a.value,o.value],([A,f])=>{e.value&&(e.value.background=A?f:void 0)},{immediate:!0}),p.watch(()=>r==null?void 0:r.value,A=>{e.value&&(e.value.backgroundBlurriness=A)},{immediate:!0}),p.watch(n,async A=>{if(A&&A in ha){const f=my,d=ha[A];try{u.value=await Ae.useLoader(p0,d,m=>{f&&m.setPath(f)})}catch(m){throw new Error(`Failed to load environment map: ${m}`)}u.value&&(o.value=u.value,o.value.mapping=c.EquirectangularReflectionMapping)}else if(A&&!(A in ha))throw new Error(`Preset must be one of: ${Object.keys(ha).join(", ")}`)},{immediate:!0}),{texture:o}}let ua=null;function vy(t,e){return n=>{e&&e(n),t.draco&&(ua||(ua=new Ev),ua.setDecoderPath(t.decoderPath||"https://www.gstatic.com/draco/versioned/decoders/1.4.3/"),n.setDRACOLoader(ua))}}async function L0(t,e={draco:!1},n){return await Ae.useLoader(X5,t,vy(e,n))}const yy=["object"],Cy=p.defineComponent({__name:"component",props:{path:{},draco:{type:Boolean,default:!1},decoderPath:{default:"https://www.gstatic.com/draco/versioned/decoders/1.4.1/"}},async setup(t,{expose:e}){let n,r;const i=t,s=p.ref();e({value:s});const{scene:a}=([n,r]=p.withAsyncContext(()=>L0(i.path,{draco:i.draco,decoderPath:i.decoderPath})),n=await n,r(),n);return(o,l)=>(p.openBlock(),p.createElementBlock("primitive",p.mergeProps({ref_key:"modelRef",ref:s,object:p.unref(a)},o.$attrs),null,16,yy))}});async function P0(t){return await Ae.useLoader(Rp,t)}const Iy=["object"],xy=p.defineComponent({__name:"component",props:{path:{}},async setup(t,{expose:e}){let n,r;const i=t,s=p.ref();e({value:s});const a=([n,r]=p.withAsyncContext(()=>P0(i.path)),n=await n,r(),n);return(o,l)=>(p.openBlock(),p.createElementBlock("primitive",p.mergeProps({ref_key:"modelRef",ref:s,object:p.unref(a)},o.$attrs),null,16,Iy))}}),Sy=["geometry","render-order"],By=p.defineComponent({__name:"component",props:{src:{},skipStrokes:{type:Boolean,default:!1},skipFills:{type:Boolean,default:!1},fillMaterial:{},strokeMaterial:{},fillMeshProps:{},strokeMeshProps:{},depth:{default:"renderOrder"}},setup(t,{expose:e}){const n=t,{src:r,skipStrokes:i,skipFills:s,fillMaterial:a,strokeMaterial:o,fillMeshProps:l,strokeMeshProps:h,depth:u}=p.toRefs(n),A=p.shallowRef(),f=p.shallowRef([]),d=p.shallowRef([]);e({value:A}),p.watchEffect(async()=>m(r.value).then(x=>d.value=x.paths)),p.watch([s,i,a,o,d],C);async function m(x){const I=x.startsWith("<svg")?encodeURI(`data:image/svg+xml;utf8,${x}`):x;return Ae.useLoader(Fi,I)}p.onUnmounted(y);function y(){f.value.forEach(x=>x.geometry.dispose())}function C(){var w,b,B;y();const x=[],[I,g]=(()=>{const _={flat:!1,renderOrder:!1,offsetZ:!0},E={flat:0,renderOrder:0,offsetZ:.025},T=u.value;return typeof T=="number"?[!0,T]:[_[T],E[T]]})();let v=0;for(const _ of d.value){const E=((w=_.userData)==null?void 0:w.style)??{},T=Object.assign({color:E.fill,opacity:E.fillOpacity,transparent:!0,side:c.DoubleSide,depthWrite:I},n.fillMaterial);if(!s.value&&E.fill!==void 0&&E.fill!=="none")for(const L of Fi.createShapes(_)){const R=new c.ShapeGeometry(L);R.scale(1,-1,1),g&&R.translate(0,0,v++*g),x.push({geometry:R,material:T,isStroke:!1})}if(!i.value&&E.stroke!==void 0&&E.stroke!=="none"){const L=Object.assign({color:(b=_.userData)==null?void 0:b.style.stroke,opacity:(B=_.userData)==null?void 0:B.style.strokeOpacity,transparent:!0,side:c.DoubleSide,depthWrite:I},n.strokeMaterial);for(const R of _.subPaths){const V=R.getPoints().map(q=>new c.Vector2(q.x,-q.y)),Y=Fi.pointsToStroke(V,E||"none");g&&Y.translate(0,0,v++*g),x.push({geometry:Y,material:L,isStroke:!0})}}}f.value=x}return(x,I)=>(p.openBlock(),p.createElementBlock("TresGroup",{ref_key:"svgRef",ref:A},[(p.openBlock(!0),p.createElementBlock(p.Fragment,null,p.renderList(f.value,({geometry:g,material:v,isStroke:w},b)=>(p.openBlock(),p.createElementBlock("TresMesh",p.mergeProps({key:`${b}`},w?p.unref(h):p.unref(l),{geometry:g,"render-order":p.unref(u)==="renderOrder"?b:0}),[p.createElementVNode("TresMeshBasicMaterial",p.normalizeProps(p.guardReactiveProps(v)),null,16)],16,Sy))),128))],512))}}),F0="[TresJS - Cientos ▲ ■ ♥] ";function Sl(){function t(r,i){console.error(`${F0} ${r}`,i||"")}function e(r){console.warn(`${F0} ${r}`)}function n(r,i){}return{logError:t,logWarning:e,logMessage:n}}let Bl=0;function wy(){const t=p.ref(!1),e=p.ref(0),n=p.ref([]),{logError:r}=Sl();return new Promise(i=>{c.DefaultLoadingManager.onStart=()=>{t.value=!1},c.DefaultLoadingManager.onLoad=()=>{t.value=!0},c.DefaultLoadingManager.onProgress=(s,a,o)=>{a===o&&(Bl=o,t.value=!0,n.value.push(s)),e.value=Math.round((a-Bl)/(o-Bl)*100||100,2)},c.DefaultLoadingManager.onError=s=>{r("Error loading assets",new Error(s)),t.value=!0},i({items:n,hasFinishLoading:t,progress:e})})}async function by(t,e){const{logError:n}=Sl();if(!t)return n("Error no path provided");const{unsuspend:r,start:i,crossOrigin:s,muted:a,loop:o,...l}={unsuspend:"loadedmetadata",crossOrigin:"Anonymous",muted:!0,loop:!0,start:!0,playsInline:!0,...e};function h(){return new Promise((u,A)=>{const f=Object.assign(document.createElement("video"),{src:typeof t=="string"&&t||void 0,crossOrigin:s,loop:o,muted:a,autoplay:!0,...l}),d=new c.VideoTexture(f);return f.addEventListener(r,()=>u(d)),f.addEventListener("error",()=>A()),d})}try{const u=await h();return i&&u.image&&u.image.play(),u}catch{n("Error loading resource")}}const _y=["target","auto-rotate","auto-rotate-speed","enable-damping","damping-factor","enable-pan","key-pan-speed","keys","max-azimuth-angle","min-azimuth-angle","max-polar-angle","min-polar-angle","min-distance","max-distance","min-zoom","max-zoom","touches","enable-zoom","zoom-speed","enable-rotate","rotate-speed","args"],Ey=p.defineComponent({__name:"OrbitControls",props:{makeDefault:{type:Boolean,default:!1},camera:{},domElement:{},target:{default:()=>[0,0,0]},enableDamping:{type:Boolean,default:!1},dampingFactor:{default:.05},autoRotate:{type:Boolean,default:!1},autoRotateSpeed:{default:2},enablePan:{type:Boolean,default:!0},keyPanSpeed:{default:7},keys:{},maxAzimuthAngle:{default:1/0},minAzimuthAngle:{default:-1/0},maxPolarAngle:{default:Math.PI},minPolarAngle:{default:0},minDistance:{default:0},maxDistance:{default:1/0},minZoom:{default:0},maxZoom:{default:1/0},touches:{default:()=>({ONE:c.TOUCH.ROTATE,TWO:c.TOUCH.DOLLY_PAN})},enableZoom:{type:Boolean,default:!0},zoomSpeed:{default:1},enableRotate:{type:Boolean,default:!0},rotateSpeed:{default:1}},emits:["change","start","end"],setup(t,{emit:e}){const n=t,{makeDefault:r,autoRotate:i,autoRotateSpeed:s,enableDamping:a,dampingFactor:o,enablePan:l,keyPanSpeed:h,maxAzimuthAngle:u,minAzimuthAngle:A,maxPolarAngle:f,minPolarAngle:d,minDistance:m,maxDistance:y,minZoom:C,maxZoom:x,enableZoom:I,zoomSpeed:g,enableRotate:v,touches:w,rotateSpeed:b,target:B}=p.toRefs(n),{camera:_,renderer:E,extend:T,controls:L}=Ae.useTresContext(),R=p.ref(null);T({OrbitControls:O3}),p.watch(R,q=>{V(),q&&r.value?L.value=q:L.value=null});function V(){Ge(R.value,"change",()=>e("change",R.value)),Ge(R.value,"start",()=>e("start",R.value)),Ge(R.value,"end",()=>e("end",R.value))}const{onLoop:Y}=Ae.useRenderLoop();return Y(()=>{R.value&&(a.value||i.value)&&R.value.update()}),p.onUnmounted(()=>{R.value&&R.value.dispose()}),(q,ne)=>(q.camera||p.unref(_))&&(q.domElement||p.unref(E))?(p.openBlock(),p.createElementBlock("TresOrbitControls",{key:0,ref_key:"controlsRef",ref:R,target:p.unref(B),"auto-rotate":p.unref(i),"auto-rotate-speed":p.unref(s),"enable-damping":p.unref(a),"damping-factor":p.unref(o),"enable-pan":p.unref(l),"key-pan-speed":p.unref(h),keys:q.keys,"max-azimuth-angle":p.unref(u),"min-azimuth-angle":p.unref(A),"max-polar-angle":p.unref(f),"min-polar-angle":p.unref(d),"min-distance":p.unref(m),"max-distance":p.unref(y),"min-zoom":p.unref(C),"max-zoom":p.unref(x),touches:p.unref(w),"enable-zoom":p.unref(I),"zoom-speed":p.unref(g),"enable-rotate":p.unref(v),"rotate-speed":p.unref(b),args:[q.camera||p.unref(_),q.domElement||p.unref(E).domElement]},null,8,_y)):p.createCommentVNode("",!0)}}),Ty=5,My=6,Dy=.3,Ly=p.defineComponent({__name:"KeyboardControls",props:{forward:{default:()=>["w","W"]},back:{default:()=>["s","S"]},left:{default:()=>["a","A"]},right:{default:()=>["d","D"]},jump:{default:()=>[" "]},gravity:{default:9.8},moveSpeed:{default:.1},headBobbing:{type:Boolean,default:!1},is2D:{type:Boolean,default:!1}},setup(t){var T;const e=t,{forward:n,back:r,left:i,right:s,jump:a,gravity:o,moveSpeed:l,headBobbing:h,is2D:u}=p.toRefs(e),{camera:A,controls:f}=Ae.useTresContext(),d=p.ref(0),m=p.ref(0),y=p.ref(!1),C=p.ref(!1),x=p.ref(0),I=p.shallowRef(),g=u.value?"y":"z",v=((T=A.value.position)==null?void 0:T.y)||0;mr(n.value,()=>{y.value=!0,m.value=l.value},{eventName:"keydown"}),mr(r.value,()=>{y.value=!0,m.value=-l.value},{eventName:"keydown"}),mr([...n.value,...r.value],()=>{y.value=!1,m.value=0},{eventName:"keyup"}),mr(i.value,()=>{y.value=!0,d.value=-l.value},{eventName:"keydown"}),mr(s.value,()=>{y.value=!0,d.value=l.value},{eventName:"keydown"}),mr([...i.value,...s.value],()=>{y.value=!1,d.value=0},{eventName:"keyup"}),mr(a.value,()=>{C.value||(x.value=Date.now()),C.value=!0});const w=L=>y.value?Math.sin(L*Ty)*Dy+v:v,b=()=>(Date.now()-x.value)/1e3*3,B=L=>v+My*L-.5*o.value*L**2,_=()=>{if(C.value){const L=B(b());return L<=v&&(C.value=!1),L}return 0},{onLoop:E}=Ae.useRenderLoop();return E(({elapsed:L})=>{var R;f.value instanceof fo&&((R=f.value)!=null&&R.isLocked)?(f.value.moveForward(m.value),f.value.moveRight(d.value),A.value.position&&(A.value.position.y=h.value?w(L):v,A.value.position.y+=_())):I.value.children.length>0&&!(f.value instanceof fo)&&(I.value.position.x+=d.value,I.value.position[g]+=u.value?m.value:-m.value)}),(L,R)=>(p.openBlock(),p.createElementBlock("TresGroup",{ref_key:"wrapperRef",ref:I},[p.renderSlot(L.$slots,"default")],512))}}),Py=["object","args","mode","enabled","axis","translation-snap","rotation-snap","scale-snap","space","size","show-x","show-y","show-z"],Fy=p.defineComponent({__name:"TransformControls",props:{object:{},mode:{default:"translate"},enabled:{type:Boolean,default:!0},axis:{default:"XYZ"},translationSnap:{},rotationSnap:{},scaleSnap:{},space:{default:"world"},size:{default:1},showX:{type:Boolean,default:!0},showY:{type:Boolean,default:!0},showZ:{type:Boolean,default:!0}},emits:["dragging","change","mouseDown","mouseUp","objectChange"],setup(t,{emit:e}){const n=t,{object:r,mode:i,enabled:s,axis:a,translationSnap:o,rotationSnap:l,scaleSnap:h,space:u,size:A,showX:f,showY:d,showZ:m}=p.toRefs(n),y=p.shallowRef(),{controls:C,camera:x,renderer:I,extend:g}=Ae.useTresContext();g({TransformControls:Q5});const v=b=>{C.value&&(C.value.enabled=!b.value),e("dragging",b.value)};function w(){Ge(y.value,"change",()=>e("change")),Ge(y.value,"dragging-changed",v),Ge(y.value,"mouseDown",()=>e("mouseDown")),Ge(y.value,"mouseUp",()=>e("mouseUp")),Ge(y.value,"objectChange",()=>e("objectChange"))}return p.watchEffect(()=>{y.value&&w()}),p.onUnmounted(()=>{y.value&&y.value.dispose()}),(b,B)=>p.unref(x)&&p.unref(I)?(p.openBlock(),p.createElementBlock("TresTransformControls",{key:0,ref_key:"controlsRef",ref:y,object:p.unref(r),args:[p.unref(x),p.unref(I).domElement],mode:p.unref(i),enabled:p.unref(s),axis:p.unref(a),"translation-snap":p.unref(o),"rotation-snap":p.unref(l),"scale-snap":p.unref(h),space:p.unref(u),size:p.unref(A),"show-x":p.unref(f),"show-y":p.unref(d),"show-z":p.unref(m),visible:!0},null,8,Py)):p.createCommentVNode("",!0)}}),ky=["args"],Oy=p.defineComponent({__name:"PointerLockControls",props:{makeDefault:{type:Boolean,default:!1},camera:{},domElement:{},selector:{}},emits:["isLock"],setup(t,{expose:e,emit:n}){const r=t,{camera:i,renderer:s,extend:a,controls:o}=Ae.useTresContext(),l=p.ref(null);let h;a({PointerLockControls:fo});const u=A=>{n("isLock",A)};return p.watch(l,A=>{A&&r.makeDefault?o.value=A:o.value=null;const f=document.getElementById(r.selector||"");h=f||s.value.domElement,Ge(h,"click",()=>{var d,m,y;(d=o.value)==null||d.lock(),(m=o.value)==null||m.addEventListener("lock",()=>u(!0)),(y=o.value)==null||y.addEventListener("unlock",()=>u(!1))})}),p.onUnmounted(()=>{var A,f;(A=o.value)==null||A.removeEventListener("lock",()=>u(!0)),(f=o.value)==null||f.removeEventListener("unlock",()=>u(!1)),l.value&&l.value.dispose()}),e({value:o}),(A,f)=>(A.camera||p.unref(i))&&(A.domElement||p.unref(s))?(p.openBlock(),p.createElementBlock("TresPointerLockControls",{key:0,ref_key:"controlsRef",ref:l,args:[A.camera||p.unref(i),A.domElement||p.unref(s).domElement]},null,8,ky)):p.createCommentVNode("",!0)}}),Ry=["args"],Uy=p.defineComponent({__name:"MapControls",props:{makeDefault:{type:Boolean,default:!1},camera:{},domElement:{}},setup(t){const e=t,{camera:n,renderer:r,extend:i,controls:s}=Ae.useTresContext(),a=p.ref(null);return i({MapControls:j5}),p.watch(s,o=>{o&&e.makeDefault?s.value=o:s.value=null}),p.onUnmounted(()=>{a.value&&a.value.dispose()}),(o,l)=>(o.camera||p.unref(n))&&(o.domElement||p.unref(r))?(p.openBlock(),p.createElementBlock("TresMapControls",{key:0,ref_key:"controlsRef",ref:a,args:[o.camera||p.unref(n),o.domElement||p.unref(r).domElement]},null,8,Ry)):p.createCommentVNode("",!0)}}),Qy=p.defineComponent({__name:"ScrollControls",props:{pages:{default:4},distance:{default:4},smoothScroll:{default:.1},horizontal:{type:Boolean,default:!1},htmlScroll:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,{logWarning:r}=Ae.useLogger();n.smoothScroll<0&&r("SmoothControl must be greater than zero"),n.pages<0&&r("Pages must be greater than zero");const{camera:i,controls:s,renderer:a}=Ae.useTresContext(),o=p.shallowRef(),l=document.createElement("div"),{y:h}=Zv(),{x:u,y:A,isScrolling:f}=qv(l),{height:d,width:m}=y0();let y=0;const C=p.ref(!1),x=p.ref(0),I=p.ref(0),g=p.ref(0),v=n.horizontal?"x":"y",w=p.watch(i,B=>{if(C.value){w();return}y=n.horizontal?(B==null?void 0:B.position.x)||0:(B==null?void 0:B.position.y)||0,C.value=!0},{immediate:!0});p.watch(f,B=>{s.value&&(s.value.enabled=!B)},{immediate:!0}),p.watch(h,B=>{!f.value&&!n.htmlScroll||(I.value=B/d.value/(g.value/d.value-1),x.value=-1*I.value,e("update:modelValue",I.value))}),p.watch(A,B=>{I.value=B/d.value/(g.value/d.value),x.value=-1*I.value,e("update:modelValue",I.value)}),p.watch(u,B=>{I.value=B/m.value/(g.value/m.value-1),x.value=+I.value,e("update:modelValue",I.value)}),p.watch(a,B=>{var E,T;const _=B==null?void 0:B.domElement;if(n.htmlScroll&&(B!=null&&B.domElement))_!=null&&_.style.width&&(_!=null&&_.style.position)&&(_!=null&&_.style.top)&&(_!=null&&_.style.left)&&(_.style.width="100%",_.style.position="fixed",_.style.zIndex=" -99999",_.style.top="0",_.style.left="0"),g.value=document.body.scrollHeight;else{const L=document.createElement("div"),R=document.createElement("div");l.style[n.horizontal?"overflowX":"overflowY"]="auto",l.style[n.horizontal?"overflowY":"overflowX"]="hidden",l.style.position="absolute",l.style.width="100%",l.style.height=" 100%",l.style.top="0",l.style.left="0",l.classList.add("scrollContainer"),L.style.position="sticky",L.style.top="0px",L.style.left="0px",L.style.width="100%",L.style.height="100%",L.style.overflow="hidden",l.appendChild(L),R.style.height=n.horizontal?"100%":`${d.value*n.pages}px`,R.style.width=n.horizontal?`${m.value*n.pages}px`:"100vw",R.style.pointerEvents="none",_.style.position="fixed",_.style.zIndex="0",_!=null&&_.style.width&&(_.style.width="100%"),l.appendChild(R),B.domElement.parentNode.style.position="relative",(T=(E=B==null?void 0:B.domElement)==null?void 0:E.parentNode)==null||T.appendChild(l),g.value=n.horizontal?m.value*n.pages:d.value*n.pages}},{immediate:!0});const{onLoop:b}=Ae.useRenderLoop();return b(()=>{var B;if((B=i.value)!=null&&B.position){const _=(x.value*n.distance-i.value.position[v]+y)*n.smoothScroll;i.value.position[v]+=_,o.value.children.length>0&&(o.value.position[v]+=_)}}),(B,_)=>(p.openBlock(),p.createElementBlock("TresGroup",{ref_key:"wrapperRef",ref:o},[p.renderSlot(B.$slots,"default")],512))}});/*!
|
|
1144
|
+
* camera-controls
|
|
1145
|
+
* https://github.com/yomotsu/camera-controls
|
|
1146
|
+
* (c) 2017 @yomotsu
|
|
1147
|
+
* Released under the MIT License.
|
|
1148
|
+
*/const Ce={LEFT:1,RIGHT:2,MIDDLE:4},j=Object.freeze({NONE:0,ROTATE:1,TRUCK:2,OFFSET:4,DOLLY:8,ZOOM:16,TOUCH_ROTATE:32,TOUCH_TRUCK:64,TOUCH_OFFSET:128,TOUCH_DOLLY:256,TOUCH_ZOOM:512,TOUCH_DOLLY_TRUCK:1024,TOUCH_DOLLY_OFFSET:2048,TOUCH_DOLLY_ROTATE:4096,TOUCH_ZOOM_TRUCK:8192,TOUCH_ZOOM_OFFSET:16384,TOUCH_ZOOM_ROTATE:32768}),zr={NONE:0,IN:1,OUT:-1};function vr(t){return t.isPerspectiveCamera}function Xn(t){return t.isOrthographicCamera}const Wr=Math.PI*2,k0=Math.PI/2,O0=1e-5,Oi=Math.PI/180;function jt(t,e,n){return Math.max(e,Math.min(n,t))}function ke(t,e=O0){return Math.abs(t)<e}function Me(t,e,n=O0){return ke(t-e,n)}function R0(t,e){return Math.round(t/e)*e}function Ri(t){return isFinite(t)?t:t<0?-Number.MAX_VALUE:Number.MAX_VALUE}function Ui(t){return Math.abs(t)<Number.MAX_VALUE?t:t*(1/0)}function Aa(t,e,n,r,i=1/0,s){r=Math.max(1e-4,r);const a=2/r,o=a*s,l=1/(1+o+.48*o*o+.235*o*o*o);let h=t-e;const u=e,A=i*r;h=jt(h,-A,A),e=t-h;const f=(n.value+a*h)*s;n.value=(n.value-a*f)*l;let d=e+(h+f)*l;return u-t>0==d>u&&(d=u,n.value=(d-u)/s),d}function U0(t,e,n,r,i=1/0,s,a){r=Math.max(1e-4,r);const o=2/r,l=o*s,h=1/(1+l+.48*l*l+.235*l*l*l);let u=e.x,A=e.y,f=e.z,d=t.x-u,m=t.y-A,y=t.z-f;const C=u,x=A,I=f,g=i*r,v=g*g,w=d*d+m*m+y*y;if(w>v){const q=Math.sqrt(w);d=d/q*g,m=m/q*g,y=y/q*g}u=t.x-d,A=t.y-m,f=t.z-y;const b=(n.x+o*d)*s,B=(n.y+o*m)*s,_=(n.z+o*y)*s;n.x=(n.x-o*b)*h,n.y=(n.y-o*B)*h,n.z=(n.z-o*_)*h,a.x=u+(d+b)*h,a.y=A+(m+B)*h,a.z=f+(y+_)*h;const E=C-t.x,T=x-t.y,L=I-t.z,R=a.x-C,V=a.y-x,Y=a.z-I;return E*R+T*V+L*Y>0&&(a.x=C,a.y=x,a.z=I,n.x=(a.x-C)/s,n.y=(a.y-x)/s,n.z=(a.z-I)/s),a}function wl(t,e){e.set(0,0),t.forEach(n=>{e.x+=n.clientX,e.y+=n.clientY}),e.x/=t.length,e.y/=t.length}function bl(t,e){return Xn(t)?(console.warn(`${e} is not supported in OrthographicCamera`),!0):!1}class Ny{constructor(){this._listeners={}}addEventListener(e,n){const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(n)===-1&&r[e].push(n)}hasEventListener(e,n){const r=this._listeners;return r[e]!==void 0&&r[e].indexOf(n)!==-1}removeEventListener(e,n){const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(n);s!==-1&&i.splice(s,1)}}removeAllEventListeners(e){if(!e){this._listeners={};return}Array.isArray(this._listeners[e])&&(this._listeners[e].length=0)}dispatchEvent(e){const r=this._listeners[e.type];if(r!==void 0){e.target=this;const i=r.slice(0);for(let s=0,a=i.length;s<a;s++)i[s].call(this,e)}}}const Gy="2.7.2",fa=1/8,Q0=typeof window<"u",Vy=Q0&&/Mac/.test(navigator.platform),zy=!(Q0&&"PointerEvent"in window);let me,N0,da,_l,gt,Be,Te,Yr,Qi,ln,cn,yr,G0,V0,Pt,Ni,jr,z0,El,W0,Tl,Ml,pa;class Gi extends Ny{static install(e){me=e.THREE,N0=Object.freeze(new me.Vector3(0,0,0)),da=Object.freeze(new me.Vector3(0,1,0)),_l=Object.freeze(new me.Vector3(0,0,1)),gt=new me.Vector2,Be=new me.Vector3,Te=new me.Vector3,Yr=new me.Vector3,Qi=new me.Vector3,ln=new me.Vector3,cn=new me.Vector3,yr=new me.Vector3,G0=new me.Vector3,V0=new me.Vector3,Pt=new me.Spherical,Ni=new me.Spherical,jr=new me.Box3,z0=new me.Box3,El=new me.Sphere,W0=new me.Quaternion,Tl=new me.Quaternion,Ml=new me.Matrix4,pa=new me.Raycaster}static get ACTION(){return j}constructor(e,n){super(),this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.minDistance=Number.EPSILON,this.maxDistance=1/0,this.infinityDolly=!1,this.minZoom=.01,this.maxZoom=1/0,this.smoothTime=.25,this.draggingSmoothTime=.125,this.maxSpeed=1/0,this.azimuthRotateSpeed=1,this.polarRotateSpeed=1,this.dollySpeed=1,this.dollyDragInverted=!1,this.truckSpeed=2,this.dollyToCursor=!1,this.dragToOffset=!1,this.verticalDragToForward=!1,this.boundaryFriction=0,this.restThreshold=.01,this.colliderMeshes=[],this.cancel=()=>{},this._enabled=!0,this._state=j.NONE,this._viewport=null,this._changedDolly=0,this._changedZoom=0,this._hasRested=!0,this._boundaryEnclosesCamera=!1,this._needsUpdate=!0,this._updatedLastTime=!1,this._elementRect=new DOMRect,this._isDragging=!1,this._activePointers=[],this._lockedPointer=null,this._interactiveArea=new DOMRect(0,0,1,1),this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._isUserControllingOffset=!1,this._isUserControllingZoom=!1,this._lastDollyDirection=zr.NONE,this._thetaVelocity={value:0},this._phiVelocity={value:0},this._radiusVelocity={value:0},this._targetVelocity=new me.Vector3,this._focalOffsetVelocity=new me.Vector3,this._zoomVelocity={value:0},this._truckInternal=(v,w,b)=>{let B,_;if(vr(this._camera)){const E=Be.copy(this._camera.position).sub(this._target),T=this._camera.getEffectiveFOV()*Oi,L=E.length()*Math.tan(T*.5);B=this.truckSpeed*v*L/this._elementRect.height,_=this.truckSpeed*w*L/this._elementRect.height}else if(Xn(this._camera)){const E=this._camera;B=v*(E.right-E.left)/E.zoom/this._elementRect.width,_=w*(E.top-E.bottom)/E.zoom/this._elementRect.height}else return;this.verticalDragToForward?(b?this.setFocalOffset(this._focalOffsetEnd.x+B,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(B,0,!0),this.forward(-_,!0)):b?this.setFocalOffset(this._focalOffsetEnd.x+B,this._focalOffsetEnd.y+_,this._focalOffsetEnd.z,!0):this.truck(B,_,!0)},this._rotateInternal=(v,w)=>{const b=Wr*this.azimuthRotateSpeed*v/this._elementRect.height,B=Wr*this.polarRotateSpeed*w/this._elementRect.height;this.rotate(b,B,!0)},this._dollyInternal=(v,w,b)=>{const B=Math.pow(.95,-v*this.dollySpeed),_=this._sphericalEnd.radius,E=this._sphericalEnd.radius*B,T=jt(E,this.minDistance,this.maxDistance),L=T-E;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(E,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(L,!0),this._dollyToNoClamp(T,!0)):this._dollyToNoClamp(T,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?E:T)-_,this._dollyControlCoord.set(w,b)),this._lastDollyDirection=Math.sign(-v)},this._zoomInternal=(v,w,b)=>{const B=Math.pow(.95,v*this.dollySpeed),_=this._zoom,E=this._zoom*B;this.zoomTo(E,!0),this.dollyToCursor&&(this._changedZoom+=E-_,this._dollyControlCoord.set(w,b))},typeof me>"u"&&console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."),this._camera=e,this._yAxisUpSpace=new me.Quaternion().setFromUnitVectors(this._camera.up,da),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=j.NONE,this._target=new me.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new me.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=new me.Spherical().setFromVector3(Be.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)),this._sphericalEnd=this._spherical.clone(),this._lastDistance=this._spherical.radius,this._zoom=this._camera.zoom,this._zoomEnd=this._zoom,this._lastZoom=this._zoom,this._nearPlaneCorners=[new me.Vector3,new me.Vector3,new me.Vector3,new me.Vector3],this._updateNearPlaneCorners(),this._boundary=new me.Box3(new me.Vector3(-1/0,-1/0,-1/0),new me.Vector3(1/0,1/0,1/0)),this._cameraUp0=this._camera.up.clone(),this._target0=this._target.clone(),this._position0=this._camera.position.clone(),this._zoom0=this._zoom,this._focalOffset0=this._focalOffset.clone(),this._dollyControlCoord=new me.Vector2,this.mouseButtons={left:j.ROTATE,middle:j.DOLLY,right:j.TRUCK,wheel:vr(this._camera)?j.DOLLY:Xn(this._camera)?j.ZOOM:j.NONE},this.touches={one:j.TOUCH_ROTATE,two:vr(this._camera)?j.TOUCH_DOLLY_TRUCK:Xn(this._camera)?j.TOUCH_ZOOM_TRUCK:j.NONE,three:j.TOUCH_TRUCK};const r=new me.Vector2,i=new me.Vector2,s=new me.Vector2,a=v=>{if(!this._enabled||!this._domElement)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const B=this._domElement.getBoundingClientRect(),_=v.clientX/B.width,E=v.clientY/B.height;if(_<this._interactiveArea.left||_>this._interactiveArea.right||E<this._interactiveArea.top||E>this._interactiveArea.bottom)return}const w=v.pointerType!=="mouse"?null:(v.buttons&Ce.LEFT)===Ce.LEFT?Ce.LEFT:(v.buttons&Ce.MIDDLE)===Ce.MIDDLE?Ce.MIDDLE:(v.buttons&Ce.RIGHT)===Ce.RIGHT?Ce.RIGHT:null;if(w!==null){const B=this._findPointerByMouseButton(w);B&&this._disposePointer(B)}if((v.buttons&Ce.LEFT)===Ce.LEFT&&this._lockedPointer)return;const b={pointerId:v.pointerId,clientX:v.clientX,clientY:v.clientY,deltaX:0,deltaY:0,mouseButton:w};this._activePointers.push(b),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",u),this._domElement.ownerDocument.addEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",u),this._isDragging=!0,y(v)},o=v=>{if(!this._enabled||!this._domElement||this._lockedPointer)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const B=this._domElement.getBoundingClientRect(),_=v.clientX/B.width,E=v.clientY/B.height;if(_<this._interactiveArea.left||_>this._interactiveArea.right||E<this._interactiveArea.top||E>this._interactiveArea.bottom)return}const w=(v.buttons&Ce.LEFT)===Ce.LEFT?Ce.LEFT:(v.buttons&Ce.MIDDLE)===Ce.MIDDLE?Ce.MIDDLE:(v.buttons&Ce.RIGHT)===Ce.RIGHT?Ce.RIGHT:null;if(w!==null){const B=this._findPointerByMouseButton(w);B&&this._disposePointer(B)}const b={pointerId:1,clientX:v.clientX,clientY:v.clientY,deltaX:0,deltaY:0,mouseButton:(v.buttons&Ce.LEFT)===Ce.LEFT?Ce.LEFT:(v.buttons&Ce.MIDDLE)===Ce.LEFT?Ce.MIDDLE:(v.buttons&Ce.RIGHT)===Ce.LEFT?Ce.RIGHT:null};this._activePointers.push(b),this._domElement.ownerDocument.removeEventListener("mousemove",h),this._domElement.ownerDocument.removeEventListener("mouseup",A),this._domElement.ownerDocument.addEventListener("mousemove",h),this._domElement.ownerDocument.addEventListener("mouseup",A),this._isDragging=!0,y(v)},l=v=>{v.cancelable&&v.preventDefault();const w=v.pointerId,b=this._lockedPointer||this._findPointerById(w);if(b){if(b.clientX=v.clientX,b.clientY=v.clientY,b.deltaX=v.movementX,b.deltaY=v.movementY,this._state=0,v.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else(!this._isDragging&&this._lockedPointer||this._isDragging&&(v.buttons&Ce.LEFT)===Ce.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(v.buttons&Ce.MIDDLE)===Ce.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(v.buttons&Ce.RIGHT)===Ce.RIGHT&&(this._state=this._state|this.mouseButtons.right);C()}},h=v=>{const w=this._lockedPointer||this._findPointerById(1);w&&(w.clientX=v.clientX,w.clientY=v.clientY,w.deltaX=v.movementX,w.deltaY=v.movementY,this._state=0,(this._lockedPointer||(v.buttons&Ce.LEFT)===Ce.LEFT)&&(this._state=this._state|this.mouseButtons.left),(v.buttons&Ce.MIDDLE)===Ce.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(v.buttons&Ce.RIGHT)===Ce.RIGHT&&(this._state=this._state|this.mouseButtons.right),C())},u=v=>{const w=this._findPointerById(v.pointerId);if(!(w&&w===this._lockedPointer)){if(w&&this._disposePointer(w),v.pointerType==="touch")switch(this._activePointers.length){case 0:this._state=j.NONE;break;case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else this._state=j.NONE;x()}},A=()=>{const v=this._findPointerById(1);v&&v===this._lockedPointer||(v&&this._disposePointer(v),this._state=j.NONE,x())};let f=-1;const d=v=>{if(!this._domElement||!this._enabled||this.mouseButtons.wheel===j.NONE)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const E=this._domElement.getBoundingClientRect(),T=v.clientX/E.width,L=v.clientY/E.height;if(T<this._interactiveArea.left||T>this._interactiveArea.right||L<this._interactiveArea.top||L>this._interactiveArea.bottom)return}if(v.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===j.ROTATE||this.mouseButtons.wheel===j.TRUCK){const E=performance.now();f-E<1e3&&this._getClientRect(this._elementRect),f=E}const w=Vy?-1:-3,b=v.deltaMode===1?v.deltaY/w:v.deltaY/(w*10),B=this.dollyToCursor?(v.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,_=this.dollyToCursor?(v.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(this.mouseButtons.wheel){case j.ROTATE:{this._rotateInternal(v.deltaX,v.deltaY),this._isUserControllingRotate=!0;break}case j.TRUCK:{this._truckInternal(v.deltaX,v.deltaY,!1),this._isUserControllingTruck=!0;break}case j.OFFSET:{this._truckInternal(v.deltaX,v.deltaY,!0),this._isUserControllingOffset=!0;break}case j.DOLLY:{this._dollyInternal(-b,B,_),this._isUserControllingDolly=!0;break}case j.ZOOM:{this._zoomInternal(-b,B,_),this._isUserControllingZoom=!0;break}}this.dispatchEvent({type:"control"})},m=v=>{if(!(!this._domElement||!this._enabled)){if(this.mouseButtons.right===Gi.ACTION.NONE){const w=v instanceof PointerEvent?v.pointerId:(v instanceof MouseEvent,0),b=this._findPointerById(w);b&&this._disposePointer(b),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",u),this._domElement.ownerDocument.removeEventListener("mousemove",h),this._domElement.ownerDocument.removeEventListener("mouseup",A);return}v.preventDefault()}},y=v=>{if(!this._enabled)return;if(wl(this._activePointers,gt),this._getClientRect(this._elementRect),r.copy(gt),i.copy(gt),this._activePointers.length>=2){const b=gt.x-this._activePointers[1].clientX,B=gt.y-this._activePointers[1].clientY,_=Math.sqrt(b*b+B*B);s.set(0,_);const E=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,T=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;i.set(E,T)}if(this._state=0,!v)this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);else if("pointerType"in v&&v.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else!this._lockedPointer&&(v.buttons&Ce.LEFT)===Ce.LEFT&&(this._state=this._state|this.mouseButtons.left),(v.buttons&Ce.MIDDLE)===Ce.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(v.buttons&Ce.RIGHT)===Ce.RIGHT&&(this._state=this._state|this.mouseButtons.right);((this._state&j.ROTATE)===j.ROTATE||(this._state&j.TOUCH_ROTATE)===j.TOUCH_ROTATE||(this._state&j.TOUCH_DOLLY_ROTATE)===j.TOUCH_DOLLY_ROTATE||(this._state&j.TOUCH_ZOOM_ROTATE)===j.TOUCH_ZOOM_ROTATE)&&(this._sphericalEnd.theta=this._spherical.theta,this._sphericalEnd.phi=this._spherical.phi,this._thetaVelocity.value=0,this._phiVelocity.value=0),((this._state&j.TRUCK)===j.TRUCK||(this._state&j.TOUCH_TRUCK)===j.TOUCH_TRUCK||(this._state&j.TOUCH_DOLLY_TRUCK)===j.TOUCH_DOLLY_TRUCK||(this._state&j.TOUCH_ZOOM_TRUCK)===j.TOUCH_ZOOM_TRUCK)&&(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),((this._state&j.DOLLY)===j.DOLLY||(this._state&j.TOUCH_DOLLY)===j.TOUCH_DOLLY||(this._state&j.TOUCH_DOLLY_TRUCK)===j.TOUCH_DOLLY_TRUCK||(this._state&j.TOUCH_DOLLY_OFFSET)===j.TOUCH_DOLLY_OFFSET||(this._state&j.TOUCH_DOLLY_ROTATE)===j.TOUCH_DOLLY_ROTATE)&&(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),((this._state&j.ZOOM)===j.ZOOM||(this._state&j.TOUCH_ZOOM)===j.TOUCH_ZOOM||(this._state&j.TOUCH_ZOOM_TRUCK)===j.TOUCH_ZOOM_TRUCK||(this._state&j.TOUCH_ZOOM_OFFSET)===j.TOUCH_ZOOM_OFFSET||(this._state&j.TOUCH_ZOOM_ROTATE)===j.TOUCH_ZOOM_ROTATE)&&(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),((this._state&j.OFFSET)===j.OFFSET||(this._state&j.TOUCH_OFFSET)===j.TOUCH_OFFSET||(this._state&j.TOUCH_DOLLY_OFFSET)===j.TOUCH_DOLLY_OFFSET||(this._state&j.TOUCH_ZOOM_OFFSET)===j.TOUCH_ZOOM_OFFSET)&&(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})},C=()=>{if(!this._enabled)return;wl(this._activePointers,gt);const w=this._domElement&&document.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,b=w?-w.deltaX:i.x-gt.x,B=w?-w.deltaY:i.y-gt.y;if(i.copy(gt),((this._state&j.ROTATE)===j.ROTATE||(this._state&j.TOUCH_ROTATE)===j.TOUCH_ROTATE||(this._state&j.TOUCH_DOLLY_ROTATE)===j.TOUCH_DOLLY_ROTATE||(this._state&j.TOUCH_ZOOM_ROTATE)===j.TOUCH_ZOOM_ROTATE)&&(this._rotateInternal(b,B),this._isUserControllingRotate=!0),(this._state&j.DOLLY)===j.DOLLY||(this._state&j.ZOOM)===j.ZOOM){const _=this.dollyToCursor?(r.x-this._elementRect.x)/this._elementRect.width*2-1:0,E=this.dollyToCursor?(r.y-this._elementRect.y)/this._elementRect.height*-2+1:0,T=this.dollyDragInverted?-1:1;(this._state&j.DOLLY)===j.DOLLY?(this._dollyInternal(T*B*fa,_,E),this._isUserControllingDolly=!0):(this._zoomInternal(T*B*fa,_,E),this._isUserControllingZoom=!0)}if((this._state&j.TOUCH_DOLLY)===j.TOUCH_DOLLY||(this._state&j.TOUCH_ZOOM)===j.TOUCH_ZOOM||(this._state&j.TOUCH_DOLLY_TRUCK)===j.TOUCH_DOLLY_TRUCK||(this._state&j.TOUCH_ZOOM_TRUCK)===j.TOUCH_ZOOM_TRUCK||(this._state&j.TOUCH_DOLLY_OFFSET)===j.TOUCH_DOLLY_OFFSET||(this._state&j.TOUCH_ZOOM_OFFSET)===j.TOUCH_ZOOM_OFFSET||(this._state&j.TOUCH_DOLLY_ROTATE)===j.TOUCH_DOLLY_ROTATE||(this._state&j.TOUCH_ZOOM_ROTATE)===j.TOUCH_ZOOM_ROTATE){const _=gt.x-this._activePointers[1].clientX,E=gt.y-this._activePointers[1].clientY,T=Math.sqrt(_*_+E*E),L=s.y-T;s.set(0,T);const R=this.dollyToCursor?(i.x-this._elementRect.x)/this._elementRect.width*2-1:0,V=this.dollyToCursor?(i.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&j.TOUCH_DOLLY)===j.TOUCH_DOLLY||(this._state&j.TOUCH_DOLLY_ROTATE)===j.TOUCH_DOLLY_ROTATE||(this._state&j.TOUCH_DOLLY_TRUCK)===j.TOUCH_DOLLY_TRUCK||(this._state&j.TOUCH_DOLLY_OFFSET)===j.TOUCH_DOLLY_OFFSET?(this._dollyInternal(L*fa,R,V),this._isUserControllingDolly=!0):(this._zoomInternal(L*fa,R,V),this._isUserControllingZoom=!0)}((this._state&j.TRUCK)===j.TRUCK||(this._state&j.TOUCH_TRUCK)===j.TOUCH_TRUCK||(this._state&j.TOUCH_DOLLY_TRUCK)===j.TOUCH_DOLLY_TRUCK||(this._state&j.TOUCH_ZOOM_TRUCK)===j.TOUCH_ZOOM_TRUCK)&&(this._truckInternal(b,B,!1),this._isUserControllingTruck=!0),((this._state&j.OFFSET)===j.OFFSET||(this._state&j.TOUCH_OFFSET)===j.TOUCH_OFFSET||(this._state&j.TOUCH_DOLLY_OFFSET)===j.TOUCH_DOLLY_OFFSET||(this._state&j.TOUCH_ZOOM_OFFSET)===j.TOUCH_ZOOM_OFFSET)&&(this._truckInternal(b,B,!0),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},x=()=>{wl(this._activePointers,gt),i.copy(gt),(this._activePointers.length===0||this._activePointers.length===1&&this._activePointers[0]===this._lockedPointer)&&(this._isDragging=!1),this._activePointers.length===0&&this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",h),this._domElement.ownerDocument.removeEventListener("pointerup",u),this._domElement.ownerDocument.removeEventListener("mouseup",A),this.dispatchEvent({type:"controlend"}))};this.lockPointer=()=>{!this._enabled||!this._domElement||(this.cancel(),this._lockedPointer={pointerId:-1,clientX:0,clientY:0,deltaX:0,deltaY:0,mouseButton:null},this._activePointers.push(this._lockedPointer),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",u),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",I),this._domElement.ownerDocument.addEventListener("pointerlockerror",g),this._domElement.ownerDocument.addEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",u),y())},this.unlockPointer=()=>{this._lockedPointer!==null&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),document.exitPointerLock(),this.cancel(),this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointerlockchange",I),this._domElement.ownerDocument.removeEventListener("pointerlockerror",g))};const I=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},g=()=>{this.unlockPointer()};this._addAllEventListeners=v=>{this._domElement=v,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",a),zy&&this._domElement.addEventListener("mousedown",o),this._domElement.addEventListener("pointercancel",u),this._domElement.addEventListener("wheel",d,{passive:!1}),this._domElement.addEventListener("contextmenu",m)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",a),this._domElement.removeEventListener("mousedown",o),this._domElement.removeEventListener("pointercancel",u),this._domElement.removeEventListener("wheel",d,{passive:!1}),this._domElement.removeEventListener("contextmenu",m),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",h),this._domElement.ownerDocument.removeEventListener("pointerup",u),this._domElement.ownerDocument.removeEventListener("mouseup",A),this._domElement.ownerDocument.removeEventListener("pointerlockchange",I),this._domElement.ownerDocument.removeEventListener("pointerlockerror",g))},this.cancel=()=>{this._state!==j.NONE&&(this._state=j.NONE,this._activePointers.length=0,x())},n&&this.connect(n),this.update(0)}get camera(){return this._camera}set camera(e){this._camera=e,this.updateCameraUp(),this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this._domElement&&(e?(this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none"):(this.cancel(),this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect=""))}get active(){return!this._hasRested}get currentAction(){return this._state}get distance(){return this._spherical.radius}set distance(e){this._spherical.radius===e&&this._sphericalEnd.radius===e||(this._spherical.radius=e,this._sphericalEnd.radius=e,this._needsUpdate=!0)}get azimuthAngle(){return this._spherical.theta}set azimuthAngle(e){this._spherical.theta===e&&this._sphericalEnd.theta===e||(this._spherical.theta=e,this._sphericalEnd.theta=e,this._needsUpdate=!0)}get polarAngle(){return this._spherical.phi}set polarAngle(e){this._spherical.phi===e&&this._sphericalEnd.phi===e||(this._spherical.phi=e,this._sphericalEnd.phi=e,this._needsUpdate=!0)}get boundaryEnclosesCamera(){return this._boundaryEnclosesCamera}set boundaryEnclosesCamera(e){this._boundaryEnclosesCamera=e,this._needsUpdate=!0}set interactiveArea(e){this._interactiveArea.width=jt(e.width,0,1),this._interactiveArea.height=jt(e.height,0,1),this._interactiveArea.x=jt(e.x,0,1-this._interactiveArea.width),this._interactiveArea.y=jt(e.x,0,1-this._interactiveArea.height)}addEventListener(e,n){super.addEventListener(e,n)}removeEventListener(e,n){super.removeEventListener(e,n)}rotate(e,n,r=!1){return this.rotateTo(this._sphericalEnd.theta+e,this._sphericalEnd.phi+n,r)}rotateAzimuthTo(e,n=!1){return this.rotateTo(e,this._sphericalEnd.phi,n)}rotatePolarTo(e,n=!1){return this.rotateTo(this._sphericalEnd.theta,e,n)}rotateTo(e,n,r=!1){this._isUserControllingRotate=!1;const i=jt(e,this.minAzimuthAngle,this.maxAzimuthAngle),s=jt(n,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=i,this._sphericalEnd.phi=s,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,r||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const a=!r||Me(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&Me(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(a)}dolly(e,n=!1){return this.dollyTo(this._sphericalEnd.radius-e,n)}dollyTo(e,n=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=zr.NONE,this._changedDolly=0,this._dollyToNoClamp(jt(e,this.minDistance,this.maxDistance),n)}_dollyToNoClamp(e,n=!1){const r=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const a=this._collisionTest(),o=Me(a,this._spherical.radius);if(!(r>e)&&o)return Promise.resolve();this._sphericalEnd.radius=Math.min(e,a)}else this._sphericalEnd.radius=e;this._needsUpdate=!0,n||(this._spherical.radius=this._sphericalEnd.radius);const s=!n||Me(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(s)}dollyInFixed(e,n=!1){this._targetEnd.add(this._getCameraDirection(Qi).multiplyScalar(e)),n||this._target.copy(this._targetEnd);const r=!n||Me(this._target.x,this._targetEnd.x,this.restThreshold)&&Me(this._target.y,this._targetEnd.y,this.restThreshold)&&Me(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(r)}zoom(e,n=!1){return this.zoomTo(this._zoomEnd+e,n)}zoomTo(e,n=!1){this._isUserControllingZoom=!1,this._zoomEnd=jt(e,this.minZoom,this.maxZoom),this._needsUpdate=!0,n||(this._zoom=this._zoomEnd);const r=!n||Me(this._zoom,this._zoomEnd,this.restThreshold);return this._changedZoom=0,this._createOnRestPromise(r)}pan(e,n,r=!1){return console.warn("`pan` has been renamed to `truck`"),this.truck(e,n,r)}truck(e,n,r=!1){this._camera.updateMatrix(),ln.setFromMatrixColumn(this._camera.matrix,0),cn.setFromMatrixColumn(this._camera.matrix,1),ln.multiplyScalar(e),cn.multiplyScalar(-n);const i=Be.copy(ln).add(cn),s=Te.copy(this._targetEnd).add(i);return this.moveTo(s.x,s.y,s.z,r)}forward(e,n=!1){Be.setFromMatrixColumn(this._camera.matrix,0),Be.crossVectors(this._camera.up,Be),Be.multiplyScalar(e);const r=Te.copy(this._targetEnd).add(Be);return this.moveTo(r.x,r.y,r.z,n)}elevate(e,n=!1){return Be.copy(this._camera.up).multiplyScalar(e),this.moveTo(this._targetEnd.x+Be.x,this._targetEnd.y+Be.y,this._targetEnd.z+Be.z,n)}moveTo(e,n,r,i=!1){this._isUserControllingTruck=!1;const s=Be.set(e,n,r).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,s,this.boundaryFriction),this._needsUpdate=!0,i||this._target.copy(this._targetEnd);const a=!i||Me(this._target.x,this._targetEnd.x,this.restThreshold)&&Me(this._target.y,this._targetEnd.y,this.restThreshold)&&Me(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(a)}lookInDirectionOf(e,n,r,i=!1){const o=Be.set(e,n,r).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius);return this.setPosition(o.x,o.y,o.z,i)}fitToBox(e,n,{cover:r=!1,paddingLeft:i=0,paddingRight:s=0,paddingBottom:a=0,paddingTop:o=0}={}){const l=[],h=e.isBox3?jr.copy(e):jr.setFromObject(e);h.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const u=R0(this._sphericalEnd.theta,k0),A=R0(this._sphericalEnd.phi,k0);l.push(this.rotateTo(u,A,n));const f=Be.setFromSpherical(this._sphericalEnd).normalize(),d=W0.setFromUnitVectors(f,_l),m=Me(Math.abs(f.y),1);m&&d.multiply(Tl.setFromAxisAngle(da,u)),d.multiply(this._yAxisUpSpaceInverse);const y=z0.makeEmpty();Te.copy(h.min).applyQuaternion(d),y.expandByPoint(Te),Te.copy(h.min).setX(h.max.x).applyQuaternion(d),y.expandByPoint(Te),Te.copy(h.min).setY(h.max.y).applyQuaternion(d),y.expandByPoint(Te),Te.copy(h.max).setZ(h.min.z).applyQuaternion(d),y.expandByPoint(Te),Te.copy(h.min).setZ(h.max.z).applyQuaternion(d),y.expandByPoint(Te),Te.copy(h.max).setY(h.min.y).applyQuaternion(d),y.expandByPoint(Te),Te.copy(h.max).setX(h.min.x).applyQuaternion(d),y.expandByPoint(Te),Te.copy(h.max).applyQuaternion(d),y.expandByPoint(Te),y.min.x-=i,y.min.y-=a,y.max.x+=s,y.max.y+=o,d.setFromUnitVectors(_l,f),m&&d.premultiply(Tl.invert()),d.premultiply(this._yAxisUpSpace);const C=y.getSize(Be),x=y.getCenter(Te).applyQuaternion(d);if(vr(this._camera)){const I=this.getDistanceToFitBox(C.x,C.y,C.z,r);l.push(this.moveTo(x.x,x.y,x.z,n)),l.push(this.dollyTo(I,n)),l.push(this.setFocalOffset(0,0,0,n))}else if(Xn(this._camera)){const I=this._camera,g=I.right-I.left,v=I.top-I.bottom,w=r?Math.max(g/C.x,v/C.y):Math.min(g/C.x,v/C.y);l.push(this.moveTo(x.x,x.y,x.z,n)),l.push(this.zoomTo(w,n)),l.push(this.setFocalOffset(0,0,0,n))}return Promise.all(l)}fitToSphere(e,n){const r=[],s=e instanceof me.Sphere?El.copy(e):Gi.createBoundingSphere(e,El);if(r.push(this.moveTo(s.center.x,s.center.y,s.center.z,n)),vr(this._camera)){const a=this.getDistanceToFitSphere(s.radius);r.push(this.dollyTo(a,n))}else if(Xn(this._camera)){const a=this._camera.right-this._camera.left,o=this._camera.top-this._camera.bottom,l=2*s.radius,h=Math.min(a/l,o/l);r.push(this.zoomTo(h,n))}return r.push(this.setFocalOffset(0,0,0,n)),Promise.all(r)}setLookAt(e,n,r,i,s,a,o=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=zr.NONE,this._changedDolly=0;const l=Te.set(i,s,a),h=Be.set(e,n,r);this._targetEnd.copy(l),this._sphericalEnd.setFromVector3(h.sub(l).applyQuaternion(this._yAxisUpSpace)),this.normalizeRotations(),this._needsUpdate=!0,o||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const u=!o||Me(this._target.x,this._targetEnd.x,this.restThreshold)&&Me(this._target.y,this._targetEnd.y,this.restThreshold)&&Me(this._target.z,this._targetEnd.z,this.restThreshold)&&Me(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&Me(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&Me(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(u)}lerpLookAt(e,n,r,i,s,a,o,l,h,u,A,f,d,m=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=zr.NONE,this._changedDolly=0;const y=Be.set(i,s,a),C=Te.set(e,n,r);Pt.setFromVector3(C.sub(y).applyQuaternion(this._yAxisUpSpace));const x=Yr.set(u,A,f),I=Te.set(o,l,h);Ni.setFromVector3(I.sub(x).applyQuaternion(this._yAxisUpSpace)),this._targetEnd.copy(y.lerp(x,d));const g=Ni.theta-Pt.theta,v=Ni.phi-Pt.phi,w=Ni.radius-Pt.radius;this._sphericalEnd.set(Pt.radius+w*d,Pt.phi+v*d,Pt.theta+g*d),this.normalizeRotations(),this._needsUpdate=!0,m||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const b=!m||Me(this._target.x,this._targetEnd.x,this.restThreshold)&&Me(this._target.y,this._targetEnd.y,this.restThreshold)&&Me(this._target.z,this._targetEnd.z,this.restThreshold)&&Me(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&Me(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&Me(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(b)}setPosition(e,n,r,i=!1){return this.setLookAt(e,n,r,this._targetEnd.x,this._targetEnd.y,this._targetEnd.z,i)}setTarget(e,n,r,i=!1){const s=this.getPosition(Be),a=this.setLookAt(s.x,s.y,s.z,e,n,r,i);return this._sphericalEnd.phi=jt(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),a}setFocalOffset(e,n,r,i=!1){this._isUserControllingOffset=!1,this._focalOffsetEnd.set(e,n,r),this._needsUpdate=!0,i||this._focalOffset.copy(this._focalOffsetEnd);const s=!i||Me(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&Me(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&Me(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(s)}setOrbitPoint(e,n,r){this._camera.updateMatrixWorld(),ln.setFromMatrixColumn(this._camera.matrixWorldInverse,0),cn.setFromMatrixColumn(this._camera.matrixWorldInverse,1),yr.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const i=Be.set(e,n,r),s=i.distanceTo(this._camera.position),a=i.sub(this._camera.position);ln.multiplyScalar(a.x),cn.multiplyScalar(a.y),yr.multiplyScalar(a.z),Be.copy(ln).add(cn).add(yr),Be.z=Be.z+s,this.dollyTo(s,!1),this.setFocalOffset(-Be.x,Be.y,-Be.z,!1),this.moveTo(e,n,r,!1)}setBoundary(e){if(!e){this._boundary.min.set(-1/0,-1/0,-1/0),this._boundary.max.set(1/0,1/0,1/0),this._needsUpdate=!0;return}this._boundary.copy(e),this._boundary.clampPoint(this._targetEnd,this._targetEnd),this._needsUpdate=!0}setViewport(e,n,r,i){if(e===null){this._viewport=null;return}this._viewport=this._viewport||new me.Vector4,typeof e=="number"?this._viewport.set(e,n,r,i):this._viewport.copy(e)}getDistanceToFitBox(e,n,r,i=!1){if(bl(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const s=e/n,a=this._camera.getEffectiveFOV()*Oi,o=this._camera.aspect;return((i?s>o:s<o)?n:e/o)*.5/Math.tan(a*.5)+r*.5}getDistanceToFitSphere(e){if(bl(this._camera,"getDistanceToFitSphere"))return this._spherical.radius;const n=this._camera.getEffectiveFOV()*Oi,r=Math.atan(Math.tan(n*.5)*this._camera.aspect)*2,i=1<this._camera.aspect?n:r;return e/Math.sin(i*.5)}getTarget(e,n=!0){return(e&&e.isVector3?e:new me.Vector3).copy(n?this._targetEnd:this._target)}getPosition(e,n=!0){return(e&&e.isVector3?e:new me.Vector3).setFromSpherical(n?this._sphericalEnd:this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(n?this._targetEnd:this._target)}getSpherical(e,n=!0){return(e&&e instanceof me.Spherical?e:new me.Spherical).copy(n?this._sphericalEnd:this._spherical)}getFocalOffset(e,n=!0){return(e&&e.isVector3?e:new me.Vector3).copy(n?this._focalOffsetEnd:this._focalOffset)}normalizeRotations(){this._sphericalEnd.theta=this._sphericalEnd.theta%Wr,this._sphericalEnd.theta<0&&(this._sphericalEnd.theta+=Wr),this._spherical.theta+=Wr*Math.round((this._sphericalEnd.theta-this._spherical.theta)/Wr)}reset(e=!1){if(!Me(this._camera.up.x,this._cameraUp0.x)||!Me(this._camera.up.y,this._cameraUp0.y)||!Me(this._camera.up.z,this._cameraUp0.z)){this._camera.up.copy(this._cameraUp0);const r=this.getPosition(Be);this.updateCameraUp(),this.setPosition(r.x,r.y,r.z)}const n=[this.setLookAt(this._position0.x,this._position0.y,this._position0.z,this._target0.x,this._target0.y,this._target0.z,e),this.setFocalOffset(this._focalOffset0.x,this._focalOffset0.y,this._focalOffset0.z,e),this.zoomTo(this._zoom0,e)];return Promise.all(n)}saveState(){this._cameraUp0.copy(this._camera.up),this.getTarget(this._target0),this.getPosition(this._position0),this._zoom0=this._zoom,this._focalOffset0.copy(this._focalOffset)}updateCameraUp(){this._yAxisUpSpace.setFromUnitVectors(this._camera.up,da),this._yAxisUpSpaceInverse.copy(this._yAxisUpSpace).invert()}applyCameraUp(){const e=Be.subVectors(this._target,this._camera.position).normalize(),n=Te.crossVectors(e,this._camera.up);this._camera.up.crossVectors(n,e).normalize(),this._camera.updateMatrixWorld();const r=this.getPosition(Be);this.updateCameraUp(),this.setPosition(r.x,r.y,r.z)}update(e){const n=this._sphericalEnd.theta-this._spherical.theta,r=this._sphericalEnd.phi-this._spherical.phi,i=this._sphericalEnd.radius-this._spherical.radius,s=G0.subVectors(this._targetEnd,this._target),a=V0.subVectors(this._focalOffsetEnd,this._focalOffset),o=this._zoomEnd-this._zoom;if(ke(n))this._thetaVelocity.value=0,this._spherical.theta=this._sphericalEnd.theta;else{const A=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.theta=Aa(this._spherical.theta,this._sphericalEnd.theta,this._thetaVelocity,A,1/0,e),this._needsUpdate=!0}if(ke(r))this._phiVelocity.value=0,this._spherical.phi=this._sphericalEnd.phi;else{const A=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.phi=Aa(this._spherical.phi,this._sphericalEnd.phi,this._phiVelocity,A,1/0,e),this._needsUpdate=!0}if(ke(i))this._radiusVelocity.value=0,this._spherical.radius=this._sphericalEnd.radius;else{const A=this._isUserControllingDolly?this.draggingSmoothTime:this.smoothTime;this._spherical.radius=Aa(this._spherical.radius,this._sphericalEnd.radius,this._radiusVelocity,A,this.maxSpeed,e),this._needsUpdate=!0}if(ke(s.x)&&ke(s.y)&&ke(s.z))this._targetVelocity.set(0,0,0),this._target.copy(this._targetEnd);else{const A=this._isUserControllingTruck?this.draggingSmoothTime:this.smoothTime;U0(this._target,this._targetEnd,this._targetVelocity,A,this.maxSpeed,e,this._target),this._needsUpdate=!0}if(ke(a.x)&&ke(a.y)&&ke(a.z))this._focalOffsetVelocity.set(0,0,0),this._focalOffset.copy(this._focalOffsetEnd);else{const A=this._isUserControllingOffset?this.draggingSmoothTime:this.smoothTime;U0(this._focalOffset,this._focalOffsetEnd,this._focalOffsetVelocity,A,this.maxSpeed,e,this._focalOffset),this._needsUpdate=!0}if(ke(o))this._zoomVelocity.value=0,this._zoom=this._zoomEnd;else{const A=this._isUserControllingZoom?this.draggingSmoothTime:this.smoothTime;this._zoom=Aa(this._zoom,this._zoomEnd,this._zoomVelocity,A,1/0,e)}if(this.dollyToCursor){if(vr(this._camera)&&this._changedDolly!==0){const A=this._spherical.radius-this._lastDistance,f=this._camera,d=this._getCameraDirection(Qi),m=Be.copy(d).cross(f.up).normalize();m.lengthSq()===0&&(m.x=1);const y=Te.crossVectors(m,d),C=this._sphericalEnd.radius*Math.tan(f.getEffectiveFOV()*Oi*.5),I=(this._sphericalEnd.radius-A-this._sphericalEnd.radius)/this._sphericalEnd.radius,g=Yr.copy(this._targetEnd).add(m.multiplyScalar(this._dollyControlCoord.x*C*f.aspect)).add(y.multiplyScalar(this._dollyControlCoord.y*C)),v=Be.copy(this._targetEnd).lerp(g,I),w=this._lastDollyDirection===zr.IN&&this._spherical.radius<=this.minDistance,b=this._lastDollyDirection===zr.OUT&&this.maxDistance<=this._spherical.radius;if(this.infinityDolly&&(w||b)){this._sphericalEnd.radius-=A,this._spherical.radius-=A;const _=Te.copy(d).multiplyScalar(-A);v.add(_)}this._boundary.clampPoint(v,v);const B=Te.subVectors(v,this._targetEnd);this._targetEnd.copy(v),this._target.add(B),this._changedDolly-=A,ke(this._changedDolly)&&(this._changedDolly=0)}else if(Xn(this._camera)&&this._changedZoom!==0){const A=this._zoom-this._lastZoom,f=this._camera,d=Be.set(this._dollyControlCoord.x,this._dollyControlCoord.y,(f.near+f.far)/(f.near-f.far)).unproject(f),m=Te.set(0,0,-1).applyQuaternion(f.quaternion),y=Yr.copy(d).add(m.multiplyScalar(-d.dot(f.up))),x=-(this._zoom-A-this._zoom)/this._zoom,I=this._getCameraDirection(Qi),g=this._targetEnd.dot(I),v=Be.copy(this._targetEnd).lerp(y,x),w=v.dot(I),b=I.multiplyScalar(w-g);v.sub(b),this._boundary.clampPoint(v,v);const B=Te.subVectors(v,this._targetEnd);this._targetEnd.copy(v),this._target.add(B),this._changedZoom-=A,ke(this._changedZoom)&&(this._changedZoom=0)}}this._camera.zoom!==this._zoom&&(this._camera.zoom=this._zoom,this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0);const l=this._collisionTest();this._spherical.radius=Math.min(this._spherical.radius,l),this._spherical.makeSafe(),this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target),this._camera.lookAt(this._target),(!ke(this._focalOffset.x)||!ke(this._focalOffset.y)||!ke(this._focalOffset.z))&&(this._camera.updateMatrixWorld(),ln.setFromMatrixColumn(this._camera.matrix,0),cn.setFromMatrixColumn(this._camera.matrix,1),yr.setFromMatrixColumn(this._camera.matrix,2),ln.multiplyScalar(this._focalOffset.x),cn.multiplyScalar(-this._focalOffset.y),yr.multiplyScalar(this._focalOffset.z),Be.copy(ln).add(cn).add(yr),this._camera.position.add(Be)),this._boundaryEnclosesCamera&&this._encloseToBoundary(this._camera.position.copy(this._target),Be.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),1);const u=this._needsUpdate;return u&&!this._updatedLastTime?(this._hasRested=!1,this.dispatchEvent({type:"wake"}),this.dispatchEvent({type:"update"})):u?(this.dispatchEvent({type:"update"}),ke(n,this.restThreshold)&&ke(r,this.restThreshold)&&ke(i,this.restThreshold)&&ke(s.x,this.restThreshold)&&ke(s.y,this.restThreshold)&&ke(s.z,this.restThreshold)&&ke(a.x,this.restThreshold)&&ke(a.y,this.restThreshold)&&ke(a.z,this.restThreshold)&&ke(o,this.restThreshold)&&!this._hasRested&&(this._hasRested=!0,this.dispatchEvent({type:"rest"}))):!u&&this._updatedLastTime&&this.dispatchEvent({type:"sleep"}),this._lastDistance=this._spherical.radius,this._lastZoom=this._zoom,this._updatedLastTime=u,this._needsUpdate=!1,u}toJSON(){return JSON.stringify({enabled:this._enabled,minDistance:this.minDistance,maxDistance:Ri(this.maxDistance),minZoom:this.minZoom,maxZoom:Ri(this.maxZoom),minPolarAngle:this.minPolarAngle,maxPolarAngle:Ri(this.maxPolarAngle),minAzimuthAngle:Ri(this.minAzimuthAngle),maxAzimuthAngle:Ri(this.maxAzimuthAngle),smoothTime:this.smoothTime,draggingSmoothTime:this.draggingSmoothTime,dollySpeed:this.dollySpeed,truckSpeed:this.truckSpeed,dollyToCursor:this.dollyToCursor,verticalDragToForward:this.verticalDragToForward,target:this._targetEnd.toArray(),position:Be.setFromSpherical(this._sphericalEnd).add(this._targetEnd).toArray(),zoom:this._zoomEnd,focalOffset:this._focalOffsetEnd.toArray(),target0:this._target0.toArray(),position0:this._position0.toArray(),zoom0:this._zoom0,focalOffset0:this._focalOffset0.toArray()})}fromJSON(e,n=!1){const r=JSON.parse(e);this.enabled=r.enabled,this.minDistance=r.minDistance,this.maxDistance=Ui(r.maxDistance),this.minZoom=r.minZoom,this.maxZoom=Ui(r.maxZoom),this.minPolarAngle=r.minPolarAngle,this.maxPolarAngle=Ui(r.maxPolarAngle),this.minAzimuthAngle=Ui(r.minAzimuthAngle),this.maxAzimuthAngle=Ui(r.maxAzimuthAngle),this.smoothTime=r.smoothTime,this.draggingSmoothTime=r.draggingSmoothTime,this.dollySpeed=r.dollySpeed,this.truckSpeed=r.truckSpeed,this.dollyToCursor=r.dollyToCursor,this.verticalDragToForward=r.verticalDragToForward,this._target0.fromArray(r.target0),this._position0.fromArray(r.position0),this._zoom0=r.zoom0,this._focalOffset0.fromArray(r.focalOffset0),this.moveTo(r.target[0],r.target[1],r.target[2],n),Pt.setFromVector3(Be.fromArray(r.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)),this.rotateTo(Pt.theta,Pt.phi,n),this.dollyTo(Pt.radius,n),this.zoomTo(r.zoom,n),this.setFocalOffset(r.focalOffset[0],r.focalOffset[1],r.focalOffset[2],n),this._needsUpdate=!0}connect(e){if(this._domElement){console.warn("camera-controls is already connected.");return}e.setAttribute("data-camera-controls-version",Gy),this._addAllEventListeners(e),this._getClientRect(this._elementRect)}disconnect(){this.cancel(),this._removeAllEventListeners(),this._domElement&&(this._domElement.removeAttribute("data-camera-controls-version"),this._domElement=void 0)}dispose(){this.removeAllEventListeners(),this.disconnect()}_getTargetDirection(e){return e.setFromSpherical(this._spherical).divideScalar(this._spherical.radius).applyQuaternion(this._yAxisUpSpaceInverse)}_getCameraDirection(e){return this._getTargetDirection(e).negate()}_findPointerById(e){return this._activePointers.find(n=>n.pointerId===e)}_findPointerByMouseButton(e){return this._activePointers.find(n=>n.mouseButton===e)}_disposePointer(e){this._activePointers.splice(this._activePointers.indexOf(e),1)}_encloseToBoundary(e,n,r){const i=n.lengthSq();if(i===0)return e;const s=Te.copy(n).add(e),o=this._boundary.clampPoint(s,Yr).sub(s),l=o.lengthSq();if(l===0)return e.add(n);if(l===i)return e;if(r===0)return e.add(n).add(o);{const h=1+r*l/n.dot(o);return e.add(Te.copy(n).multiplyScalar(h)).add(o.multiplyScalar(1-r))}}_updateNearPlaneCorners(){if(vr(this._camera)){const e=this._camera,n=e.near,r=e.getEffectiveFOV()*Oi,i=Math.tan(r*.5)*n,s=i*e.aspect;this._nearPlaneCorners[0].set(-s,-i,0),this._nearPlaneCorners[1].set(s,-i,0),this._nearPlaneCorners[2].set(s,i,0),this._nearPlaneCorners[3].set(-s,i,0)}else if(Xn(this._camera)){const e=this._camera,n=1/e.zoom,r=e.left*n,i=e.right*n,s=e.top*n,a=e.bottom*n;this._nearPlaneCorners[0].set(r,s,0),this._nearPlaneCorners[1].set(i,s,0),this._nearPlaneCorners[2].set(i,a,0),this._nearPlaneCorners[3].set(r,a,0)}}_collisionTest(){let e=1/0;if(!(this.colliderMeshes.length>=1)||bl(this._camera,"_collisionTest"))return e;const r=this._getTargetDirection(Qi);Ml.lookAt(N0,r,this._camera.up);for(let i=0;i<4;i++){const s=Te.copy(this._nearPlaneCorners[i]);s.applyMatrix4(Ml);const a=Yr.addVectors(this._target,s);pa.set(a,r),pa.far=this._spherical.radius+1;const o=pa.intersectObjects(this.colliderMeshes);o.length!==0&&o[0].distance<e&&(e=o[0].distance)}return e}_getClientRect(e){if(!this._domElement)return;const n=this._domElement.getBoundingClientRect();return e.x=n.left,e.y=n.top,this._viewport?(e.x+=this._viewport.x,e.y+=n.height-this._viewport.w-this._viewport.y,e.width=this._viewport.z,e.height=this._viewport.w):(e.width=n.width,e.height=n.height),e}_createOnRestPromise(e){return e?Promise.resolve():(this._hasRested=!1,this.dispatchEvent({type:"transitionstart"}),new Promise(n=>{const r=()=>{this.removeEventListener("rest",r),n()};this.addEventListener("rest",r)}))}_addAllEventListeners(e){}_removeAllEventListeners(){}get dampingFactor(){return console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead."),0}set dampingFactor(e){console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead.")}get draggingDampingFactor(){return console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead."),0}set draggingDampingFactor(e){console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead.")}static createBoundingSphere(e,n=new me.Sphere){const r=n,i=r.center;jr.makeEmpty(),e.traverseVisible(a=>{a.isMesh&&jr.expandByObject(a)}),jr.getCenter(i);let s=0;return e.traverseVisible(a=>{if(!a.isMesh)return;const o=a,l=o.geometry.clone();l.applyMatrix4(o.matrixWorld);const u=l.attributes.position;for(let A=0,f=u.count;A<f;A++)Be.fromBufferAttribute(u,A),s=Math.max(s,i.distanceToSquared(Be))}),r.radius=Math.sqrt(s),r}}const Wy=["min-polar-angle","max-polar-angle","min-azimuth-angle","max-azimuth-angle","distance","min-distance","max-distance","infinity-dolly","min-zoom","max-zoom","smooth-time","dragging-smooth-time","max-speed","azimuth-rotate-speed","polar-rotate-speed","dolly-speed","dolly-drag-inverted","truck-speed","dolly-to-cursor","drag-to-offset","vertical-drag-to-forward","boundary-friction","rest-threshold","collider-meshes","args"],Yy=p.defineComponent({__name:"CameraControls",props:{makeDefault:{type:Boolean,default:!1},camera:{},domElement:{},minPolarAngle:{default:0},maxPolarAngle:{default:Math.PI},minAzimuthAngle:{default:-1/0},maxAzimuthAngle:{default:1/0},distance:{default:()=>Ae.useTresContext().camera.value.position.z},minDistance:{default:Number.EPSILON},maxDistance:{default:1/0},infinityDolly:{type:Boolean,default:!1},minZoom:{default:.01},maxZoom:{default:1/0},smoothTime:{default:.25},draggingSmoothTime:{default:.125},maxSpeed:{default:1/0},azimuthRotateSpeed:{default:1},polarRotateSpeed:{default:1},dollySpeed:{default:1},dollyDragInverted:{type:Boolean,default:!1},truckSpeed:{default:2},dollyToCursor:{type:Boolean,default:!1},dragToOffset:{type:Boolean,default:!1},verticalDragToForward:{type:Boolean,default:!1},boundaryFriction:{default:0},restThreshold:{default:.01},colliderMeshes:{default:()=>[]},mouseButtons:{},touches:{}},emits:["change","start","end"],setup(t,{expose:e,emit:n}){const r=t,{makeDefault:i,minPolarAngle:s,maxPolarAngle:a,minAzimuthAngle:o,maxAzimuthAngle:l,distance:h,minDistance:u,maxDistance:A,infinityDolly:f,minZoom:d,maxZoom:m,smoothTime:y,draggingSmoothTime:C,maxSpeed:x,azimuthRotateSpeed:I,polarRotateSpeed:g,dollySpeed:v,dollyDragInverted:w,truckSpeed:b,dollyToCursor:B,dragToOffset:_,verticalDragToForward:E,boundaryFriction:T,restThreshold:L,colliderMeshes:R}=p.toRefs(r),V={Box3:c.Box3,MathUtils:{clamp:c.MathUtils.clamp},Matrix4:c.Matrix4,Quaternion:c.Quaternion,Raycaster:c.Raycaster,Sphere:c.Sphere,Spherical:c.Spherical,Vector2:c.Vector2,Vector3:c.Vector3,Vector4:c.Vector4};Gi.install({THREE:V});const{camera:Y,renderer:q,extend:ne,controls:X}=Ae.useTresContext(),G=p.ref(null);ne({CameraControls:Gi}),p.watchEffect(()=>{H(),G.value&&i.value?X.value=G.value:X.value=null});function H(){Ge(G.value,"update",()=>n("change",G.value)),Ge(G.value,"controlend",()=>n("end",G.value)),Ge(G.value,"controlstart",()=>n("start",G.value))}const{onLoop:Z}=Ae.useRenderLoop();return Z(({delta:$})=>{var O,F;(O=G.value)!=null&&O.enabled&&((F=G.value)==null||F.update($))}),p.onUnmounted(()=>{G.value&&G.value.disconnect()}),e({value:G}),($,O)=>($.camera||p.unref(Y))&&($.domElement||p.unref(q))?(p.openBlock(),p.createElementBlock("TresCameraControls",{key:0,ref_key:"controlsRef",ref:G,"min-polar-angle":p.unref(s),"max-polar-angle":p.unref(a),"min-azimuth-angle":p.unref(o),"max-azimuth-angle":p.unref(l),distance:p.unref(h),"min-distance":p.unref(u),"max-distance":p.unref(A),"infinity-dolly":p.unref(f),"min-zoom":p.unref(d),"max-zoom":p.unref(m),"smooth-time":p.unref(y),"dragging-smooth-time":p.unref(C),"max-speed":p.unref(x),"azimuth-rotate-speed":p.unref(I),"polar-rotate-speed":p.unref(g),"dolly-speed":p.unref(v),"dolly-drag-inverted":p.unref(w),"truck-speed":p.unref(b),"dolly-to-cursor":p.unref(B),"drag-to-offset":p.unref(_),"vertical-drag-to-forward":p.unref(E),"boundary-friction":p.unref(T),"rest-threshold":p.unref(L),"collider-meshes":p.unref(R),args:[$.camera||p.unref(Y),$.domElement||p.unref(q).domElement]},null,8,Wy)):p.createCommentVNode("",!0)}});class jy extends c.MeshStandardMaterial{constructor(n={}){super(n);Ve(this,"_time");Ve(this,"_factor");this.setValues(n),this._time={value:0},this._factor={value:1}}onBeforeCompile(n){n.uniforms||(n.uniforms={}),n.uniforms.time=this._time,n.uniforms.factor=this._factor,n.vertexShader=`
|
|
1149
|
+
uniform float time;
|
|
1150
|
+
uniform float factor;
|
|
1151
|
+
${n.vertexShader}
|
|
1152
|
+
`,n.vertexShader=n.vertexShader.replace("#include <begin_vertex>",`float theta = sin( time + position.y ) / 2.0 * factor;
|
|
1153
|
+
float c = cos( theta );
|
|
1154
|
+
float s = sin( theta );
|
|
1155
|
+
mat3 m = mat3( c, 0, s, 0, 1, 0, -s, 0, c );
|
|
1156
|
+
vec3 transformed = vec3( position ) * m;
|
|
1157
|
+
vNormal = vNormal * m;`)}get time(){return this._time.value}set time(n){this._time.value=n}get factor(){return this._factor.value}set factor(n){this._factor.value=n}}const qy=["factor"],Ky=p.defineComponent({__name:"index",props:{speed:{default:1},factor:{default:1}},setup(t){const e=t,n=p.shallowRef(),{extend:r}=Ae.useTresContext();r({MeshWobbleMaterial:jy});const{onLoop:i}=Ae.useRenderLoop();return i(({elapsed:s})=>{n.value&&(n.value.time=s*(e==null?void 0:e.speed))}),(s,a)=>(p.openBlock(),p.createElementBlock("TresMeshWobbleMaterial",p.mergeProps({ref_key:"materialRef",ref:n,factor:s.factor},s.$attrs),null,16,qy))}});function Cr(t,e,n){return Math.max(e,Math.min(n,t))}function Xy(t,e){return(t%e+e)%e}function Dl(t,e,n){return(1-n)*t+n*e}class Ll{constructor(e=0,n=0){Ll.prototype.isVector2=!0,this.x=e,this.y=n}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,n){return this.x=e,this.y=n,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const n=this.x,r=this.y,i=e.elements;return this.x=i[0]*n+i[3]*r+i[6],this.y=i[1]*n+i[4]*r+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(n,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const r=this.dot(e)/n;return Math.acos(Cr(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,r=this.y-e.y;return n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this}rotateAround(e,n){const r=Math.cos(n),i=Math.sin(n),s=this.x-e.x,a=this.y-e.y;return this.x=s*r-a*i+e.x,this.y=s*i+a*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}const Zy="",Zn="srgb",Pl="srgb-linear",Jy="display-p3",Y0="display-p3-linear",Fl="linear",j0="srgb",q0="rec709",K0="p3";class Vi{constructor(e,n,r,i,s,a,o,l,h){Vi.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,n,r,i,s,a,o,l,h)}set(e,n,r,i,s,a,o,l,h){const u=this.elements;return u[0]=e,u[1]=i,u[2]=o,u[3]=n,u[4]=s,u[5]=l,u[6]=r,u[7]=a,u[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const n=this.elements,r=e.elements;return n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],this}extractBasis(e,n,r){return e.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),r.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const n=e.elements;return this.set(n[0],n[4],n[8],n[1],n[5],n[9],n[2],n[6],n[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const r=e.elements,i=n.elements,s=this.elements,a=r[0],o=r[3],l=r[6],h=r[1],u=r[4],A=r[7],f=r[2],d=r[5],m=r[8],y=i[0],C=i[3],x=i[6],I=i[1],g=i[4],v=i[7],w=i[2],b=i[5],B=i[8];return s[0]=a*y+o*I+l*w,s[3]=a*C+o*g+l*b,s[6]=a*x+o*v+l*B,s[1]=h*y+u*I+A*w,s[4]=h*C+u*g+A*b,s[7]=h*x+u*v+A*B,s[2]=f*y+d*I+m*w,s[5]=f*C+d*g+m*b,s[8]=f*x+d*v+m*B,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=e,n[4]*=e,n[7]*=e,n[2]*=e,n[5]*=e,n[8]*=e,this}determinant(){const e=this.elements,n=e[0],r=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],h=e[7],u=e[8];return n*a*u-n*o*h-r*s*u+r*o*l+i*s*h-i*a*l}invert(){const e=this.elements,n=e[0],r=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],h=e[7],u=e[8],A=u*a-o*h,f=o*l-u*s,d=h*s-a*l,m=n*A+r*f+i*d;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);const y=1/m;return e[0]=A*y,e[1]=(i*h-u*r)*y,e[2]=(o*r-i*a)*y,e[3]=f*y,e[4]=(u*n-i*l)*y,e[5]=(i*s-o*n)*y,e[6]=d*y,e[7]=(r*l-h*n)*y,e[8]=(a*n-r*s)*y,this}transpose(){let e;const n=this.elements;return e=n[1],n[1]=n[3],n[3]=e,e=n[2],n[2]=n[6],n[6]=e,e=n[5],n[5]=n[7],n[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const n=this.elements;return e[0]=n[0],e[1]=n[3],e[2]=n[6],e[3]=n[1],e[4]=n[4],e[5]=n[7],e[6]=n[2],e[7]=n[5],e[8]=n[8],this}setUvTransform(e,n,r,i,s,a,o){const l=Math.cos(s),h=Math.sin(s);return this.set(r*l,r*h,-r*(l*a+h*o)+a+e,-i*h,i*l,-i*(-h*a+l*o)+o+n,0,0,1),this}scale(e,n){return this.premultiply(kl.makeScale(e,n)),this}rotate(e){return this.premultiply(kl.makeRotation(-e)),this}translate(e,n){return this.premultiply(kl.makeTranslation(e,n)),this}makeTranslation(e,n){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,n,0,0,1),this}makeRotation(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,-r,0,r,n,0,0,0,1),this}makeScale(e,n){return this.set(e,0,0,0,n,0,0,0,1),this}equals(e){const n=this.elements,r=e.elements;for(let i=0;i<9;i++)if(n[i]!==r[i])return!1;return!0}fromArray(e,n=0){for(let r=0;r<9;r++)this.elements[r]=e[r+n];return this}toArray(e=[],n=0){const r=this.elements;return e[n]=r[0],e[n+1]=r[1],e[n+2]=r[2],e[n+3]=r[3],e[n+4]=r[4],e[n+5]=r[5],e[n+6]=r[6],e[n+7]=r[7],e[n+8]=r[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const kl=new Vi,X0=new Vi().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),Z0=new Vi().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),ga={[Pl]:{transfer:Fl,primaries:q0,toReference:t=>t,fromReference:t=>t},[Zn]:{transfer:j0,primaries:q0,toReference:t=>t.convertSRGBToLinear(),fromReference:t=>t.convertLinearToSRGB()},[Y0]:{transfer:Fl,primaries:K0,toReference:t=>t.applyMatrix3(Z0),fromReference:t=>t.applyMatrix3(X0)},[Jy]:{transfer:j0,primaries:K0,toReference:t=>t.convertSRGBToLinear().applyMatrix3(Z0),fromReference:t=>t.applyMatrix3(X0).convertLinearToSRGB()}},Hy=new Set([Pl,Y0]),qt={enabled:!0,_workingColorSpace:Pl,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(t){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!t},get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(t){if(!Hy.has(t))throw new Error(`Unsupported working color space, "${t}".`);this._workingColorSpace=t},convert:function(t,e,n){if(this.enabled===!1||e===n||!e||!n)return t;const r=ga[e].toReference,i=ga[n].fromReference;return i(r(t))},fromWorkingColorSpace:function(t,e){return this.convert(t,this._workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this._workingColorSpace)},getPrimaries:function(t){return ga[t].primaries},getTransfer:function(t){return t===Zy?Fl:ga[t].transfer}};function Ol(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function Rl(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}const J0={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Jn={h:0,s:0,l:0},ma={h:0,s:0,l:0};function Ul(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*6*(2/3-n):t}class va{constructor(e,n,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,n,r)}set(e,n,r){if(n===void 0&&r===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,n,r);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,n=Zn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,qt.toWorkingColorSpace(this,n),this}setRGB(e,n,r,i=qt.workingColorSpace){return this.r=e,this.g=n,this.b=r,qt.toWorkingColorSpace(this,i),this}setHSL(e,n,r,i=qt.workingColorSpace){if(e=Xy(e,1),n=Cr(n,0,1),r=Cr(r,0,1),n===0)this.r=this.g=this.b=r;else{const s=r<=.5?r*(1+n):r+n-r*n,a=2*r-s;this.r=Ul(a,s,e+1/3),this.g=Ul(a,s,e),this.b=Ul(a,s,e-1/3)}return qt.toWorkingColorSpace(this,i),this}setStyle(e,n=Zn){function r(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=i[1],o=i[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return r(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,n);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return r(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,n);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return r(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,n);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,n);if(a===6)return this.setHex(parseInt(s,16),n);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e,n=Zn){const r=J0[e.toLowerCase()];return r!==void 0?this.setHex(r,n):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Ol(e.r),this.g=Ol(e.g),this.b=Ol(e.b),this}copyLinearToSRGB(e){return this.r=Rl(e.r),this.g=Rl(e.g),this.b=Rl(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Zn){return qt.fromWorkingColorSpace(it.copy(this),e),Math.round(Cr(it.r*255,0,255))*65536+Math.round(Cr(it.g*255,0,255))*256+Math.round(Cr(it.b*255,0,255))}getHexString(e=Zn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=qt.workingColorSpace){qt.fromWorkingColorSpace(it.copy(this),n);const r=it.r,i=it.g,s=it.b,a=Math.max(r,i,s),o=Math.min(r,i,s);let l,h;const u=(o+a)/2;if(o===a)l=0,h=0;else{const A=a-o;switch(h=u<=.5?A/(a+o):A/(2-a-o),a){case r:l=(i-s)/A+(i<s?6:0);break;case i:l=(s-r)/A+2;break;case s:l=(r-i)/A+4;break}l/=6}return e.h=l,e.s=h,e.l=u,e}getRGB(e,n=qt.workingColorSpace){return qt.fromWorkingColorSpace(it.copy(this),n),e.r=it.r,e.g=it.g,e.b=it.b,e}getStyle(e=Zn){qt.fromWorkingColorSpace(it.copy(this),e);const n=it.r,r=it.g,i=it.b;return e!==Zn?`color(${e} ${n.toFixed(3)} ${r.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(n*255)},${Math.round(r*255)},${Math.round(i*255)})`}offsetHSL(e,n,r){return this.getHSL(Jn),this.setHSL(Jn.h+e,Jn.s+n,Jn.l+r)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,n){return this.r=e.r+n.r,this.g=e.g+n.g,this.b=e.b+n.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,n){return this.r+=(e.r-this.r)*n,this.g+=(e.g-this.g)*n,this.b+=(e.b-this.b)*n,this}lerpColors(e,n,r){return this.r=e.r+(n.r-e.r)*r,this.g=e.g+(n.g-e.g)*r,this.b=e.b+(n.b-e.b)*r,this}lerpHSL(e,n){this.getHSL(Jn),e.getHSL(ma);const r=Dl(Jn.h,ma.h,n),i=Dl(Jn.s,ma.s,n),s=Dl(Jn.l,ma.l,n);return this.setHSL(r,i,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const n=this.r,r=this.g,i=this.b,s=e.elements;return this.r=s[0]*n+s[3]*r+s[6]*i,this.g=s[1]*n+s[4]*r+s[7]*i,this.b=s[2]*n+s[5]*r+s[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,n=0){return this.r=e[n],this.g=e[n+1],this.b=e[n+2],this}toArray(e=[],n=0){return e[n]=this.r,e[n+1]=this.g,e[n+2]=this.b,e}fromBufferAttribute(e,n){return this.r=e.getX(n),this.g=e.getY(n),this.b=e.getZ(n),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const it=new va;va.NAMES=J0;class $y extends c.MeshStandardMaterial{constructor(n={}){super();Ve(this,"isMeshPhysicalMaterial");Ve(this,"clearcoatMap");Ve(this,"clearcoatRoughness");Ve(this,"clearcoatRoughnessMap");Ve(this,"clearcoatNormalScale");Ve(this,"clearcoatNormalMap");Ve(this,"ior");Ve(this,"transmissionMap");Ve(this,"thickness");Ve(this,"thicknessMap");Ve(this,"attenuationDistance");Ve(this,"attenuationColor");Ve(this,"specularIntensity");Ve(this,"specularIntensityMap");Ve(this,"specularColor");Ve(this,"specularColorMap");Ve(this,"_clearcoat");Ve(this,"_transmission");this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Ll(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get(){return Cr(2.5*(this.ior-1)/(this.ior+1),0,1)},set(r){this.ior=(1+.4*r)/(1-.4*r)}}),this.roughness=0,this.transmissionMap=null,this.thickness=.5,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new va(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new va(1,1,1),this.specularColorMap=null,this._clearcoat=.5,this._transmission=1,this.setValues(n)}get clearcoat(){return this._clearcoat}set clearcoat(n){this._clearcoat>0!=n>0&&this.version++,this._clearcoat=n}get transmission(){return this._transmission}set transmission(n){this._transmission>0!=n>0&&this.version++,this._transmission=n}copy(n){return super.copy(n),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=n.clearcoat,this.clearcoatMap=n.clearcoatMap,this.clearcoatRoughness=n.clearcoatRoughness,this.clearcoatRoughnessMap=n.clearcoatRoughnessMap,this.clearcoatNormalMap=n.clearcoatNormalMap,this.clearcoatNormalScale.copy(n.clearcoatNormalScale),this.ior=n.ior,this.transmission=n.transmission,this.transmissionMap=n.transmissionMap,this.thickness=n.thickness,this.thicknessMap=n.thicknessMap,this.attenuationDistance=n.attenuationDistance,this.attenuationColor.copy(n.attenuationColor),this.specularIntensity=n.specularIntensity,this.specularIntensityMap=n.specularIntensityMap,this.specularColor.copy(n.specularColor),this.specularColorMap=n.specularColorMap,this}}const eC=$y,tC=p.defineComponent({__name:"index",setup(t,{expose:e}){const n=p.shallowRef(),{extend:r}=Ae.useTresContext();return r({MeshGlassMaterial:eC}),e({MeshGlassMaterialClass:n}),(i,s)=>(p.openBlock(),p.createElementBlock("TresMeshGlassMaterial",{ref_key:"MeshGlassMaterialClass",ref:n},null,512))}}),nC=["args"],rC=["color"],iC=p.defineComponent({__name:"Box",props:{args:{default:()=>[1,1,1]},color:{default:"#ffffff"}},setup(t,{expose:e}){const n=t,{args:r,color:i}=p.toRefs(n),s=p.shallowRef();return e({value:s}),(a,o)=>(p.openBlock(),p.createElementBlock("TresMesh",p.mergeProps({ref_key:"boxRef",ref:s},a.$attrs),[p.createElementVNode("TresBoxGeometry",{args:p.unref(r)},null,8,nC),p.renderSlot(a.$slots,"default",{},()=>[p.createElementVNode("TresMeshBasicMaterial",{color:p.unref(i)},null,8,rC)])],16))}}),H0=new c.Box3,ya=new c.Vector3;class $0 extends c.InstancedBufferGeometry{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],n=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],r=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(r),this.setAttribute("position",new c.Float32BufferAttribute(e,3)),this.setAttribute("uv",new c.Float32BufferAttribute(n,2))}applyMatrix4(e){const n=this.attributes.instanceStart,r=this.attributes.instanceEnd;return n!==void 0&&(n.applyMatrix4(e),r.applyMatrix4(e),n.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));const r=new c.InstancedInterleavedBuffer(n,6,1);return this.setAttribute("instanceStart",new c.InterleavedBufferAttribute(r,3,0)),this.setAttribute("instanceEnd",new c.InterleavedBufferAttribute(r,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));const r=new c.InstancedInterleavedBuffer(n,6,1);return this.setAttribute("instanceColorStart",new c.InterleavedBufferAttribute(r,3,0)),this.setAttribute("instanceColorEnd",new c.InterleavedBufferAttribute(r,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new c.WireframeGeometry(e.geometry)),this}fromLineSegments(e){const n=e.geometry;return this.setPositions(n.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new c.Box3);const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;e!==void 0&&n!==void 0&&(this.boundingBox.setFromBufferAttribute(e),H0.setFromBufferAttribute(n),this.boundingBox.union(H0))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new c.Sphere),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;if(e!==void 0&&n!==void 0){const r=this.boundingSphere.center;this.boundingBox.getCenter(r);let i=0;for(let s=0,a=e.count;s<a;s++)ya.fromBufferAttribute(e,s),i=Math.max(i,r.distanceToSquared(ya)),ya.fromBufferAttribute(n,s),i=Math.max(i,r.distanceToSquared(ya));this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}c.UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new c.Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},c.ShaderLib.line={uniforms:c.UniformsUtils.merge([c.UniformsLib.common,c.UniformsLib.fog,c.UniformsLib.line]),vertexShader:`
|
|
1158
|
+
#include <common>
|
|
1159
|
+
#include <color_pars_vertex>
|
|
1160
|
+
#include <fog_pars_vertex>
|
|
1161
|
+
#include <logdepthbuf_pars_vertex>
|
|
1162
|
+
#include <clipping_planes_pars_vertex>
|
|
1163
|
+
|
|
1164
|
+
uniform float linewidth;
|
|
1165
|
+
uniform vec2 resolution;
|
|
1166
|
+
|
|
1167
|
+
attribute vec3 instanceStart;
|
|
1168
|
+
attribute vec3 instanceEnd;
|
|
1169
|
+
|
|
1170
|
+
attribute vec3 instanceColorStart;
|
|
1171
|
+
attribute vec3 instanceColorEnd;
|
|
1172
|
+
|
|
1173
|
+
#ifdef WORLD_UNITS
|
|
1174
|
+
|
|
1175
|
+
varying vec4 worldPos;
|
|
1176
|
+
varying vec3 worldStart;
|
|
1177
|
+
varying vec3 worldEnd;
|
|
1178
|
+
|
|
1179
|
+
#ifdef USE_DASH
|
|
1180
|
+
|
|
1181
|
+
varying vec2 vUv;
|
|
1182
|
+
|
|
1183
|
+
#endif
|
|
1184
|
+
|
|
1185
|
+
#else
|
|
1186
|
+
|
|
1187
|
+
varying vec2 vUv;
|
|
1188
|
+
|
|
1189
|
+
#endif
|
|
1190
|
+
|
|
1191
|
+
#ifdef USE_DASH
|
|
1192
|
+
|
|
1193
|
+
uniform float dashScale;
|
|
1194
|
+
attribute float instanceDistanceStart;
|
|
1195
|
+
attribute float instanceDistanceEnd;
|
|
1196
|
+
varying float vLineDistance;
|
|
1197
|
+
|
|
1198
|
+
#endif
|
|
1199
|
+
|
|
1200
|
+
void trimSegment( const in vec4 start, inout vec4 end ) {
|
|
1201
|
+
|
|
1202
|
+
// trim end segment so it terminates between the camera plane and the near plane
|
|
1203
|
+
|
|
1204
|
+
// conservative estimate of the near plane
|
|
1205
|
+
float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column
|
|
1206
|
+
float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column
|
|
1207
|
+
float nearEstimate = - 0.5 * b / a;
|
|
1208
|
+
|
|
1209
|
+
float alpha = ( nearEstimate - start.z ) / ( end.z - start.z );
|
|
1210
|
+
|
|
1211
|
+
end.xyz = mix( start.xyz, end.xyz, alpha );
|
|
1212
|
+
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
void main() {
|
|
1216
|
+
|
|
1217
|
+
#ifdef USE_COLOR
|
|
1218
|
+
|
|
1219
|
+
vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;
|
|
1220
|
+
|
|
1221
|
+
#endif
|
|
1222
|
+
|
|
1223
|
+
#ifdef USE_DASH
|
|
1224
|
+
|
|
1225
|
+
vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;
|
|
1226
|
+
vUv = uv;
|
|
1227
|
+
|
|
1228
|
+
#endif
|
|
1229
|
+
|
|
1230
|
+
float aspect = resolution.x / resolution.y;
|
|
1231
|
+
|
|
1232
|
+
// camera space
|
|
1233
|
+
vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );
|
|
1234
|
+
vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );
|
|
1235
|
+
|
|
1236
|
+
#ifdef WORLD_UNITS
|
|
1237
|
+
|
|
1238
|
+
worldStart = start.xyz;
|
|
1239
|
+
worldEnd = end.xyz;
|
|
1240
|
+
|
|
1241
|
+
#else
|
|
1242
|
+
|
|
1243
|
+
vUv = uv;
|
|
1244
|
+
|
|
1245
|
+
#endif
|
|
1246
|
+
|
|
1247
|
+
// special case for perspective projection, and segments that terminate either in, or behind, the camera plane
|
|
1248
|
+
// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space
|
|
1249
|
+
// but we need to perform ndc-space calculations in the shader, so we must address this issue directly
|
|
1250
|
+
// perhaps there is a more elegant solution -- WestLangley
|
|
1251
|
+
|
|
1252
|
+
bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column
|
|
1253
|
+
|
|
1254
|
+
if ( perspective ) {
|
|
1255
|
+
|
|
1256
|
+
if ( start.z < 0.0 && end.z >= 0.0 ) {
|
|
1257
|
+
|
|
1258
|
+
trimSegment( start, end );
|
|
1259
|
+
|
|
1260
|
+
} else if ( end.z < 0.0 && start.z >= 0.0 ) {
|
|
1261
|
+
|
|
1262
|
+
trimSegment( end, start );
|
|
1263
|
+
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
// clip space
|
|
1269
|
+
vec4 clipStart = projectionMatrix * start;
|
|
1270
|
+
vec4 clipEnd = projectionMatrix * end;
|
|
1271
|
+
|
|
1272
|
+
// ndc space
|
|
1273
|
+
vec3 ndcStart = clipStart.xyz / clipStart.w;
|
|
1274
|
+
vec3 ndcEnd = clipEnd.xyz / clipEnd.w;
|
|
1275
|
+
|
|
1276
|
+
// direction
|
|
1277
|
+
vec2 dir = ndcEnd.xy - ndcStart.xy;
|
|
1278
|
+
|
|
1279
|
+
// account for clip-space aspect ratio
|
|
1280
|
+
dir.x *= aspect;
|
|
1281
|
+
dir = normalize( dir );
|
|
1282
|
+
|
|
1283
|
+
#ifdef WORLD_UNITS
|
|
1284
|
+
|
|
1285
|
+
// get the offset direction as perpendicular to the view vector
|
|
1286
|
+
vec3 worldDir = normalize( end.xyz - start.xyz );
|
|
1287
|
+
vec3 offset;
|
|
1288
|
+
if ( position.y < 0.5 ) {
|
|
1289
|
+
|
|
1290
|
+
offset = normalize( cross( start.xyz, worldDir ) );
|
|
1291
|
+
|
|
1292
|
+
} else {
|
|
1293
|
+
|
|
1294
|
+
offset = normalize( cross( end.xyz, worldDir ) );
|
|
1295
|
+
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1298
|
+
// sign flip
|
|
1299
|
+
if ( position.x < 0.0 ) offset *= - 1.0;
|
|
1300
|
+
|
|
1301
|
+
float forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );
|
|
1302
|
+
|
|
1303
|
+
// don't extend the line if we're rendering dashes because we
|
|
1304
|
+
// won't be rendering the endcaps
|
|
1305
|
+
#ifndef USE_DASH
|
|
1306
|
+
|
|
1307
|
+
// extend the line bounds to encompass endcaps
|
|
1308
|
+
start.xyz += - worldDir * linewidth * 0.5;
|
|
1309
|
+
end.xyz += worldDir * linewidth * 0.5;
|
|
1310
|
+
|
|
1311
|
+
// shift the position of the quad so it hugs the forward edge of the line
|
|
1312
|
+
offset.xy -= dir * forwardOffset;
|
|
1313
|
+
offset.z += 0.5;
|
|
1314
|
+
|
|
1315
|
+
#endif
|
|
1316
|
+
|
|
1317
|
+
// endcaps
|
|
1318
|
+
if ( position.y > 1.0 || position.y < 0.0 ) {
|
|
1319
|
+
|
|
1320
|
+
offset.xy += dir * 2.0 * forwardOffset;
|
|
1321
|
+
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
// adjust for linewidth
|
|
1325
|
+
offset *= linewidth * 0.5;
|
|
1326
|
+
|
|
1327
|
+
// set the world position
|
|
1328
|
+
worldPos = ( position.y < 0.5 ) ? start : end;
|
|
1329
|
+
worldPos.xyz += offset;
|
|
1330
|
+
|
|
1331
|
+
// project the worldpos
|
|
1332
|
+
vec4 clip = projectionMatrix * worldPos;
|
|
1333
|
+
|
|
1334
|
+
// shift the depth of the projected points so the line
|
|
1335
|
+
// segments overlap neatly
|
|
1336
|
+
vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;
|
|
1337
|
+
clip.z = clipPose.z * clip.w;
|
|
1338
|
+
|
|
1339
|
+
#else
|
|
1340
|
+
|
|
1341
|
+
vec2 offset = vec2( dir.y, - dir.x );
|
|
1342
|
+
// undo aspect ratio adjustment
|
|
1343
|
+
dir.x /= aspect;
|
|
1344
|
+
offset.x /= aspect;
|
|
1345
|
+
|
|
1346
|
+
// sign flip
|
|
1347
|
+
if ( position.x < 0.0 ) offset *= - 1.0;
|
|
1348
|
+
|
|
1349
|
+
// endcaps
|
|
1350
|
+
if ( position.y < 0.0 ) {
|
|
1351
|
+
|
|
1352
|
+
offset += - dir;
|
|
1353
|
+
|
|
1354
|
+
} else if ( position.y > 1.0 ) {
|
|
1355
|
+
|
|
1356
|
+
offset += dir;
|
|
1357
|
+
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
// adjust for linewidth
|
|
1361
|
+
offset *= linewidth;
|
|
1362
|
+
|
|
1363
|
+
// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...
|
|
1364
|
+
offset /= resolution.y;
|
|
1365
|
+
|
|
1366
|
+
// select end
|
|
1367
|
+
vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;
|
|
1368
|
+
|
|
1369
|
+
// back to clip space
|
|
1370
|
+
offset *= clip.w;
|
|
1371
|
+
|
|
1372
|
+
clip.xy += offset;
|
|
1373
|
+
|
|
1374
|
+
#endif
|
|
1375
|
+
|
|
1376
|
+
gl_Position = clip;
|
|
1377
|
+
|
|
1378
|
+
vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation
|
|
1379
|
+
|
|
1380
|
+
#include <logdepthbuf_vertex>
|
|
1381
|
+
#include <clipping_planes_vertex>
|
|
1382
|
+
#include <fog_vertex>
|
|
1383
|
+
|
|
1384
|
+
}
|
|
1385
|
+
`,fragmentShader:`
|
|
1386
|
+
uniform vec3 diffuse;
|
|
1387
|
+
uniform float opacity;
|
|
1388
|
+
uniform float linewidth;
|
|
1389
|
+
|
|
1390
|
+
#ifdef USE_DASH
|
|
1391
|
+
|
|
1392
|
+
uniform float dashOffset;
|
|
1393
|
+
uniform float dashSize;
|
|
1394
|
+
uniform float gapSize;
|
|
1395
|
+
|
|
1396
|
+
#endif
|
|
1397
|
+
|
|
1398
|
+
varying float vLineDistance;
|
|
1399
|
+
|
|
1400
|
+
#ifdef WORLD_UNITS
|
|
1401
|
+
|
|
1402
|
+
varying vec4 worldPos;
|
|
1403
|
+
varying vec3 worldStart;
|
|
1404
|
+
varying vec3 worldEnd;
|
|
1405
|
+
|
|
1406
|
+
#ifdef USE_DASH
|
|
1407
|
+
|
|
1408
|
+
varying vec2 vUv;
|
|
1409
|
+
|
|
1410
|
+
#endif
|
|
1411
|
+
|
|
1412
|
+
#else
|
|
1413
|
+
|
|
1414
|
+
varying vec2 vUv;
|
|
1415
|
+
|
|
1416
|
+
#endif
|
|
1417
|
+
|
|
1418
|
+
#include <common>
|
|
1419
|
+
#include <color_pars_fragment>
|
|
1420
|
+
#include <fog_pars_fragment>
|
|
1421
|
+
#include <logdepthbuf_pars_fragment>
|
|
1422
|
+
#include <clipping_planes_pars_fragment>
|
|
1423
|
+
|
|
1424
|
+
vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {
|
|
1425
|
+
|
|
1426
|
+
float mua;
|
|
1427
|
+
float mub;
|
|
1428
|
+
|
|
1429
|
+
vec3 p13 = p1 - p3;
|
|
1430
|
+
vec3 p43 = p4 - p3;
|
|
1431
|
+
|
|
1432
|
+
vec3 p21 = p2 - p1;
|
|
1433
|
+
|
|
1434
|
+
float d1343 = dot( p13, p43 );
|
|
1435
|
+
float d4321 = dot( p43, p21 );
|
|
1436
|
+
float d1321 = dot( p13, p21 );
|
|
1437
|
+
float d4343 = dot( p43, p43 );
|
|
1438
|
+
float d2121 = dot( p21, p21 );
|
|
1439
|
+
|
|
1440
|
+
float denom = d2121 * d4343 - d4321 * d4321;
|
|
1441
|
+
|
|
1442
|
+
float numer = d1343 * d4321 - d1321 * d4343;
|
|
1443
|
+
|
|
1444
|
+
mua = numer / denom;
|
|
1445
|
+
mua = clamp( mua, 0.0, 1.0 );
|
|
1446
|
+
mub = ( d1343 + d4321 * ( mua ) ) / d4343;
|
|
1447
|
+
mub = clamp( mub, 0.0, 1.0 );
|
|
1448
|
+
|
|
1449
|
+
return vec2( mua, mub );
|
|
1450
|
+
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
void main() {
|
|
1454
|
+
|
|
1455
|
+
#include <clipping_planes_fragment>
|
|
1456
|
+
|
|
1457
|
+
#ifdef USE_DASH
|
|
1458
|
+
|
|
1459
|
+
if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps
|
|
1460
|
+
|
|
1461
|
+
if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX
|
|
1462
|
+
|
|
1463
|
+
#endif
|
|
1464
|
+
|
|
1465
|
+
float alpha = opacity;
|
|
1466
|
+
|
|
1467
|
+
#ifdef WORLD_UNITS
|
|
1468
|
+
|
|
1469
|
+
// Find the closest points on the view ray and the line segment
|
|
1470
|
+
vec3 rayEnd = normalize( worldPos.xyz ) * 1e5;
|
|
1471
|
+
vec3 lineDir = worldEnd - worldStart;
|
|
1472
|
+
vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );
|
|
1473
|
+
|
|
1474
|
+
vec3 p1 = worldStart + lineDir * params.x;
|
|
1475
|
+
vec3 p2 = rayEnd * params.y;
|
|
1476
|
+
vec3 delta = p1 - p2;
|
|
1477
|
+
float len = length( delta );
|
|
1478
|
+
float norm = len / linewidth;
|
|
1479
|
+
|
|
1480
|
+
#ifndef USE_DASH
|
|
1481
|
+
|
|
1482
|
+
#ifdef USE_ALPHA_TO_COVERAGE
|
|
1483
|
+
|
|
1484
|
+
float dnorm = fwidth( norm );
|
|
1485
|
+
alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );
|
|
1486
|
+
|
|
1487
|
+
#else
|
|
1488
|
+
|
|
1489
|
+
if ( norm > 0.5 ) {
|
|
1490
|
+
|
|
1491
|
+
discard;
|
|
1492
|
+
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
#endif
|
|
1496
|
+
|
|
1497
|
+
#endif
|
|
1498
|
+
|
|
1499
|
+
#else
|
|
1500
|
+
|
|
1501
|
+
#ifdef USE_ALPHA_TO_COVERAGE
|
|
1502
|
+
|
|
1503
|
+
// artifacts appear on some hardware if a derivative is taken within a conditional
|
|
1504
|
+
float a = vUv.x;
|
|
1505
|
+
float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
|
|
1506
|
+
float len2 = a * a + b * b;
|
|
1507
|
+
float dlen = fwidth( len2 );
|
|
1508
|
+
|
|
1509
|
+
if ( abs( vUv.y ) > 1.0 ) {
|
|
1510
|
+
|
|
1511
|
+
alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );
|
|
1512
|
+
|
|
1513
|
+
}
|
|
1514
|
+
|
|
1515
|
+
#else
|
|
1516
|
+
|
|
1517
|
+
if ( abs( vUv.y ) > 1.0 ) {
|
|
1518
|
+
|
|
1519
|
+
float a = vUv.x;
|
|
1520
|
+
float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
|
|
1521
|
+
float len2 = a * a + b * b;
|
|
1522
|
+
|
|
1523
|
+
if ( len2 > 1.0 ) discard;
|
|
1524
|
+
|
|
1525
|
+
}
|
|
1526
|
+
|
|
1527
|
+
#endif
|
|
1528
|
+
|
|
1529
|
+
#endif
|
|
1530
|
+
|
|
1531
|
+
vec4 diffuseColor = vec4( diffuse, alpha );
|
|
1532
|
+
|
|
1533
|
+
#include <logdepthbuf_fragment>
|
|
1534
|
+
#include <color_fragment>
|
|
1535
|
+
|
|
1536
|
+
gl_FragColor = vec4( diffuseColor.rgb, alpha );
|
|
1537
|
+
|
|
1538
|
+
#include <tonemapping_fragment>
|
|
1539
|
+
#include <colorspace_fragment>
|
|
1540
|
+
#include <fog_fragment>
|
|
1541
|
+
#include <premultiplied_alpha_fragment>
|
|
1542
|
+
|
|
1543
|
+
}
|
|
1544
|
+
`};class Ql extends c.ShaderMaterial{constructor(e){super({type:"LineMaterial",uniforms:c.UniformsUtils.clone(c.ShaderLib.line.uniforms),vertexShader:c.ShaderLib.line.vertexShader,fragmentShader:c.ShaderLib.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(e)}get color(){return this.uniforms.diffuse.value}set color(e){this.uniforms.diffuse.value=e}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(e){e===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}get dashed(){return"USE_DASH"in this.defines}set dashed(e){e===!0!==this.dashed&&(this.needsUpdate=!0),e===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(e){this.uniforms.dashScale.value=e}get dashSize(){return this.uniforms.dashSize.value}set dashSize(e){this.uniforms.dashSize.value=e}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(e){this.uniforms.dashOffset.value=e}get gapSize(){return this.uniforms.gapSize.value}set gapSize(e){this.uniforms.gapSize.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get resolution(){return this.uniforms.resolution.value}set resolution(e){this.uniforms.resolution.value.copy(e)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(e){this.defines&&(e===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),e===!0?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1))}}const e2=new c.Vector3,t2=new c.Vector3,et=new c.Vector4,tt=new c.Vector4,hn=new c.Vector4,Nl=new c.Vector3,Gl=new c.Matrix4,nt=new c.Line3,n2=new c.Vector3,Ca=new c.Box3,Ia=new c.Sphere,un=new c.Vector4;let An,Ir;function r2(t,e,n){return un.set(0,0,-e,1).applyMatrix4(t.projectionMatrix),un.multiplyScalar(1/un.w),un.x=Ir/n.width,un.y=Ir/n.height,un.applyMatrix4(t.projectionMatrixInverse),un.multiplyScalar(1/un.w),Math.abs(Math.max(un.x,un.y))}function sC(t,e){const n=t.matrixWorld,r=t.geometry,i=r.attributes.instanceStart,s=r.attributes.instanceEnd,a=Math.min(r.instanceCount,i.count);for(let o=0,l=a;o<l;o++){nt.start.fromBufferAttribute(i,o),nt.end.fromBufferAttribute(s,o),nt.applyMatrix4(n);const h=new c.Vector3,u=new c.Vector3;An.distanceSqToSegment(nt.start,nt.end,u,h),u.distanceTo(h)<Ir*.5&&e.push({point:u,pointOnLine:h,distance:An.origin.distanceTo(u),object:t,face:null,faceIndex:o,uv:null,uv1:null})}}function aC(t,e,n){const r=e.projectionMatrix,s=t.material.resolution,a=t.matrixWorld,o=t.geometry,l=o.attributes.instanceStart,h=o.attributes.instanceEnd,u=Math.min(o.instanceCount,l.count),A=-e.near;An.at(1,hn),hn.w=1,hn.applyMatrix4(e.matrixWorldInverse),hn.applyMatrix4(r),hn.multiplyScalar(1/hn.w),hn.x*=s.x/2,hn.y*=s.y/2,hn.z=0,Nl.copy(hn),Gl.multiplyMatrices(e.matrixWorldInverse,a);for(let f=0,d=u;f<d;f++){if(et.fromBufferAttribute(l,f),tt.fromBufferAttribute(h,f),et.w=1,tt.w=1,et.applyMatrix4(Gl),tt.applyMatrix4(Gl),et.z>A&&tt.z>A)continue;if(et.z>A){const g=et.z-tt.z,v=(et.z-A)/g;et.lerp(tt,v)}else if(tt.z>A){const g=tt.z-et.z,v=(tt.z-A)/g;tt.lerp(et,v)}et.applyMatrix4(r),tt.applyMatrix4(r),et.multiplyScalar(1/et.w),tt.multiplyScalar(1/tt.w),et.x*=s.x/2,et.y*=s.y/2,tt.x*=s.x/2,tt.y*=s.y/2,nt.start.copy(et),nt.start.z=0,nt.end.copy(tt),nt.end.z=0;const y=nt.closestPointToPointParameter(Nl,!0);nt.at(y,n2);const C=c.MathUtils.lerp(et.z,tt.z,y),x=C>=-1&&C<=1,I=Nl.distanceTo(n2)<Ir*.5;if(x&&I){nt.start.fromBufferAttribute(l,f),nt.end.fromBufferAttribute(h,f),nt.start.applyMatrix4(a),nt.end.applyMatrix4(a);const g=new c.Vector3,v=new c.Vector3;An.distanceSqToSegment(nt.start,nt.end,v,g),n.push({point:v,pointOnLine:g,distance:An.origin.distanceTo(v),object:t,face:null,faceIndex:f,uv:null,uv1:null})}}}class oC extends c.Mesh{constructor(e=new $0,n=new Ql({color:Math.random()*16777215})){super(e,n),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,n=e.attributes.instanceStart,r=e.attributes.instanceEnd,i=new Float32Array(2*n.count);for(let a=0,o=0,l=n.count;a<l;a++,o+=2)e2.fromBufferAttribute(n,a),t2.fromBufferAttribute(r,a),i[o]=o===0?0:i[o-1],i[o+1]=i[o]+e2.distanceTo(t2);const s=new c.InstancedInterleavedBuffer(i,2,1);return e.setAttribute("instanceDistanceStart",new c.InterleavedBufferAttribute(s,1,0)),e.setAttribute("instanceDistanceEnd",new c.InterleavedBufferAttribute(s,1,1)),this}raycast(e,n){const r=this.material.worldUnits,i=e.camera;i===null&&!r&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const s=e.params.Line2!==void 0&&e.params.Line2.threshold||0;An=e.ray;const a=this.matrixWorld,o=this.geometry,l=this.material;Ir=l.linewidth+s,o.boundingSphere===null&&o.computeBoundingSphere(),Ia.copy(o.boundingSphere).applyMatrix4(a);let h;if(r)h=Ir*.5;else{const A=Math.max(i.near,Ia.distanceToPoint(An.origin));h=r2(i,A,l.resolution)}if(Ia.radius+=h,An.intersectsSphere(Ia)===!1)return;o.boundingBox===null&&o.computeBoundingBox(),Ca.copy(o.boundingBox).applyMatrix4(a);let u;if(r)u=Ir*.5;else{const A=Math.max(i.near,Ca.distanceToPoint(An.origin));u=r2(i,A,l.resolution)}Ca.expandByScalar(u),An.intersectsBox(Ca)!==!1&&(r?sC(this,n):aC(this,i,n))}}class i2 extends $0{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){const n=e.length-3,r=new Float32Array(2*n);for(let i=0;i<n;i+=3)r[2*i]=e[i],r[2*i+1]=e[i+1],r[2*i+2]=e[i+2],r[2*i+3]=e[i+3],r[2*i+4]=e[i+4],r[2*i+5]=e[i+5];return super.setPositions(r),this}setColors(e){const n=e.length-3,r=new Float32Array(2*n);for(let i=0;i<n;i+=3)r[2*i]=e[i],r[2*i+1]=e[i+1],r[2*i+2]=e[i+2],r[2*i+3]=e[i+3],r[2*i+4]=e[i+4],r[2*i+5]=e[i+5];return super.setColors(r),this}fromLine(e){const n=e.geometry;return this.setPositions(n.attributes.position.array),this}}class lC extends oC{constructor(e=new i2,n=new Ql({color:Math.random()*16777215})){super(e,n),this.isLine2=!0,this.type="Line2"}}const cC=["object"],s2=p.defineComponent({__name:"Line2",props:{points:{},vertexColors:{default:null},color:{default:"white"},lineWidth:{default:1},worldUnits:{type:Boolean,default:!1},alphaToCoverage:{type:Boolean,default:!1},dashed:{type:Boolean,default:!1},dashSize:{default:1},gapSize:{default:1},dashScale:{default:1},dashOffset:{default:0}},setup(t){const e=t;function n(u,A){if(!u||u.length===0)return new Array(A).fill(Ae.normalizeColor(e.color));if(u.length===1)return new Array(A).fill(Ae.normalizeColor(u[0]));if(u.length===A)return u.map(Ae.normalizeColor);const f=A-1,d=u.map(Ae.normalizeColor);closed&&d.push(d[0].clone());const m=[d[0]],y=f/(d.length-1);for(let C=1;C<f;C++){const x=C%y/y,I=Math.floor(C/y);m.push(d[I].clone().lerp(d[I+1],x))}return m.push(d[d.length-1]),m}function r(u,A,f){const d=A.map(y=>y instanceof c.Vector3?[y.x,y.y,y.z]:y instanceof c.Vector2?[y.x,y.y,0]:Array.isArray(y)&&y.length===2?[y[0],y[1],0]:y).flat();u.setPositions(d.flat());const m=n(f,A.length).map(y=>y.toArray()).flat();u.setColors(m),o.computeLineDistances()}function i(u,A){u.color=Ae.normalizeColor(A.color),u.linewidth=A.lineWidth,u.alphaToCoverage=A.alphaToCoverage,u.worldUnits=A.worldUnits,u.vertexColors=Array.isArray(A.vertexColors),u.dashed=A.dashed,u.dashScale=A.dashScale,u.dashSize=A.dashSize,u.dashOffset=A.dashOffset,u.gapSize=A.gapSize,u.needsUpdate=!0}const s=new Ql,a=new i2,o=new lC(a,s),l=Ae.useTresContext().sizes,h=p.computed(()=>Array.isArray(e.vertexColors));return i(s,e),r(a,e.points,e.vertexColors),o.computeLineDistances(),p.watch(()=>[e.color,e.lineWidth,e.alphaToCoverage,e.worldUnits,h,e.dashed,e.dashScale,e.dashSize,e.dashOffset],()=>i(s,e)),p.watch([e.points,e.vertexColors],()=>r(a,e.points,e.vertexColors)),p.watch(()=>e.vertexColors,()=>r(a,e.points,e.vertexColors)),p.watch(()=>e.points,()=>r(a,e.points,e.vertexColors)),p.watch([l.height,l.width],()=>s.resolution=new c.Vector2(l.width.value,l.height.value)),p.onUnmounted(()=>{a.dispose(),s.dispose()}),(u,A)=>(p.openBlock(),p.createElementBlock("primitive",{object:p.unref(o)},null,8,cC))}}),hC=p.defineComponent({__name:"CatmullRomCurve3",props:{segments:{default:20},closed:{type:Boolean,default:!1},curveType:{default:"centripetal"},tension:{default:.5},points:{},vertexColors:{},color:{},lineWidth:{},alphaToCoverage:{type:Boolean},dashed:{type:Boolean},dashSize:{},dashScale:{},dashOffset:{},gapSize:{},worldUnits:{type:Boolean}},setup(t){const e=t;function n(a,o,l,h){const u=a.map(A=>A instanceof c.Vector3?A:new c.Vector3(...A));return new c.CatmullRomCurve3(u,o,l,h)}function r(a,o){return a.getPoints(o)}const i=p.computed(()=>n(e.points,e.closed,e.curveType,e.tension)),s=p.computed(()=>r(i.value,e.segments));return(a,o)=>(p.openBlock(),p.createBlock(s2,{points:s.value,"vertex-colors":e.vertexColors,color:e.color,lineWidth:e.lineWidth,alphaToCoverage:e.alphaToCoverage,dashed:e.dashed,dashSize:e.dashSize,dashScale:e.dashScale,dashOffset:e.dashOffset,gapSize:e.gapSize,worldUnits:e.worldUnits},null,8,["points","vertex-colors","color","lineWidth","alphaToCoverage","dashed","dashSize","dashScale","dashOffset","gapSize","worldUnits"]))}}),uC=["args"],AC=["color"],fC=p.defineComponent({__name:"Circle",props:{args:{default:()=>[1,32,0,Math.PI*2]},color:{default:"#ffffff"}},setup(t,{expose:e}){const n=t,{args:r,color:i}=p.toRefs(n),s=p.shallowRef();return e({value:s}),(a,o)=>(p.openBlock(),p.createElementBlock("TresMesh",p.mergeProps({ref_key:"circleRef",ref:s},a.$attrs),[p.createElementVNode("TresCircleGeometry",{args:p.unref(r)},null,8,uC),p.renderSlot(a.$slots,"default",{},()=>[p.createElementVNode("TresMeshBasicMaterial",{color:p.unref(i)},null,8,AC)])],16))}}),dC=["args"],pC=["color"],gC=p.defineComponent({__name:"Cone",props:{args:{default:()=>[1,1,12,12,!1,0,Math.PI*2]},color:{default:"#ffffff"}},setup(t,{expose:e}){const n=t,{args:r,color:i}=p.toRefs(n),s=p.shallowRef();return e({value:s}),(a,o)=>(p.openBlock(),p.createElementBlock("TresMesh",p.mergeProps({ref_key:"coneRef",ref:s},a.$attrs),[p.createElementVNode("TresConeGeometry",{args:p.unref(r)},null,8,dC),p.renderSlot(a.$slots,"default",{},()=>[p.createElementVNode("TresMeshBasicMaterial",{color:p.unref(i)},null,8,pC)])],16))}}),mC=["args"],vC=["color"],yC=p.defineComponent({__name:"Dodecahedron",props:{args:{default:()=>[1,0]},color:{default:"#ffffff"}},setup(t,{expose:e}){const n=t,{args:r,color:i}=p.toRefs(n),s=p.shallowRef();return e({value:s}),(a,o)=>(p.openBlock(),p.createElementBlock("TresMesh",p.mergeProps({ref_key:"dodecahedronRef",ref:s},a.$attrs),[p.createElementVNode("TresDodecahedronGeometry",{args:p.unref(r)},null,8,mC),p.renderSlot(a.$slots,"default",{},()=>[p.createElementVNode("TresMeshBasicMaterial",{color:p.unref(i)},null,8,vC)])],16))}}),CC=["args"],IC=["color"],xC=p.defineComponent({__name:"Icosahedron",props:{args:{default:()=>[1,0]},color:{default:"#ffffff"}},setup(t,{expose:e}){const n=t,{args:r,color:i}=p.toRefs(n),s=p.shallowRef();return e({value:s}),(a,o)=>(p.openBlock(),p.createElementBlock("TresMesh",p.mergeProps({ref_key:"icosahedronRef",ref:s},a.$attrs),[p.createElementVNode("TresIcosahedronGeometry",{args:p.unref(r)},null,8,CC),p.renderSlot(a.$slots,"default",{},()=>[p.createElementVNode("TresMeshBasicMaterial",{color:p.unref(i)},null,8,IC)])],16))}}),SC=["args"],BC=["color"],wC=p.defineComponent({__name:"Octahedron",props:{args:{default:()=>[1,0]},color:{default:"#ffffff"}},setup(t,{expose:e}){const n=t,{args:r,color:i}=p.toRefs(n),s=p.shallowRef();return e({value:s}),(a,o)=>(p.openBlock(),p.createElementBlock("TresMesh",p.mergeProps({ref_key:"octahedronRef",ref:s},a.$attrs),[p.createElementVNode("TresOctahedronGeometry",{args:p.unref(r)},null,8,SC),p.renderSlot(a.$slots,"default",{},()=>[p.createElementVNode("TresMeshBasicMaterial",{color:p.unref(i)},null,8,BC)])],16))}}),bC=["rotation"],_C=["args"],EC=["color"],TC=p.defineComponent({__name:"Plane",props:{args:{default:()=>[1,1]},color:{default:"#ffffff"}},setup(t,{expose:e}){const n=t,{args:r,color:i}=p.toRefs(n),s=p.shallowRef();return e({value:s}),(a,o)=>(p.openBlock(),p.createElementBlock("TresMesh",p.mergeProps({ref_key:"planeRef",ref:s,rotation:[-Math.PI/2,0,0]},a.$attrs),[p.createElementVNode("TresPlaneGeometry",{args:p.unref(r)},null,8,_C),p.renderSlot(a.$slots,"default",{},()=>[p.createElementVNode("TresMeshBasicMaterial",{color:p.unref(i)},null,8,EC)])],16,bC))}}),MC=["args"],DC=["color"],LC=p.defineComponent({__name:"Ring",props:{args:{default:()=>[.5,1,32]},color:{default:"#ffffff"}},setup(t,{expose:e}){const n=t,{args:r,color:i}=p.toRefs(n),s=p.shallowRef();return e({value:s}),(a,o)=>(p.openBlock(),p.createElementBlock("TresMesh",p.mergeProps({ref_key:"ringRef",ref:s},a.$attrs),[p.createElementVNode("TresRingGeometry",{args:p.unref(r)},null,8,MC),p.renderSlot(a.$slots,"default",{},()=>[p.createElementVNode("TresMeshBasicMaterial",{color:p.unref(i)},null,8,DC)])],16))}}),PC=["args"],FC=["color"],kC=p.defineComponent({__name:"Sphere",props:{args:{default:()=>[2,32,16]},color:{default:"#ffffff"}},setup(t,{expose:e}){const n=t,{args:r,color:i}=p.toRefs(n),s=p.shallowRef();return e({value:s}),(a,o)=>(p.openBlock(),p.createElementBlock("TresMesh",p.mergeProps({ref_key:"sphereRef",ref:s},a.$attrs),[p.createElementVNode("TresSphereGeometry",{args:p.unref(r)},null,8,PC),p.renderSlot(a.$slots,"default",{},()=>[p.createElementVNode("TresMeshBasicMaterial",{color:p.unref(i)},null,8,FC)])],16))}}),OC=["rotation"],RC=["args"],UC=["color"],QC=p.defineComponent({__name:"Tetrahedron",props:{args:{default:()=>[1,0]},color:{default:"#ffffff"}},setup(t,{expose:e}){const n=t,{args:r,color:i}=p.toRefs(n),s=p.shallowRef();return e({value:s}),(a,o)=>(p.openBlock(),p.createElementBlock("TresMesh",p.mergeProps({ref_key:"tetrahedronRef",ref:s,rotation:[-Math.PI/2,0,0]},a.$attrs),[p.createElementVNode("TresTetrahedronGeometry",{args:p.unref(r)},null,8,RC),p.renderSlot(a.$slots,"default",{},()=>[p.createElementVNode("TresMeshBasicMaterial",{color:p.unref(i)},null,8,UC)])],16,OC))}}),NC=["args"],GC=["color"],VC=p.defineComponent({__name:"Torus",props:{args:{default:()=>[1,1,16,80]},color:{default:"#ffffff"}},setup(t,{expose:e}){const n=t,{args:r,color:i}=p.toRefs(n),s=p.shallowRef();return e({value:s}),(a,o)=>(p.openBlock(),p.createElementBlock("TresMesh",p.mergeProps({ref_key:"torusRef",ref:s},a.$attrs),[p.createElementVNode("TresTorusGeometry",{args:p.unref(r)},null,8,NC),p.renderSlot(a.$slots,"default",{},()=>[p.createElementVNode("TresMeshBasicMaterial",{color:p.unref(i)},null,8,GC)])],16))}}),zC=["args"],WC=["color"],YC=p.defineComponent({__name:"TorusKnot",props:{args:{default:()=>[1,.4,64,8]},color:{default:"#ffffff"}},setup(t,{expose:e}){const n=t,{args:r,color:i}=p.toRefs(n),s=p.shallowRef();return e({value:s}),(a,o)=>(p.openBlock(),p.createElementBlock("TresMesh",p.mergeProps({ref_key:"torusKnotRef",ref:s},a.$attrs),[p.createElementVNode("TresTorusKnotGeometry",{args:p.unref(r)},null,8,zC),p.renderSlot(a.$slots,"default",{},()=>[p.createElementVNode("TresMeshBasicMaterial",{color:p.unref(i)},null,8,WC)])],16))}}),jC=["args"],qC=["color"],KC=p.defineComponent({__name:"Tube",props:{args:{default:()=>[new c.QuadraticBezierCurve3(new c.Vector3(-1,0,0),new c.Vector3(0,1,0),new c.Vector3(1,0,0)),20,.2,8,!1]},color:{default:"#ffffff"}},setup(t,{expose:e}){const n=t,{args:r,color:i}=p.toRefs(n),s=p.shallowRef();return e({value:s}),(a,o)=>(p.openBlock(),p.createElementBlock("TresMesh",p.mergeProps({ref_key:"tubeRef",ref:s},a.$attrs),[p.createElementVNode("TresTubeGeometry",{args:p.unref(r)},null,8,jC),p.renderSlot(a.$slots,"default",{},()=>[p.createElementVNode("TresMeshBasicMaterial",{color:p.unref(i)},null,8,qC)])],16))}}),XC=p.defineComponent({__name:"component",props:{background:{type:[Boolean,String],default:!1},blur:{default:0},files:{default:[]},path:{default:""},preset:{default:void 0}},async setup(t,{expose:e}){let n,r;const i=t,s=p.ref(null);return e(s),s.value=([n,r]=p.withAsyncContext(()=>D0(i).texture),n=await n,r(),n),()=>{}}}),ZC=["receive-shadow","rotation"],JC=["args"],HC=p.createElementVNode("TresMeshStandardMaterial",{color:8421504,side:2},null,-1),$C=p.defineComponent({__name:"Backdrop",props:{floor:{default:.25},segments:{default:20},receiveShadow:{type:Boolean,default:!1}},setup(t){const e=t,n=o=>o===0?0:2**(10*o-10),{floor:r,segments:i,receiveShadow:s}=p.toRefs(e),a=p.ref(null);return p.watch(()=>[i.value,r.value,a.value],([o,l,h])=>{if(!h||o===null)return;let u=0;const A=o/o/2,f=h.attributes.position;for(let d=0;d<o+1;d++)for(let m=0;m<o+1;m++)f.setXYZ(u++,d/o-A+(d===0?-l:0),m/o-A,n(d/o));f.needsUpdate=!0,h.computeVertexNormals()}),(o,l)=>(p.openBlock(),p.createElementBlock("TresGroup",p.normalizeProps(p.guardReactiveProps(o.$attrs)),[p.createElementVNode("TresMesh",{"receive-shadow":p.unref(s),rotation:[-Math.PI/2,0,Math.PI/2]},[p.createElementVNode("TresPlaneGeometry",{ref_key:"planeRef",ref:a,args:[1,1,p.unref(i),p.unref(i)]},null,8,JC),p.renderSlot(o.$slots,"default",{},()=>[HC])],8,ZC)],16))}}),eI=["geometry"],tI=["map","opacity","depth-write"],nI=["object"],rI=["args"],iI=["rotation","args"],sI=p.defineComponent({__name:"ContactShadows",props:{opacity:{default:1},width:{default:1},height:{default:1},blur:{default:1},far:{default:10},smooth:{type:Boolean,default:!0},resolution:{default:512},frames:{default:1/0},scale:{default:10},color:{default:"#000000"},depthWrite:{type:Boolean,default:!1},helper:{type:Boolean,default:!1}},setup(t,{expose:e}){const n=t,r=p.shallowRef(),i=p.shallowRef();e(r);let s,a,o,l,h;const{renderer:u,scene:A}=Ae.useTresContext(),f=p.computed(()=>n.width*(Array.isArray(n.scale)?n.scale[0]:n.scale||1)),d=p.computed(()=>n.height*(Array.isArray(n.scale)?n.scale[1]:n.scale||1));p.watchEffect(()=>{s&&s.dispose(),a&&a.dispose(),o&&o.dispose(),l&&l.geometry.dispose(),s=new c.WebGLRenderTarget(n.resolution,n.resolution),a=new c.WebGLRenderTarget(n.resolution,n.resolution),a.texture.generateMipmaps=s.texture.generateMipmaps=!1,i.value=new c.OrthographicCamera(-f.value/2,f.value/2,d.value/2,-d.value/2,0,n.far),o=new c.PlaneGeometry(f.value,d.value).rotateX(Math.PI/2),l=new c.Mesh(o),l.visible=!1}),p.watchEffect(()=>{n.color&&(h&&h.dispose(),h=new c.MeshDepthMaterial,h.depthTest=h.depthWrite=!1,h.onBeforeCompile=w=>{w.uniforms={...w.uniforms,ucolor:{value:n.color?new c.Color(n.color):new c.Color}},w.fragmentShader=w.fragmentShader.replace("void main() {",`uniform vec3 ucolor;
|
|
1545
|
+
void main() {
|
|
1546
|
+
`),w.fragmentShader=w.fragmentShader.replace("vec4( vec3( 1.0 - fragCoordZ ), opacity );","vec4( ucolor * fragCoordZ * 2.0, ( 1.0 - fragCoordZ ) * 1.0 );")})});const m=new c.ShaderMaterial(Ep),y=new c.ShaderMaterial(Tp);y.depthTest=m.depthTest=!1;function C(w){!u.value||!i.value||(l.visible=!0,l.material=m,m.uniforms.tDiffuse.value=s.texture,m.uniforms.h.value=w/256,u.value.setRenderTarget(a),u.value.render(l,i.value),l.material=y,y.uniforms.tDiffuse.value=a.texture,y.uniforms.v.value=w/256,u.value.setRenderTarget(s),u.value.render(l,i.value),l.visible=!1)}const{onLoop:x}=Ae.useRenderLoop();let I=0,g,v;return x(()=>{!i.value||A.value===void 0||u.value===void 0||(n.frames===1/0||I<n.frames)&&(I++,g=A.value.background,v=A.value.overrideMaterial,r.value.visible=!1,A.value.background=null,A.value.overrideMaterial=h,u.value.setRenderTarget(s),u.value.render(A.value,i.value),C(n.blur),n.smooth&&C(n.blur*.4),u.value.setRenderTarget(null),r.value.visible=!0,A.value.background=g,A.value.overrideMaterial=v)}),(w,b)=>(p.openBlock(),p.createElementBlock("TresGroup",p.mergeProps({ref_key:"groupRef",ref:r},w.$attrs),[p.createElementVNode("TresMesh",{scale:[1,-1,1],geometry:p.unref(o)},[p.createElementVNode("TresMeshBasicMaterial",{map:p.unref(s).texture,opacity:w.opacity,"depth-write":w.depthWrite,transparent:!0},null,8,tI)],8,eI),p.createElementVNode("primitive",{object:p.unref(l)},null,8,nI),i.value&&w.helper?(p.openBlock(),p.createElementBlock("TresCameraHelper",{key:0,args:[i.value]},null,8,rI)):p.createCommentVNode("",!0),p.createElementVNode("TresOrthographicCamera",{ref_key:"shadowCamera",ref:i,position:[0,0,0],rotation:[Math.PI/2,0,0],args:[-f.value/2,f.value/2,d.value/2,-d.value/2,0,w.far]},null,8,iI)],16))}}),aI=["position","a-scale"],oI=["size","size-attenuation","transparent","alpha-test","alpha-map"],lI=p.defineComponent({__name:"Stars",props:{size:{default:.1},sizeAttenuation:{type:Boolean,default:!0},transparent:{type:Boolean,default:!0},alphaTest:{default:.01},count:{default:5e3},depth:{default:50},radius:{default:100},alphaMap:{default:null}},setup(t,{expose:e}){const n=t,r=p.ref(),i=p.ref(),{radius:s,depth:a,count:o,size:l,sizeAttenuation:h,transparent:u,alphaMap:A,alphaTest:f}=p.toRefs(n),d=()=>{let y=s.value+a.value;const C=p.computed(()=>a.value/o.value),x=[],I=Array.from({length:o.value},()=>(.5+.5*Math.random())*4),g=v=>new c.Vector3().setFromSpherical(new c.Spherical(v,Math.acos(1-Math.random()*2),Math.random()*2*Math.PI)).toArray();for(let v=0;v<o.value;v++)y-=C.value*Math.random(),x.push(...g(y));r.value=new Float32Array(x),i.value=new Float32Array(I)};p.watchEffect(()=>{d()});const m=p.shallowRef();return e({value:m}),(y,C)=>(p.openBlock(),p.createElementBlock("TresPoints",{ref_key:"starsRef",ref:m},[p.createElementVNode("TresBufferGeometry",{position:[r.value,3],"a-scale":[i.value,1]},null,8,aI),p.createElementVNode("TresPointsMaterial",{size:p.unref(l),"size-attenuation":p.unref(h),transparent:p.unref(u),"alpha-test":p.unref(f),"alpha-map":p.unref(A)},null,8,oI)],512))}}),cI=["size","color","alpha-map","map","opacity","alpha-test","depth-write","transparent","size-attenuation"],hI=["position","velocity"],uI=p.defineComponent({__name:"Precipitation",props:{size:{default:.1},area:{default:()=>[10,10,20]},color:{default:16777215},map:{},alphaMap:{},alphaTest:{default:.01},opacity:{default:.8},count:{default:5e3},speed:{default:.1},randomness:{default:.5},depthWrite:{type:Boolean,default:!1},transparent:{type:Boolean,default:!0},sizeAttenuation:{type:Boolean,default:!0}},setup(t){const e=t,{size:n,area:r,color:i,alphaMap:s,map:a,opacity:o,alphaTest:l,depthWrite:h,transparent:u,sizeAttenuation:A,count:f,speed:d,randomness:m}=p.toRefs(e),y=p.shallowRef();let C=[],x=[];const I=()=>{C=new Float32Array(f.value*3);for(let w=0;w<f.value;w++){const b=w*3;C[b]=(Math.random()-.5)*r.value[0],C[b+1]=(Math.random()-.5)*r.value[1],C[b+2]=(Math.random()-.5)*r.value[2]}},g=()=>{x=new Float32Array(f.value*2);for(let w=0;w<f.value*2;w+=2)x[w]=(Math.random()-.5)/5*d.value*m.value,x[w+1]=Math.random()/5*d.value+.01};g(),I(),p.watchEffect(()=>{g(),I()});const{onLoop:v}=Ae.useRenderLoop();return v(()=>{var w,b;if((w=y.value)!=null&&w.attributes.position.array&&((b=y.value)!=null&&b.attributes.position.count)){const B=y.value.attributes.position.array;for(let _=0;_<y.value.attributes.position.count;_++){const E=x[_*2],T=x[_*2+1];B[_*3]+=E,B[_*3+1]-=T,(B[_*3]<=-r.value[0]/2||B[_*3]>=r.value[0]/2)&&(B[_*3]=B[_*3]*-1),(B[_*3+1]<=-r.value[1]/2||B[_*3+1]>=r.value[1]/2)&&(B[_*3+1]=B[_*3+1]*-1)}y.value.attributes.position.needsUpdate=!0}}),(w,b)=>(p.openBlock(),p.createElementBlock("TresPoints",null,[p.createElementVNode("TresPointsMaterial",{size:p.unref(n),color:p.unref(i),"alpha-map":p.unref(s),map:p.unref(a),opacity:p.unref(o),"alpha-test":p.unref(l),"depth-write":p.unref(h),transparent:p.unref(u),"size-attenuation":p.unref(A)},null,8,cI),p.createElementVNode("TresBufferGeometry",{ref_key:"geometryRef",ref:y,position:[p.unref(C),3],velocity:[p.unref(x)]},null,8,hI)]))}}),AI=["position"],fI=["position"],dI=["scale"],pI=["map","depth-test","color-space","color","opacity"],gI=p.defineComponent({__name:"Smoke",props:{color:{default:"#ffffff"},opacity:{default:.5},speed:{default:.4},width:{default:10},depth:{default:1.5},segments:{default:20},texture:{default:"https://raw.githubusercontent.com/Tresjs/assets/main/textures/clouds/defaultCloud.png"},depthTest:{type:Boolean,default:!0}},async setup(t,{expose:e}){let n,r;const i=t,{width:s,depth:a,segments:o,texture:l,color:h,depthTest:u,opacity:A,speed:f}=p.toRefs(i),d=p.shallowRef(),m=p.shallowRef();e({value:d});const y=[...new Array(o)].map((b,B)=>({x:s.value/2-Math.random()*s.value,y:s.value/2-Math.random()*s.value,scale:.4+Math.sin((B+1)/o.value*Math.PI)*((.2+Math.random())*10),density:Math.max(.2,Math.random()),rotation:Math.max(.002,.005*Math.random())*f.value})),C=(b,B)=>b/6*B*A.value,{map:x}=([n,r]=p.withAsyncContext(()=>Ae.useTexture({map:l.value})),n=await n,r(),n),{renderer:I,camera:g}=Ae.useTresContext(),v=p.computed(()=>{var b;return(b=I.value)==null?void 0:b.outputColorSpace}),{onLoop:w}=Ae.useRenderLoop();return w(()=>{var b,B;d.value&&g.value&&m.value&&((b=m.value)==null||b.children.forEach((_,E)=>{_.rotation.z+=y[E].rotation}),d.value.lookAt((B=g.value)==null?void 0:B.position))}),(b,B)=>(p.openBlock(),p.createElementBlock("TresGroup",p.mergeProps({ref_key:"smokeRef",ref:d},b.$attrs),[p.createElementVNode("TresGroup",{ref_key:"groupRef",ref:m,position:[0,0,p.unref(o)/2*p.unref(a)]},[(p.openBlock(!0),p.createElementBlock(p.Fragment,null,p.renderList(p.unref(y),({scale:_,x:E,y:T,density:L},R)=>(p.openBlock(),p.createElementBlock("TresMesh",{key:`${R}`,position:[E,T,-R*p.unref(a)]},[p.createElementVNode("TresPlaneGeometry",{scale:[_,_,_],rotation:[0,0,0]},null,8,dI),p.createElementVNode("TresMeshStandardMaterial",{map:p.unref(x),"depth-test":p.unref(u),"color-space":v.value,color:p.unref(h),"depth-write":!1,transparent:"",opacity:C(_,L)},null,8,pI)],8,fI))),128))],8,AI)],16))}});class xa extends c.Mesh{constructor(){const e=xa.SkyShader,n=new c.ShaderMaterial({name:"SkyShader",fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:c.UniformsUtils.clone(e.uniforms),side:c.BackSide,depthWrite:!1});super(new c.BoxGeometry(1,1,1),n),this.isSky=!0}}xa.SkyShader={uniforms:{turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:.005},mieDirectionalG:{value:.8},sunPosition:{value:new c.Vector3},up:{value:new c.Vector3(0,1,0)}},vertexShader:`
|
|
1547
|
+
uniform vec3 sunPosition;
|
|
1548
|
+
uniform float rayleigh;
|
|
1549
|
+
uniform float turbidity;
|
|
1550
|
+
uniform float mieCoefficient;
|
|
1551
|
+
uniform vec3 up;
|
|
1552
|
+
|
|
1553
|
+
varying vec3 vWorldPosition;
|
|
1554
|
+
varying vec3 vSunDirection;
|
|
1555
|
+
varying float vSunfade;
|
|
1556
|
+
varying vec3 vBetaR;
|
|
1557
|
+
varying vec3 vBetaM;
|
|
1558
|
+
varying float vSunE;
|
|
1559
|
+
|
|
1560
|
+
// constants for atmospheric scattering
|
|
1561
|
+
const float e = 2.71828182845904523536028747135266249775724709369995957;
|
|
1562
|
+
const float pi = 3.141592653589793238462643383279502884197169;
|
|
1563
|
+
|
|
1564
|
+
// wavelength of used primaries, according to preetham
|
|
1565
|
+
const vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 );
|
|
1566
|
+
// this pre-calcuation replaces older TotalRayleigh(vec3 lambda) function:
|
|
1567
|
+
// (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn))
|
|
1568
|
+
const vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 );
|
|
1569
|
+
|
|
1570
|
+
// mie stuff
|
|
1571
|
+
// K coefficient for the primaries
|
|
1572
|
+
const float v = 4.0;
|
|
1573
|
+
const vec3 K = vec3( 0.686, 0.678, 0.666 );
|
|
1574
|
+
// MieConst = pi * pow( ( 2.0 * pi ) / lambda, vec3( v - 2.0 ) ) * K
|
|
1575
|
+
const vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 );
|
|
1576
|
+
|
|
1577
|
+
// earth shadow hack
|
|
1578
|
+
// cutoffAngle = pi / 1.95;
|
|
1579
|
+
const float cutoffAngle = 1.6110731556870734;
|
|
1580
|
+
const float steepness = 1.5;
|
|
1581
|
+
const float EE = 1000.0;
|
|
1582
|
+
|
|
1583
|
+
float sunIntensity( float zenithAngleCos ) {
|
|
1584
|
+
zenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 );
|
|
1585
|
+
return EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) );
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
vec3 totalMie( float T ) {
|
|
1589
|
+
float c = ( 0.2 * T ) * 10E-18;
|
|
1590
|
+
return 0.434 * c * MieConst;
|
|
1591
|
+
}
|
|
1592
|
+
|
|
1593
|
+
void main() {
|
|
1594
|
+
|
|
1595
|
+
vec4 worldPosition = modelMatrix * vec4( position, 1.0 );
|
|
1596
|
+
vWorldPosition = worldPosition.xyz;
|
|
1597
|
+
|
|
1598
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
1599
|
+
gl_Position.z = gl_Position.w; // set z to camera.far
|
|
1600
|
+
|
|
1601
|
+
vSunDirection = normalize( sunPosition );
|
|
1602
|
+
|
|
1603
|
+
vSunE = sunIntensity( dot( vSunDirection, up ) );
|
|
1604
|
+
|
|
1605
|
+
vSunfade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 );
|
|
1606
|
+
|
|
1607
|
+
float rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) );
|
|
1608
|
+
|
|
1609
|
+
// extinction (absorbtion + out scattering)
|
|
1610
|
+
// rayleigh coefficients
|
|
1611
|
+
vBetaR = totalRayleigh * rayleighCoefficient;
|
|
1612
|
+
|
|
1613
|
+
// mie coefficients
|
|
1614
|
+
vBetaM = totalMie( turbidity ) * mieCoefficient;
|
|
1615
|
+
|
|
1616
|
+
}`,fragmentShader:`
|
|
1617
|
+
varying vec3 vWorldPosition;
|
|
1618
|
+
varying vec3 vSunDirection;
|
|
1619
|
+
varying float vSunfade;
|
|
1620
|
+
varying vec3 vBetaR;
|
|
1621
|
+
varying vec3 vBetaM;
|
|
1622
|
+
varying float vSunE;
|
|
1623
|
+
|
|
1624
|
+
uniform float mieDirectionalG;
|
|
1625
|
+
uniform vec3 up;
|
|
1626
|
+
|
|
1627
|
+
// constants for atmospheric scattering
|
|
1628
|
+
const float pi = 3.141592653589793238462643383279502884197169;
|
|
1629
|
+
|
|
1630
|
+
const float n = 1.0003; // refractive index of air
|
|
1631
|
+
const float N = 2.545E25; // number of molecules per unit volume for air at 288.15K and 1013mb (sea level -45 celsius)
|
|
1632
|
+
|
|
1633
|
+
// optical length at zenith for molecules
|
|
1634
|
+
const float rayleighZenithLength = 8.4E3;
|
|
1635
|
+
const float mieZenithLength = 1.25E3;
|
|
1636
|
+
// 66 arc seconds -> degrees, and the cosine of that
|
|
1637
|
+
const float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;
|
|
1638
|
+
|
|
1639
|
+
// 3.0 / ( 16.0 * pi )
|
|
1640
|
+
const float THREE_OVER_SIXTEENPI = 0.05968310365946075;
|
|
1641
|
+
// 1.0 / ( 4.0 * pi )
|
|
1642
|
+
const float ONE_OVER_FOURPI = 0.07957747154594767;
|
|
1643
|
+
|
|
1644
|
+
float rayleighPhase( float cosTheta ) {
|
|
1645
|
+
return THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) );
|
|
1646
|
+
}
|
|
1647
|
+
|
|
1648
|
+
float hgPhase( float cosTheta, float g ) {
|
|
1649
|
+
float g2 = pow( g, 2.0 );
|
|
1650
|
+
float inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 );
|
|
1651
|
+
return ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse );
|
|
1652
|
+
}
|
|
1653
|
+
|
|
1654
|
+
void main() {
|
|
1655
|
+
|
|
1656
|
+
vec3 direction = normalize( vWorldPosition - cameraPosition );
|
|
1657
|
+
|
|
1658
|
+
// optical length
|
|
1659
|
+
// cutoff angle at 90 to avoid singularity in next formula.
|
|
1660
|
+
float zenithAngle = acos( max( 0.0, dot( up, direction ) ) );
|
|
1661
|
+
float inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) );
|
|
1662
|
+
float sR = rayleighZenithLength * inverse;
|
|
1663
|
+
float sM = mieZenithLength * inverse;
|
|
1664
|
+
|
|
1665
|
+
// combined extinction factor
|
|
1666
|
+
vec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) );
|
|
1667
|
+
|
|
1668
|
+
// in scattering
|
|
1669
|
+
float cosTheta = dot( direction, vSunDirection );
|
|
1670
|
+
|
|
1671
|
+
float rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 );
|
|
1672
|
+
vec3 betaRTheta = vBetaR * rPhase;
|
|
1673
|
+
|
|
1674
|
+
float mPhase = hgPhase( cosTheta, mieDirectionalG );
|
|
1675
|
+
vec3 betaMTheta = vBetaM * mPhase;
|
|
1676
|
+
|
|
1677
|
+
vec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) );
|
|
1678
|
+
Lin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) );
|
|
1679
|
+
|
|
1680
|
+
// nightsky
|
|
1681
|
+
float theta = acos( direction.y ); // elevation --> y-axis, [-pi/2, pi/2]
|
|
1682
|
+
float phi = atan( direction.z, direction.x ); // azimuth --> x-axis [-pi/2, pi/2]
|
|
1683
|
+
vec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 );
|
|
1684
|
+
vec3 L0 = vec3( 0.1 ) * Fex;
|
|
1685
|
+
|
|
1686
|
+
// composition + solar disc
|
|
1687
|
+
float sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta );
|
|
1688
|
+
L0 += ( vSunE * 19000.0 * Fex ) * sundisk;
|
|
1689
|
+
|
|
1690
|
+
vec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 );
|
|
1691
|
+
|
|
1692
|
+
vec3 retColor = pow( texColor, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) );
|
|
1693
|
+
|
|
1694
|
+
gl_FragColor = vec4( retColor, 1.0 );
|
|
1695
|
+
|
|
1696
|
+
#include <tonemapping_fragment>
|
|
1697
|
+
#include <colorspace_fragment>
|
|
1698
|
+
|
|
1699
|
+
}`};const mI=["object","material-uniforms-turbidity-value","material-uniforms-rayleigh-value","material-uniforms-mieCoefficient-value","material-uniforms-mieDirectionalG-value","material-uniforms-sunPosition-value","scale"],vI=p.defineComponent({__name:"Sky",props:{turbidity:{default:3.4},rayleigh:{default:3},mieCoefficient:{default:.005},mieDirectionalG:{default:.7},elevation:{default:.6},azimuth:{default:180},distance:{default:45e4}},setup(t){const e=t,n=new xa,r=p.computed(()=>i(e.azimuth,e.elevation));function i(s,a){const o=c.MathUtils.degToRad(90-a),l=c.MathUtils.degToRad(s);return new c.Vector3().setFromSphericalCoords(1,o,l)}return(s,a)=>(p.openBlock(),p.createElementBlock("primitive",{object:p.unref(n),"material-uniforms-turbidity-value":e.turbidity,"material-uniforms-rayleigh-value":e.rayleigh,"material-uniforms-mieCoefficient-value":e.mieCoefficient,"material-uniforms-mieDirectionalG-value":e.mieDirectionalG,"material-uniforms-sunPosition-value":r.value,scale:e.distance},null,8,mI))}});let wn;const yI=(t="body")=>{wn||(wn=new A2.Pane({container:document.querySelector(t)}),wn.element.style.position="absolute",wn.element.style.top="1rem",wn.element.style.right="1rem",wn.element.style.zIndex="9999");const{logWarning:e}=Sl();e("useTweakPane is going to be deprecated soon and will no longer be part of this package, please start migrating to @tresjs/leches package https://github.com/Tresjs/leches or v-tweakpane https://github.com/vinayakkulkarni/v-tweakpane instead.");function n(){wn&&wn.dispose()}return p.onMounted(()=>{const{resume:r}=Ae.useRenderLoop();r()}),p.onUnmounted(()=>{n()}),{pane:wn,disposeTweakPane:n}};var CI=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function II(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var a2={exports:{}};(function(t,e){(function(n,r){t.exports=r()})(CI,function(){var n=function(){function r(d){return a.appendChild(d.dom),d}function i(d){for(var m=0;m<a.children.length;m++)a.children[m].style.display=m===d?"block":"none";s=d}var s=0,a=document.createElement("div");a.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",a.addEventListener("click",function(d){d.preventDefault(),i(++s%a.children.length)},!1);var o=(performance||Date).now(),l=o,h=0,u=r(new n.Panel("FPS","#0ff","#002")),A=r(new n.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var f=r(new n.Panel("MB","#f08","#201"));return i(0),{REVISION:16,dom:a,addPanel:r,showPanel:i,begin:function(){o=(performance||Date).now()},end:function(){h++;var d=(performance||Date).now();if(A.update(d-o,200),d>l+1e3&&(u.update(1e3*h/(d-l),100),l=d,h=0,f)){var m=performance.memory;f.update(m.usedJSHeapSize/1048576,m.jsHeapSizeLimit/1048576)}return d},update:function(){o=this.end()},domElement:a,setMode:i}};return n.Panel=function(r,i,s){var a=1/0,o=0,l=Math.round,h=l(window.devicePixelRatio||1),u=80*h,A=48*h,f=3*h,d=2*h,m=3*h,y=15*h,C=74*h,x=30*h,I=document.createElement("canvas");I.width=u,I.height=A,I.style.cssText="width:80px;height:48px";var g=I.getContext("2d");return g.font="bold "+9*h+"px Helvetica,Arial,sans-serif",g.textBaseline="top",g.fillStyle=s,g.fillRect(0,0,u,A),g.fillStyle=i,g.fillText(r,f,d),g.fillRect(m,y,C,x),g.fillStyle=s,g.globalAlpha=.9,g.fillRect(m,y,C,x),{dom:I,update:function(v,w){a=Math.min(a,v),o=Math.max(o,v),g.fillStyle=s,g.globalAlpha=1,g.fillRect(0,0,u,y),g.fillStyle=i,g.fillText(l(v)+" "+r+" ("+l(a)+"-"+l(o)+")",f,d),g.drawImage(I,m+h,y,C-h,x,m,y,C-h,x),g.fillRect(m+C-h,y,h,x),g.fillStyle=s,g.globalAlpha=.9,g.fillRect(m+C-h,y,h,l((1-v/w)*x))}}},n})})(a2);var xI=a2.exports;const SI=II(xI),BI=p.defineComponent({name:"Stats",props:{showPanel:{type:Number,default:0}},setup(t,{expose:e}){const n=new SI;e({stats:n});const r=document.body;n.showPanel(t.showPanel||0),r==null||r.appendChild(n.dom);const{onBeforeLoop:i,onAfterLoop:s,resume:a}=Ae.useRenderLoop();return a(),i(()=>n.begin()),s(()=>n.end()),p.onUnmounted(()=>{r==null||r.removeChild(n.dom)}),null}});class wI{constructor(e,n,r){this.name=e,this.fg=n,this.bg=r,this.PR=Math.round(window.devicePixelRatio||1),this.WIDTH=90*this.PR,this.HEIGHT=48*this.PR,this.TEXT_X=3*this.PR,this.TEXT_Y=2*this.PR,this.GRAPH_X=3*this.PR,this.GRAPH_Y=15*this.PR,this.GRAPH_WIDTH=84*this.PR,this.GRAPH_HEIGHT=30*this.PR,this.canvas=document.createElement("canvas"),this.canvas.width=90*this.PR,this.canvas.height=48*this.PR,this.canvas.style.width="90px",this.canvas.style.position="absolute",this.canvas.style.height="48px",this.canvas.style.cssText="width:90px;height:48px",this.context=this.canvas.getContext("2d"),this.context&&(this.context.font="bold "+9*this.PR+"px Helvetica,Arial,sans-serif",this.context.textBaseline="top",this.context.fillStyle=this.bg,this.context.fillRect(0,0,this.WIDTH,this.HEIGHT),this.context.fillStyle=this.fg,this.context.fillText(this.name,this.TEXT_X,this.TEXT_Y),this.context.fillRect(this.GRAPH_X,this.GRAPH_Y,this.GRAPH_WIDTH,this.GRAPH_HEIGHT),this.context.fillStyle=this.bg,this.context.globalAlpha=.9,this.context.fillRect(this.GRAPH_X,this.GRAPH_Y,this.GRAPH_WIDTH,this.GRAPH_HEIGHT))}update(e,n,r,i,s=0){let a=1/0,o=0;this.context&&(a=Math.min(a,e),o=Math.max(r,e),i=Math.max(i,n),this.context.fillStyle=this.bg,this.context.globalAlpha=1,this.context.fillRect(0,0,this.WIDTH,this.GRAPH_Y),this.context.fillStyle=this.fg,this.context.fillText(e.toFixed(s)+" "+this.name+" ("+a.toFixed(s)+"-"+parseFloat(o.toFixed(s))+")",this.TEXT_X,this.TEXT_Y),this.context.drawImage(this.canvas,this.GRAPH_X+this.PR,this.GRAPH_Y,this.GRAPH_WIDTH-this.PR,this.GRAPH_HEIGHT,this.GRAPH_X,this.GRAPH_Y,this.GRAPH_WIDTH-this.PR,this.GRAPH_HEIGHT),this.context.fillRect(this.GRAPH_X+this.GRAPH_WIDTH-this.PR,this.GRAPH_Y,this.PR,this.GRAPH_HEIGHT),this.context.fillStyle=this.bg,this.context.globalAlpha=.9,this.context.fillRect(this.GRAPH_X+this.GRAPH_WIDTH-this.PR,this.GRAPH_Y,this.PR,(1-n/i)*this.GRAPH_HEIGHT))}}const o2=class Ea{constructor({logsPerSecond:e=20,samplesLog:n=100,samplesGraph:r=10,precision:i=2,minimal:s=!1,horizontal:a=!0,mode:o=0}={}){this.mode=o,this.horizontal=a,this.container=document.createElement("div"),this.container.style.cssText="position:fixed;top:0;left:0;opacity:0.9;z-index:10000;",s&&(this.container.style.cssText+="cursor:pointer"),this.canvasGpu=null,this.gl=null,this.query=null,this.minimal=s,this.beginTime=(performance||Date).now(),this.prevTime=this.beginTime,this.prevCpuTime=this.beginTime,this.frames=0,this.averageCpu={logs:[],graph:[]},this.averageGpu={logs:[],graph:[]},this.queryCreated=!1,this.fpsPanel=this.addPanel(new Ea.Panel("FPS","#0ff","#002"),0),this.msPanel=this.addPanel(new Ea.Panel("CPU","#0f0","#020"),1),this.gpuPanel=null,this.samplesLog=n,this.samplesGraph=r,this.precision=i,this.logsPerSecond=e,this.minimal?(this.container.addEventListener("click",l=>{l.preventDefault(),this.showPanel(++this.mode%this.container.children.length)},!1),this.mode=o,this.showPanel(this.mode)):window.addEventListener("resize",()=>{this.resizePanel(this.fpsPanel,0),this.resizePanel(this.msPanel,1),this.gpuPanel&&this.resizePanel(this.gpuPanel,2)})}resizePanel(e,n){e.canvas.style.position="absolute",this.minimal?e.canvas.style.display="none":(e.canvas.style.display="block",this.horizontal?(e.canvas.style.top="0px",e.canvas.style.left=n*e.WIDTH/e.PR+"px"):(e.canvas.style.left="0px",e.canvas.style.top=n*e.HEIGHT/e.PR+"px"))}addPanel(e,n){return e.canvas&&(this.container.appendChild(e.canvas),this.resizePanel(e,n)),e}showPanel(e){for(let n=0;n<this.container.children.length;n++){const r=this.container.children[n];r.style.display=n===e?"block":"none"}this.mode=e}init(e){this.canvasGpu=e,this.canvasGpu&&(this.gl=this.canvasGpu.getContext("webgl2"),this.ext=this.gl?this.gl.getExtension("EXT_disjoint_timer_query_webgl2"):null,this.ext&&(this.gpuPanel=this.addPanel(new Ea.Panel("GPU","#ff0","#220"),2)))}begin(){if(this.beginProfiling("cpu-started"),!(!this.gl||!this.ext)){if(this.query){const e=this.gl.getQueryParameter(this.query,this.gl.QUERY_RESULT_AVAILABLE);if(this.disjoint=this.gl.getParameter(this.ext.GPU_DISJOINT_EXT),e&&!this.disjoint){this.ns=this.gl.getQueryParameter(this.query,this.gl.QUERY_RESULT);const n=this.ns*1e-6;(e||this.disjoint)&&(this.gl.deleteQuery(this.query),this.query=null),e&&this.addToAverage(n,this.averageGpu)}}this.query||(this.queryCreated=!0,this.query=this.gl.createQuery(),this.query&&this.gl.beginQuery(this.ext.TIME_ELAPSED_EXT,this.query))}}end(){this.beginTime=this.endInternal(),this.endProfiling("cpu-started","cpu-finished","cpu-duration",this.averageCpu),!(!this.gl||!this.ext)&&this.queryCreated&&this.gl.getQuery(this.ext.TIME_ELAPSED_EXT,this.gl.CURRENT_QUERY)&&this.gl.endQuery(this.ext.TIME_ELAPSED_EXT)}endInternal(){this.frames++;const e=(performance||Date).now();if(e>=this.prevCpuTime+1e3/this.logsPerSecond&&(this.updatePanel(this.msPanel,this.averageCpu),this.updatePanel(this.gpuPanel,this.averageGpu),this.prevCpuTime=e),e>=this.prevTime+1e3){const n=this.frames*1e3/(e-this.prevTime);this.fpsPanel.update(n,n,100,100,0),this.prevTime=e,this.frames=0}return e}addToAverage(e,n){n.logs.push(e),n.logs.length>this.samplesLog&&n.logs.shift(),n.graph.push(e),n.graph.length>this.samplesGraph&&n.graph.shift()}beginProfiling(e){window.performance&&window.performance.mark(e)}endProfiling(e,n,r,i){if(window.performance&&n){window.performance.mark(n);const s=performance.measure(r,e,n);this.addToAverage(s.duration,i)}}updatePanel(e,n){if(n.logs.length>0){let r=0,i=.01;for(let o=0;o<n.logs.length;o++)r+=n.logs[o],n.logs[o]>i&&(i=n.logs[o]);let s=0,a=.01;for(let o=0;o<n.graph.length;o++)s+=n.graph[o],n.graph[o]>a&&(a=n.graph[o]);e&&e.update(r/Math.min(n.logs.length,this.samplesLog),s/Math.min(n.graph.length,this.samplesGraph),i,a,this.precision)}}};o2.Panel=wI;let bI=o2;const _I=p.defineComponent({name:"StatsGl",props:["logsPerSecond","samplesLog","samplesGraph","precision","horizontal","minimal","mode"],async setup(t,{expose:e}){const n=new bI({logsPerSecond:t.logsPerSecond,samplesLog:t.samplesLog,samplesGraph:t.samplesGraph,precision:t.precision,horizontal:t.horizontal,minimal:t.minimal,mode:t.mode});e({statsGl:n});const r=document.body;r==null||r.appendChild(n.container);const{renderer:i}=Ae.useTresContext(),{onBeforeLoop:s,onAfterLoop:a,resume:o}=Ae.useRenderLoop();return n.init(i.value.domElement),o(),s(()=>n.begin()),a(()=>n.end()),p.onUnmounted(()=>{r==null||r.removeChild(n.container)}),null}});var EI=`#include <common>
|
|
1700
|
+
|
|
1701
|
+
void main() {
|
|
1702
|
+
vec2 center = vec2(0., 1.);
|
|
1703
|
+
float rotation = 0.0;
|
|
1704
|
+
|
|
1705
|
+
|
|
1706
|
+
|
|
1707
|
+
float size = 0.03;
|
|
1708
|
+
|
|
1709
|
+
vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
|
|
1710
|
+
vec2 scale;
|
|
1711
|
+
scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
|
|
1712
|
+
scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
|
|
1713
|
+
|
|
1714
|
+
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
|
|
1715
|
+
if ( isPerspective ) scale *= - mvPosition.z;
|
|
1716
|
+
|
|
1717
|
+
vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale * size;
|
|
1718
|
+
vec2 rotatedPosition;
|
|
1719
|
+
rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
|
|
1720
|
+
rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
|
|
1721
|
+
mvPosition.xy += rotatedPosition;
|
|
1722
|
+
|
|
1723
|
+
gl_Position = projectionMatrix * mvPosition;
|
|
1724
|
+
}`,TI=`void main() {
|
|
1725
|
+
gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
|
|
1726
|
+
}`;const zi=new c.Vector3(0,0,0),Vl=new c.Vector3(0,0,0),MI=new c.Vector3(0,0,0);function l2(t,e,n){const r=zi.setFromMatrixPosition(t.matrixWorld);r.project(e);const i=n.width/2,s=n.height/2;return[(Number.isNaN(r.x)?0:r.x)*i+i,-(r.y*s)+s]}function DI(t,e){const n=zi.setFromMatrixPosition(t.matrixWorld),r=Vl.setFromMatrixPosition(e.matrixWorld),i=n.sub(r),s=e.getWorldDirection(MI);return i.angleTo(s)>Math.PI/2}function LI(t,e,n,r){const i=zi.setFromMatrixPosition(t.matrixWorld),s=i.clone();s.project(e),n.setFromCamera(new c.Vector2(s.x,s.y),e);const a=n.intersectObjects(r,!0);if(a.length>0){const o=a[0].distance;return i.distanceTo(n.ray.origin)<o}return!0}function PI(t,e){if(e instanceof c.OrthographicCamera)return e.zoom;if(e instanceof c.PerspectiveCamera){const n=zi.setFromMatrixPosition(t.matrixWorld),r=Vl.setFromMatrixPosition(e.matrixWorld),i=e.fov*Math.PI/180,s=n.distanceTo(r);return 1/(2*Math.tan(i/2)*s)}else return 1}function FI(t,e,n){if(e instanceof c.PerspectiveCamera||e instanceof c.OrthographicCamera){const r=zi.setFromMatrixPosition(t.matrixWorld),i=Vl.setFromMatrixPosition(e.matrixWorld),s=r.distanceTo(i),a=(n[1]-n[0])/(e.far-e.near),o=n[1]-a*e.far;return Math.round(a*s+o)}}const zl=t=>Math.abs(t)<1e-10?0:t;function c2(t,e,n=""){let r="matrix3d(";for(let i=0;i!==16;i++)r+=zl(e[i]*t.elements[i])+(i!==15?",":")");return n+r}const kI=(t=>e=>c2(e,t))([1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1]),OI=(t=>(e,n)=>c2(e,t(n),"translate(-50%,-50%)"))(t=>[1/t,1/t,1/t,1,-1/t,-1/t,-1/t,-1,1/t,1/t,1/t,1,1,1,1,1]),RI=["geometry","material"],UI=p.defineComponent({__name:"HTML",props:{geometry:{default:new c.PlaneGeometry},material:{},as:{default:"div"},transform:{type:Boolean,default:!1},portal:{},wrapperClass:{},eps:{default:1e-4},distanceFactor:{},fullscreen:{type:Boolean},center:{type:Boolean},pointerEvents:{default:"auto"},sprite:{type:Boolean,default:!1},zIndexRange:{default:()=>[16777271,0]},occlude:{type:[Array,Boolean,String]}},emits:["onOcclude"],setup(t,{emit:e}){const n=t,r=p.useAttrs(),i=p.useSlots(),s=p.ref(),a=p.ref(),{geometry:o,material:l,as:h,transform:u,portal:A,wrapperClass:f,eps:d,distanceFactor:m,fullscreen:y,center:C,pointerEvents:x,sprite:I,occlude:g,zIndexRange:v}=p.toRefs(n),{renderer:w,scene:b,camera:B,raycaster:_,sizes:E}=Ae.useTresContext(),T=p.computed(()=>document.createElement(h.value)),L=p.ref([0,0]),R=p.ref(0),V=p.ref(),Y=p.computed(()=>u.value?{position:"absolute",top:0,left:0,width:`${E.width.value}px`,height:`${E.height.value}px`,transformStyle:"preserve-3d",pointerEvents:"none",zIndex:2,willChange:"transform"}:{position:"absolute",transform:C.value?"translate3d(-50%,-50%,0)":"none",...y.value&&{top:-E.height.value/2,left:-E.width.value/2,width:`${E.width.value}px`,height:`${E.height.value}px`},zIndex:2,...r.style,willChange:"transform"}),q=p.computed(()=>({position:"absolute",pointerEvents:x.value})),ne=p.ref(null),X=p.ref(!1),G=p.computed(()=>(g==null?void 0:g.value)&&(g==null?void 0:g.value)!=="blending"||Array.isArray(g==null?void 0:g.value)&&(g==null?void 0:g.value.length)&&p.isRef(g.value[0]));p.watch(()=>g,F=>{F&&F==="blending"?(T.value.style.zIndex=`${Math.floor(v.value[0]/2)}`,T.value.style.position="absolute",T.value.style.pointerEvents="none"):(T.value.style.zIndex=null,T.value.style.position=null,T.value.style.pointerEvents=null)}),p.watch(()=>[s.value,w.value,E.width.value,E.height.value],([F,S])=>{var Q,z,P,K;if(F&&S){const se=(A==null?void 0:A.value)||S.domElement;if((Q=b.value)==null||Q.updateMatrixWorld(),u.value)T.value.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{const J=l2(F,B.value,{width:E.width.value,height:E.height.value});T.value.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${J[0]}px,${J[1]}px,0);transform-origin:0 0;`}se&&((z=se.parentNode)==null||z.appendChild(T.value)),u.value?V.value=p.createVNode("div",{id:"outer",style:Y.value},[p.createVNode("div",{id:"inner",style:q.value},[p.createVNode("div",{id:b==null?void 0:b.value.uuid,class:r.class,style:r.style},(P=i.default)==null?void 0:P.call(i))])]):V.value=p.createVNode("div",{id:b==null?void 0:b.value.uuid,style:Y.value},(K=i.default)==null?void 0:K.call(i)),p.render(V.value,T.value)}}),p.watchEffect(()=>{f!=null&&f.value&&(T.value.className=f.value)});const H=p.ref(!0),{onLoop:Z}=Ae.useRenderLoop();Z(()=>{var F,S,Q,z,P,K,se;if(s.value&&B.value&&w.value){(F=B.value)==null||F.updateMatrixWorld(),s.value.updateWorldMatrix(!0,!1);const J=u.value?L.value:l2(s.value,B.value,{width:E.width.value||0,height:E.height.value||0});if(u.value||Math.abs(R.value-B.value.zoom)>d.value||Math.abs(L.value[0]-J[0])>d.value||Math.abs(L.value[1]-J[1])>d.value){const ie=DI(s.value,B.value);let ee=!1;G.value&&(Array.isArray(g==null?void 0:g.value)?ee=g==null?void 0:g.value:(g==null?void 0:g.value)!=="blending"&&(ee=[b.value]));const fe=H.value;if(ee){const U=LI(s.value,B.value,_.value,ee);H.value=U&&!ie}else H.value=!ie;fe!==H.value&&(e("onOcclude",!H.value),T.value.style.display=H.value?"block":"none");const te=Math.floor(v.value[0]/2),oe=g!=null&&g.value?G.value?[v.value[0],te]:[te-1,0]:v.value;if(T.value.style.zIndex=`${FI(s.value,B.value,oe)}`,T.value.style.willChange="transform",u.value){const[U,D]=[E.width.value/2,E.height.value/2],le=B.value.projectionMatrix.elements[5]*D,{isOrthographicCamera:Se,top:De,left:Ue,bottom:qe,right:ht}=B.value,fn=kI(B.value.matrixWorldInverse),_n=Se?`scale(${le})translate(${zl(-(ht+Ue)/2)}px,${zl((De+qe)/2)}px)`:`translateZ(${le}px)`;let st=s.value.matrixWorld;I.value&&(st=B.value.matrixWorldInverse.clone().transpose().copyPosition(st).scale(s.value.scale),st.elements[3]=st.elements[7]=st.elements[11]=0,st.elements[15]=1),T.value.style.width=`${E.width.value}px`,T.value.style.height=`${E.height.value}px`,T.value.style.perspective=Se?"":`${le}px`,(S=V.value)!=null&&S.el&&((Q=V.value)!=null&&Q.children)&&(V.value.el.style.willChange="transform",V.value.el.style.transform=`${_n}${fn}translate(${U}px,${D}px)`,V.value.children[0].willChange="transform",V.value.children[0].el.style.transform=OI(st,1/(((m==null?void 0:m.value)||10)/400)))}else{const U=(m==null?void 0:m.value)===void 0?1:PI(s.value,B.value)*(m==null?void 0:m.value);T.value.style.transform=`translate3d(${J[0]}px,${J[1]}px,0) scale(${U})`}}L.value=J,R.value=B.value.zoom}if(!G.value&&a.value&&!X.value)if(u.value){if((z=V.value)!=null&&z.el&&((P=V.value)!=null&&P.children)){const J=(K=V.value)==null?void 0:K.children[0];if(J!=null&&J.clientWidth&&(J!=null&&J.clientHeight)){const{isOrthographicCamera:ie}=B.value;if(ie||o)r.scale&&(Array.isArray(r.scale)?r.scale instanceof c.Vector3?a.value.scale.copy(r.scale.clone().divideScalar(1)):a.value.scale.set(1/r.scale[0],1/r.scale[1],1/r.scale[2]):a.value.scale.setScalar(1/r.scale));else{const ee=((m==null?void 0:m.value)||10)/400,fe=J.clientWidth*ee,te=J.clientHeight*ee;a.value.scale.set(fe,te,1)}X.value=!0}}}else{const J=T.value.children[0];if(J!=null&&J.clientWidth&&(J!=null&&J.clientHeight)){const ee=J.clientWidth*1,fe=J.clientHeight*1;a.value.scale.set(ee,fe,1),X.value=!0}ne.value.lookAt((se=B.value)==null?void 0:se.position)}});const $=p.computed(()=>({vertexShader:u.value?void 0:EI,fragmentShader:TI})),O=p.computed(()=>{const F=$.value;return l.value||new c.ShaderMaterial({vertexShader:F.vertexShader,fragmentShader:F.fragmentShader,side:c.DoubleSide})});return p.onUnmounted(()=>{O.value&&O.value.dispose()}),(F,S)=>(p.openBlock(),p.createElementBlock("TresGroup",{ref_key:"groupRef",ref:s},[p.unref(g)&&!G.value?(p.openBlock(),p.createElementBlock("TresMesh",{key:0,ref_key:"meshRef",ref:a,geometry:p.unref(o),material:O.value},null,8,RI)):p.createCommentVNode("",!0)],512))}}),QI={mounted:(t,e)=>{if(e.arg){console.log(`v-log:${e.arg}`,t[e.arg]);return}console.log("v-log",t)}},{logWarning:h2}=Ae.useLogger(),NI={mounted:t=>{if(!t.isLight){h2(`${t.type} is not a light`);return}Sa=GI[t.type],t.parent.add(new Sa(t))},updated:t=>{Wi=t.parent.children.find(e=>e instanceof Sa),Wi.update()},unmounted:t=>{if(!t.isLight){h2(`${t.type} is not a light`);return}Wi=t.parent.children.find(e=>e instanceof Sa),Wi.dispose(),t.parent.remove(Wi)}};let Sa,Wi;const GI={DirectionalLight:c.DirectionalLightHelper,PointLight:c.PointLightHelper,SpotLight:c.SpotLightHelper,HemisphereLight:c.HemisphereLightHelper};function VI(t,e){const n={};for(const r of e)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function zI(t,e){const n=`set${e[0].toUpperCase()}${e.slice(1)}`;return t[n]!==void 0}function Wl(t){var n,r;let e=t.value;return t.value&&((r=(n=t.value)==null?void 0:n.value)!=null&&r.isMesh)&&(e=t.value.value.position),Array.isArray(t.value)&&(e=new c.Vector3(...e)),e}const{logWarning:WI}=Ae.useLogger(),YI={updated:(t,e)=>{const n=Wl(e);if(!n){WI(`v-always-look-at: problem with binding value: ${e.value}`);return}const{onLoop:r}=Ae.useRenderLoop();r(()=>{t.lookAt(n)})}},{logWarning:jI}=Ae.useLogger(),qI={updated:(t,e)=>{var i;const n=Wl(e);if(!n){jI(`v-distance-to: problem with binding value: ${e.value}`);return}bn&&(bn.dispose(),t.parent.remove(bn));const r=n.clone().sub(t.position);r.normalize(),bn=new c.ArrowHelper(r,t.position,t.position.distanceTo(n)/1.5,16776960),t.parent.add(bn),console.table([["Distance:",t.position.distanceTo(n)],[`origin: ${t.name||t.type}`,`x:${t.position.x}, y:${t.position.y}, z:${(i=t.position)==null?void 0:i.z}`],[`Destiny: ${t.name||t.type}`,`x:${n.x}, y:${n.y}, z:${n==null?void 0:n.z}`]])},unmounted:t=>{bn==null||bn.dispose(),t.parent.remove(bn)}};let bn=null;k.Backdrop=$C,k.Box=iC,k.CameraControls=Yy,k.CatmullRomCurve3=hC,k.Circle=fC,k.Cone=gC,k.ContactShadows=sI,k.Dodecahedron=yC,k.Environment=XC,k.FBXModel=xy,k.Fbo=gy,k.GLTFModel=Cy,k.GlobalAudio=Hv,k.Html=UI,k.Icosahedron=xC,k.KeyboardControls=Ly,k.Lensflare=py,k.Levioso=Pv,k.Line2=s2,k.MapControls=Uy,k.MeshGlassMaterial=tC,k.MeshWobbleMaterial=Ky,k.MouseParallax=Jv,k.Octahedron=wC,k.OrbitControls=Ey,k.Plane=TC,k.PointerLockControls=Oy,k.Precipitation=uI,k.Ring=LC,k.SVG=By,k.ScrollControls=Qy,k.Sky=vI,k.Smoke=gI,k.Sphere=kC,k.Stars=lI,k.Stats=BI,k.StatsGl=_I,k.Tetrahedron=QC,k.Text3D=Dv,k.Torus=VC,k.TorusKnot=YC,k.TransformControls=Fy,k.Tube=KC,k.extractBindingPosition=Wl,k.hasSetter=zI,k.pick=VI,k.useAnimations=Lv,k.useEnvironment=D0,k.useFBO=M0,k.useFBX=P0,k.useGLTF=L0,k.useProgress=wy,k.useTweakPane=yI,k.useVideoTexture=by,k.vAlwaysLookAt=YI,k.vDistanceTo=qI,k.vLightHelper=NI,k.vLog=QI,Object.defineProperty(k,Symbol.toStringTag,{value:"Module"})});
|